From 67fc78b6df822e7f65f43a4e87141c0b0381f9db Mon Sep 17 00:00:00 2001 From: EthanHealy01 Date: Thu, 30 Apr 2026 21:29:11 +0100 Subject: [PATCH] Fix lint, formatting, and TOML parse errors post-merge - Remove unused meta variable and getFileTypeMeta import from NonPdfViewer - Fix TOML: move compare.edited.selectBaseFirst and compare.swap.label from dotted-key form in [compare] to their proper subsections - Run Prettier on 7 files flagged by format check --- .../public/locales/en-GB/translation.toml | 4 +- .../src/core/components/layout/Workbench.tsx | 2 +- .../core/components/pageEditor/PageEditor.tsx | 28 +++++----- .../core/components/shared/FileSidebar.tsx | 15 ++++- .../components/shared/FileSidebarFileItem.tsx | 27 ++++++++- .../core/components/shared/WorkbenchBar.tsx | 55 +++++++++++-------- .../core/components/viewer/NonPdfViewer.tsx | 5 -- .../src/core/contexts/FilesModalContext.tsx | 3 +- .../src/core/contexts/ToolWorkflowContext.tsx | 11 +++- 9 files changed, 94 insertions(+), 56 deletions(-) diff --git a/frontend/public/locales/en-GB/translation.toml b/frontend/public/locales/en-GB/translation.toml index 0562e30084..5c26d1f45e 100644 --- a/frontend/public/locales/en-GB/translation.toml +++ b/frontend/public/locales/en-GB/translation.toml @@ -2702,13 +2702,11 @@ addFilesHint = "Add PDFs in the Files step to enable selection." clearSelected = "Clear selected" clearSlot = "Remove file" cta = "Compare" -edited.selectBaseFirst = "Select original PDF first" header = "Compare PDFs" loading = "Comparing..." newLine = "new-line" noFiles = "No PDFs available yet" pages = "Pages" -swap.label = "Swap" tags = "differentiate,contrast,changes,analysis" title = "Compare" @@ -2754,6 +2752,7 @@ title = "These PDFs look highly different" [compare.edited] label = "Edited PDF" +selectBaseFirst = "Select original PDF first" placeholder = "Select the edited PDF" [compare.error] @@ -2835,6 +2834,7 @@ pageLabel = "Page" [compare.swap] confirm = "Swap and Re-run" +label = "Swap" confirmBody = "This will rerun the tool. Are you sure you want to swap the order of Original and Edited?" confirmTitle = "Re-run comparison?" diff --git a/frontend/src/core/components/layout/Workbench.tsx b/frontend/src/core/components/layout/Workbench.tsx index 69d6f9f410..3064c5e2f8 100644 --- a/frontend/src/core/components/layout/Workbench.tsx +++ b/frontend/src/core/components/layout/Workbench.tsx @@ -91,7 +91,7 @@ export default function Workbench() { } } - if (activeFiles.length === 0) { + if (activeFiles.length === 0) { return ; } diff --git a/frontend/src/core/components/pageEditor/PageEditor.tsx b/frontend/src/core/components/pageEditor/PageEditor.tsx index 8f31ca62e9..bee97acc4e 100644 --- a/frontend/src/core/components/pageEditor/PageEditor.tsx +++ b/frontend/src/core/components/pageEditor/PageEditor.tsx @@ -684,21 +684,19 @@ const PageEditor = ({ onFunctionsReady }: PageEditorProps) => { > - {!initialDocument && - !globalProcessing && - !hasPdfFiles && ( -
- - - 📄 - - No PDF files loaded - - Add files to start editing pages - - -
- )} + {!initialDocument && !globalProcessing && !hasPdfFiles && ( +
+ + + 📄 + + No PDF files loaded + + Add files to start editing pages + + +
+ )} {!initialDocument && (globalProcessing || hasPdfFiles) && ( diff --git a/frontend/src/core/components/shared/FileSidebar.tsx b/frontend/src/core/components/shared/FileSidebar.tsx index 821aba8cb5..0c40579b46 100644 --- a/frontend/src/core/components/shared/FileSidebar.tsx +++ b/frontend/src/core/components/shared/FileSidebar.tsx @@ -67,7 +67,8 @@ const FileSidebar = forwardRef( const { actions: fileActions } = useFileActions(); const { actions: navActions } = useNavigationActions(); const { workbench: currentWorkbench, selectedTool } = useNavigationState(); - const isMultiTool = currentWorkbench === "pageEditor" && selectedTool === "multiTool"; + const isMultiTool = + currentWorkbench === "pageEditor" && selectedTool === "multiTool"; const { requestNavigation } = useNavigationGuard(); const { activeFileId, setActiveFileId } = useViewer(); const { addFiles } = useFileHandler(); @@ -163,7 +164,13 @@ const FileSidebar = forwardRef( navActions.setWorkbench(files.length === 1 ? "viewer" : "fileEditor"); } } - }, [isGoogleDriveEnabled, openGoogleDrivePicker, addFiles, navActions, isMultiTool]); + }, [ + isGoogleDriveEnabled, + openGoogleDrivePicker, + addFiles, + navActions, + isMultiTool, + ]); // Toggle file in/out of workbench const handleFileClick = useCallback( @@ -287,7 +294,9 @@ const FileSidebar = forwardRef( if (files.length > 0) { await addFiles(files); if (!isMultiTool) { - navActions.setWorkbench(files.length === 1 ? "viewer" : "fileEditor"); + navActions.setWorkbench( + files.length === 1 ? "viewer" : "fileEditor", + ); } } e.target.value = ""; diff --git a/frontend/src/core/components/shared/FileSidebarFileItem.tsx b/frontend/src/core/components/shared/FileSidebarFileItem.tsx index 53f49e0cee..dc4c5ac5d2 100644 --- a/frontend/src/core/components/shared/FileSidebarFileItem.tsx +++ b/frontend/src/core/components/shared/FileSidebarFileItem.tsx @@ -153,9 +153,30 @@ function FilePdfIcon({ d="M9.5 0L15 5.5H11C10.172 5.5 9.5 4.828 9.5 4V0Z" fill="rgba(0,0,0,0.2)" /> - - - + + + ); } diff --git a/frontend/src/core/components/shared/WorkbenchBar.tsx b/frontend/src/core/components/shared/WorkbenchBar.tsx index ffab8da550..0d7b83154c 100644 --- a/frontend/src/core/components/shared/WorkbenchBar.tsx +++ b/frontend/src/core/components/shared/WorkbenchBar.tsx @@ -67,8 +67,12 @@ export default function WorkbenchBar({ }: WorkbenchBarProps) { const { t } = useTranslation(); const { buttons, actions, allButtonsDisabled } = useRightRail(); - const { pageEditorFunctions, toolPanelMode, leftPanelView, customWorkbenchViews } = - useToolWorkflow(); + const { + pageEditorFunctions, + toolPanelMode, + leftPanelView, + customWorkbenchViews, + } = useToolWorkflow(); const { selectedTool } = useNavigationState(); const isCustomView = !isBaseWorkbench(currentView); const disableForFullscreen = @@ -453,30 +457,33 @@ export default function WorkbenchBar({ )} {/* Separator: export group | close */} - {!isCustomView &&
} + {!isCustomView && ( +
+ )} {/* Close (context-aware: close all / close viewer file / close page editor) */} - {!isCustomView && renderWithTooltip( - - - , - currentView === "fileEditor" - ? t("rightRail.closeAll", "Close All") - : t("rightRail.closePdf", "Close PDF"), - )} + {!isCustomView && + renderWithTooltip( + + + , + currentView === "fileEditor" + ? t("rightRail.closeAll", "Close All") + : t("rightRail.closePdf", "Close PDF"), + )}
); diff --git a/frontend/src/core/components/viewer/NonPdfViewer.tsx b/frontend/src/core/components/viewer/NonPdfViewer.tsx index 2f187975dd..1b54fa1680 100644 --- a/frontend/src/core/components/viewer/NonPdfViewer.tsx +++ b/frontend/src/core/components/viewer/NonPdfViewer.tsx @@ -13,7 +13,6 @@ import { import { CONVERSION_MATRIX } from "@app/constants/convertConstants"; import { NonPdfBanner } from "@app/components/viewer/nonpdf/NonPdfBanner"; -import { getFileTypeMeta } from "@app/components/viewer/nonpdf/types"; import { ImageViewer } from "@app/components/viewer/nonpdf/ImageViewer"; import { CsvViewer } from "@app/components/viewer/nonpdf/CsvViewer"; import { JsonViewer } from "@app/components/viewer/nonpdf/JsonViewer"; @@ -33,10 +32,6 @@ export interface NonPdfViewerProps extends ViewerProps { export function NonPdfViewer({ file }: NonPdfViewerProps) { const fileType = useMemo(() => detectNonPdfFileType(file), [file]); - const meta = useMemo( - () => getFileTypeMeta(fileType, file.name), - [fileType, file.name], - ); const { handleToolSelect, toolAvailability } = useToolWorkflow(); diff --git a/frontend/src/core/contexts/FilesModalContext.tsx b/frontend/src/core/contexts/FilesModalContext.tsx index fc8ed8284a..9d9bf0bd52 100644 --- a/frontend/src/core/contexts/FilesModalContext.tsx +++ b/frontend/src/core/contexts/FilesModalContext.tsx @@ -50,7 +50,8 @@ export const FilesModalProvider: React.FC<{ children: React.ReactNode }> = ({ const fileCtx = useFileContext(); const { actions: navActions } = useNavigationActions(); const { workbench: currentWorkbench, selectedTool } = useNavigationState(); - const isMultiTool = currentWorkbench === "pageEditor" && selectedTool === "multiTool"; + const isMultiTool = + currentWorkbench === "pageEditor" && selectedTool === "multiTool"; const [isFilesModalOpen, setIsFilesModalOpen] = useState(false); const [onModalClose, setOnModalClose] = useState<(() => void) | undefined>(); const [insertAfterPage, setInsertAfterPage] = useState(); diff --git a/frontend/src/core/contexts/ToolWorkflowContext.tsx b/frontend/src/core/contexts/ToolWorkflowContext.tsx index 6502e48da4..60f4124aaf 100644 --- a/frontend/src/core/contexts/ToolWorkflowContext.tsx +++ b/frontend/src/core/contexts/ToolWorkflowContext.tsx @@ -366,10 +366,17 @@ export function ToolWorkflowProvider({ children }: ToolWorkflowProviderProps) { if (navigationState.workbench === "pageEditor" && prev !== "pageEditor") { setLeftPanelView("hidden"); - } else if (navigationState.workbench !== "pageEditor" && prev === "pageEditor") { + } else if ( + navigationState.workbench !== "pageEditor" && + prev === "pageEditor" + ) { setLeftPanelView("toolPicker"); } - }, [navigationState.workbench, navigationState.selectedTool, setLeftPanelView]); + }, [ + navigationState.workbench, + navigationState.selectedTool, + setLeftPanelView, + ]); // Tool reset methods const registerToolReset = useCallback(