From 63c4d98fda3b02b996d4a0f72c0b3d6d909783c4 Mon Sep 17 00:00:00 2001 From: Connor Yoh Date: Tue, 12 Aug 2025 17:15:27 +0100 Subject: [PATCH] remove iscompleted and completedmessages --- .../src/components/tools/shared/ToolStep.tsx | 19 +------------------ .../tools/shared/createFilesToolStep.tsx | 4 +--- .../tools/shared/createToolFlow.tsx | 4 ---- .../src/hooks/tools/ocr/useOCROperation.ts | 4 ++-- .../hooks/tools/shared/useToolOperation.ts | 2 +- frontend/src/tools/Compress.tsx | 2 -- frontend/src/tools/Convert.tsx | 1 - frontend/src/tools/OCR.tsx | 2 -- frontend/src/tools/Split.tsx | 1 - frontend/src/types/tool.ts | 2 -- 10 files changed, 5 insertions(+), 36 deletions(-) diff --git a/frontend/src/components/tools/shared/ToolStep.tsx b/frontend/src/components/tools/shared/ToolStep.tsx index 806ad2e4f..053392c2a 100644 --- a/frontend/src/components/tools/shared/ToolStep.tsx +++ b/frontend/src/components/tools/shared/ToolStep.tsx @@ -17,10 +17,8 @@ export interface ToolStepProps { title: string; isVisible?: boolean; isCollapsed?: boolean; - isCompleted?: boolean; onCollapsedClick?: () => void; children?: React.ReactNode; - completedMessage?: string; helpText?: string; showNumber?: boolean; _stepNumber?: number; // Internal prop set by ToolStepContainer @@ -70,10 +68,8 @@ const ToolStep = ({ title, isVisible = true, isCollapsed = false, - isCompleted = false, onCollapsedClick, children, - completedMessage, helpText, showNumber, _stepNumber, @@ -135,20 +131,7 @@ const ToolStep = ({ )} - {isCollapsed ? ( -
- {isCompleted && completedMessage && ( - - ✓ {completedMessage} - {onCollapsedClick && ( - - (click to change) - - )} - - )} -
- ) : ( + {!isCollapsed && ( {helpText && ( diff --git a/frontend/src/components/tools/shared/createFilesToolStep.tsx b/frontend/src/components/tools/shared/createFilesToolStep.tsx index 31b977461..89c746c6f 100644 --- a/frontend/src/components/tools/shared/createFilesToolStep.tsx +++ b/frontend/src/components/tools/shared/createFilesToolStep.tsx @@ -19,9 +19,7 @@ export function createFilesToolStep( return createStep("Files", { isVisible: true, isCollapsed: props.isCollapsed, - isCompleted: hasFiles, - onCollapsedClick: props.onCollapsedClick, - completedMessage: undefined + onCollapsedClick: props.onCollapsedClick }, ( void; - completedMessage?: string; content: React.ReactNode; tooltip?: { content?: React.ReactNode; @@ -75,9 +73,7 @@ export function createToolFlow(config: ToolFlowConfig) { steps.create(stepConfig.title, { isVisible: stepConfig.isVisible, isCollapsed: stepConfig.isCollapsed, - isCompleted: stepConfig.isCompleted, onCollapsedClick: stepConfig.onCollapsedClick, - completedMessage: stepConfig.completedMessage, tooltip: stepConfig.tooltip }, stepConfig.content) )} diff --git a/frontend/src/hooks/tools/ocr/useOCROperation.ts b/frontend/src/hooks/tools/ocr/useOCROperation.ts index eeebb8747..30294d8ce 100644 --- a/frontend/src/hooks/tools/ocr/useOCROperation.ts +++ b/frontend/src/hooks/tools/ocr/useOCROperation.ts @@ -37,7 +37,7 @@ function stripExt(name: string): string { return i > 0 ? name.slice(0, i) : name; } -// Signature must be (file, params) +// Signature must be (file, params) to match useToolApiCalls interface const buildFormData = (file: File, parameters: OCRParameters): FormData => { const formData = new FormData(); formData.append('fileInput', file); @@ -99,7 +99,7 @@ export const useOCROperation = () => { const ocrConfig: ToolOperationConfig = { operationType: 'ocr', endpoint: '/api/v1/misc/ocr-pdf', - buildFormData: buildFormData as any /* FIX ME */, + buildFormData, filePrefix: 'ocr_', multiFileEndpoint: false, // Process files individually responseHandler, // use shared flow diff --git a/frontend/src/hooks/tools/shared/useToolOperation.ts b/frontend/src/hooks/tools/shared/useToolOperation.ts index 9fa883490..b10aa069d 100644 --- a/frontend/src/hooks/tools/shared/useToolOperation.ts +++ b/frontend/src/hooks/tools/shared/useToolOperation.ts @@ -170,7 +170,7 @@ export const useToolOperation = ( // Individual file processing - separate API call per file const apiCallsConfig: ApiCallsConfig = { endpoint: config.endpoint, - buildFormData: (file: File, params: TParams) => (config.buildFormData as (params: TParams, file: File) => FormData /* FIX ME */)(params, file), + buildFormData: config.buildFormData as (file: File, params: TParams) => FormData, filePrefix: config.filePrefix, responseHandler: config.responseHandler }; diff --git a/frontend/src/tools/Compress.tsx b/frontend/src/tools/Compress.tsx index 5c323e3c5..19253b1eb 100644 --- a/frontend/src/tools/Compress.tsx +++ b/frontend/src/tools/Compress.tsx @@ -74,9 +74,7 @@ const Compress = ({ onPreviewFile, onComplete, onError }: BaseToolProps) => { steps: [{ title: "Settings", isCollapsed: settingsCollapsed, - isCompleted: hasResults, onCollapsedClick: settingsCollapsed ? handleSettingsReset : undefined, - completedMessage: t("compress.header", "Compression completed"), tooltip: compressTips, content: ( { steps: [{ title: t("convert.settings", "Settings"), isCollapsed: settingsCollapsed, - isCompleted: settingsCollapsed, onCollapsedClick: settingsCollapsed ? handleSettingsReset : undefined, content: ( { { title: "Settings", isCollapsed: !hasFiles || settingsCollapsed, - isCompleted: hasFiles && hasValidSettings, onCollapsedClick: hasResults ? handleSettingsReset : () => { if (!hasFiles) return; // Only allow if files are selected setExpandedStep(expandedStep === 'settings' ? null : 'settings'); @@ -111,7 +110,6 @@ const OCR = ({ onPreviewFile, onComplete, onError }: BaseToolProps) => { { title: "Advanced", isCollapsed: expandedStep !== 'advanced', - isCompleted: hasFiles && hasResults, onCollapsedClick: hasResults ? handleSettingsReset : () => { if (!hasFiles) return; // Only allow if files are selected setExpandedStep(expandedStep === 'advanced' ? null : 'advanced'); diff --git a/frontend/src/tools/Split.tsx b/frontend/src/tools/Split.tsx index 851b65cc3..e441ce83d 100644 --- a/frontend/src/tools/Split.tsx +++ b/frontend/src/tools/Split.tsx @@ -74,7 +74,6 @@ const Split = ({ onPreviewFile, onComplete, onError }: BaseToolProps) => { steps: [{ title: "Settings", isCollapsed: settingsCollapsed, - isCompleted: hasResults, onCollapsedClick: hasResults ? handleSettingsReset : undefined, content: ( void; }