mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-08-27 06:39:24 +00:00
Added optional title step
This commit is contained in:
parent
23d86deae7
commit
57286ab7ff
@ -25,6 +25,7 @@ export interface ToolStepProps {
|
|||||||
_stepNumber?: number; // Internal prop set by ToolStepContainer
|
_stepNumber?: number; // Internal prop set by ToolStepContainer
|
||||||
_excludeFromCount?: boolean; // Internal prop to exclude from visible count calculation
|
_excludeFromCount?: boolean; // Internal prop to exclude from visible count calculation
|
||||||
_noPadding?: boolean; // Internal prop to exclude from default left padding
|
_noPadding?: boolean; // Internal prop to exclude from default left padding
|
||||||
|
alwaysShowTooltip?: boolean; // Force tooltip to show even when collapsed
|
||||||
tooltip?: {
|
tooltip?: {
|
||||||
content?: React.ReactNode;
|
content?: React.ReactNode;
|
||||||
tips?: TooltipTip[];
|
tips?: TooltipTip[];
|
||||||
@ -38,9 +39,10 @@ export interface ToolStepProps {
|
|||||||
const renderTooltipTitle = (
|
const renderTooltipTitle = (
|
||||||
title: string,
|
title: string,
|
||||||
tooltip: ToolStepProps['tooltip'],
|
tooltip: ToolStepProps['tooltip'],
|
||||||
isCollapsed: boolean
|
isCollapsed: boolean,
|
||||||
|
alwaysShowTooltip: boolean = false
|
||||||
) => {
|
) => {
|
||||||
if (tooltip && !isCollapsed) {
|
if (tooltip && (!isCollapsed || alwaysShowTooltip)) {
|
||||||
return (
|
return (
|
||||||
<Tooltip
|
<Tooltip
|
||||||
content={tooltip.content}
|
content={tooltip.content}
|
||||||
@ -77,6 +79,7 @@ const ToolStep = ({
|
|||||||
showNumber,
|
showNumber,
|
||||||
_stepNumber,
|
_stepNumber,
|
||||||
_noPadding,
|
_noPadding,
|
||||||
|
alwaysShowTooltip = false,
|
||||||
tooltip
|
tooltip
|
||||||
}: ToolStepProps) => {
|
}: ToolStepProps) => {
|
||||||
if (!isVisible) return null;
|
if (!isVisible) return null;
|
||||||
@ -118,7 +121,7 @@ const ToolStep = ({
|
|||||||
{stepNumber}
|
{stepNumber}
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
{renderTooltipTitle(title, tooltip, isCollapsed)}
|
{renderTooltipTitle(title, tooltip, isCollapsed, alwaysShowTooltip)}
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
{isCollapsed ? (
|
{isCollapsed ? (
|
||||||
|
53
frontend/src/components/tools/shared/ToolWorkflowTitle.tsx
Normal file
53
frontend/src/components/tools/shared/ToolWorkflowTitle.tsx
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Flex, Text, Divider } from '@mantine/core';
|
||||||
|
import { Tooltip } from '../../shared/Tooltip';
|
||||||
|
|
||||||
|
export interface ToolWorkflowTitleProps {
|
||||||
|
title: string;
|
||||||
|
tooltip?: {
|
||||||
|
content?: React.ReactNode;
|
||||||
|
tips?: any[];
|
||||||
|
header?: {
|
||||||
|
title: string;
|
||||||
|
logo?: React.ReactNode;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function ToolWorkflowTitle({ title, tooltip }: ToolWorkflowTitleProps) {
|
||||||
|
if (tooltip) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Flex justify="center" w="100%">
|
||||||
|
<Tooltip
|
||||||
|
content={tooltip.content}
|
||||||
|
tips={tooltip.tips}
|
||||||
|
header={tooltip.header}
|
||||||
|
sidebarTooltip={true}
|
||||||
|
>
|
||||||
|
<Flex align="center" gap="xs" onClick={(e) => e.stopPropagation()}>
|
||||||
|
<Text fw={500} size="xl" p="md">
|
||||||
|
{title}
|
||||||
|
</Text>
|
||||||
|
<span className="material-symbols-rounded" style={{ fontSize: '1.2rem', color: 'var(--icon-files-color)' }}>
|
||||||
|
gpp_maybe
|
||||||
|
</span>
|
||||||
|
</Flex>
|
||||||
|
</Tooltip>
|
||||||
|
</Flex>
|
||||||
|
<Divider />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Flex justify="center" w="100%">
|
||||||
|
<Text fw={500} size="xl" p="md">
|
||||||
|
{title}
|
||||||
|
</Text>
|
||||||
|
</Flex>
|
||||||
|
<Divider />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
@ -3,6 +3,7 @@ import { Stack } from '@mantine/core';
|
|||||||
import { createToolSteps, ToolStepProvider } from './ToolStep';
|
import { createToolSteps, ToolStepProvider } from './ToolStep';
|
||||||
import OperationButton from './OperationButton';
|
import OperationButton from './OperationButton';
|
||||||
import { ToolOperationHook } from '../../../hooks/tools/shared/useToolOperation';
|
import { ToolOperationHook } from '../../../hooks/tools/shared/useToolOperation';
|
||||||
|
import { ToolWorkflowTitle, ToolWorkflowTitleProps } from './ToolWorkflowTitle';
|
||||||
|
|
||||||
export interface FilesStepConfig {
|
export interface FilesStepConfig {
|
||||||
selectedFiles: File[];
|
selectedFiles: File[];
|
||||||
@ -45,7 +46,10 @@ export interface ReviewStepConfig {
|
|||||||
testId?: string;
|
testId?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface TitleConfig extends ToolWorkflowTitleProps {}
|
||||||
|
|
||||||
export interface ToolFlowConfig {
|
export interface ToolFlowConfig {
|
||||||
|
title?: TitleConfig;
|
||||||
files: FilesStepConfig;
|
files: FilesStepConfig;
|
||||||
steps: MiddleStepConfig[];
|
steps: MiddleStepConfig[];
|
||||||
executeButton?: ExecuteButtonConfig;
|
executeButton?: ExecuteButtonConfig;
|
||||||
@ -63,6 +67,8 @@ export function createToolFlow(config: ToolFlowConfig) {
|
|||||||
return (
|
return (
|
||||||
<Stack gap="sm" p="sm" h="95vh" w="100%" style={{ overflow: 'auto' }}>
|
<Stack gap="sm" p="sm" h="95vh" w="100%" style={{ overflow: 'auto' }}>
|
||||||
<ToolStepProvider forceStepNumbers={config.forceStepNumbers}>
|
<ToolStepProvider forceStepNumbers={config.forceStepNumbers}>
|
||||||
|
{config.title && <ToolWorkflowTitle {...config.title} />}
|
||||||
|
|
||||||
{/* Files Step */}
|
{/* Files Step */}
|
||||||
{config.files.isVisible !== false && steps.createFilesStep({
|
{config.files.isVisible !== false && steps.createFilesStep({
|
||||||
selectedFiles: config.files.selectedFiles,
|
selectedFiles: config.files.selectedFiles,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user