From 47ccb6a6ed10ab0b39c4d72987f22ee029afd39b Mon Sep 17 00:00:00 2001 From: ConnorYoh <40631091+ConnorYoh@users.noreply.github.com> Date: Tue, 26 Aug 2025 16:59:03 +0100 Subject: [PATCH] improvement/v2/automate/tweaks (#4293) - [x] Cleanup Automation output name garbage - [x] Remove Cross button on first two tools - [x] Automation creation name title to make clearer to the user - [x] Colours for dark mode on automation tool settings are bad - [x] Fix tool names not using correct translated ones - [x] suggested Automation Password needs adding to description - [x] Allow different filetypes in automation - [x] Custom Icons for automation - [x] split Tool wasn't working with merge to single pdf --------- Co-authored-by: Connor Yoh Co-authored-by: James Brunton --- .../public/locales/en-GB/translation.json | 15 ++- .../public/locales/en-US/translation.json | 4 +- .../components/shared/FileUploadButton.tsx | 3 +- .../src/components/shared/QuickAccessBar.tsx | 9 +- .../addWatermark/WatermarkTypeSettings.tsx | 4 +- .../tools/automate/AutomationCreation.tsx | 45 +++++-- .../tools/automate/AutomationEntry.tsx | 44 +++++-- .../tools/automate/AutomationSelection.tsx | 37 ++++-- .../tools/automate/IconSelector.tsx | 116 ++++++++++++++++++ .../components/tools/automate/ToolList.tsx | 34 ++--- .../src/components/tools/automate/iconMap.ts | 92 ++++++++++++++ .../tools/compress/CompressSettings.tsx | 4 +- frontend/src/contexts/ToolWorkflowContext.tsx | 67 +++++----- .../src/data/useTranslatedToolRegistry.tsx | 41 ++++--- .../tools/automate/useAutomateOperation.ts | 2 +- .../hooks/tools/automate/useAutomationForm.ts | 8 ++ .../tools/automate/useSavedAutomations.ts | 17 +++ .../tools/automate/useSuggestedAutomations.ts | 2 +- .../hooks/tools/shared/useToolOperation.ts | 8 +- frontend/src/theme/mantineTheme.ts | 43 ++++++- frontend/src/tools/Automate.tsx | 43 ++++++- frontend/src/tools/Split.tsx | 13 +- frontend/src/types/automation.ts | 1 + frontend/src/utils/automationExecutor.ts | 54 ++++++-- frontend/src/utils/fileResponseUtils.ts | 10 +- 25 files changed, 582 insertions(+), 134 deletions(-) create mode 100644 frontend/src/components/tools/automate/IconSelector.tsx create mode 100644 frontend/src/components/tools/automate/iconMap.ts diff --git a/frontend/public/locales/en-GB/translation.json b/frontend/public/locales/en-GB/translation.json index e32579891..7fa1036db 100644 --- a/frontend/public/locales/en-GB/translation.json +++ b/frontend/public/locales/en-GB/translation.json @@ -51,7 +51,6 @@ "placeholder": "Select a PDF file in the main view to get started", "upload": "Upload", "addFiles": "Add files", - "noFiles": "No files uploaded. ", "selectFromWorkbench": "Select files from the workbench or " }, "noFavourites": "No favourites added", @@ -2320,9 +2319,14 @@ "creation": { "createTitle": "Create Automation", "editTitle": "Edit Automation", - "description": "Automations run tools sequentially. To get started, add tools in the order you want them to run.", + "intro": "Automations run tools sequentially. To get started, add tools in the order you want them to run.", "name": { - "placeholder": "Automation name" + "label": "Automation Name", + "placeholder": "My Automation" + }, + "description": { + "label": "Description (optional)", + "placeholder": "Describe what this automation does..." }, "tools": { "selectTool": "Select a tool...", @@ -2339,6 +2343,9 @@ "message": "You have unsaved changes. Are you sure you want to go back? All changes will be lost.", "cancel": "Cancel", "confirm": "Go Back" + }, + "icon": { + "label": "Icon" } }, "run": { @@ -2369,7 +2376,7 @@ "emailPreparation": "Email Preparation", "emailPreparationDesc": "Optimises PDFs for email distribution by compressing files, splitting large documents into 20MB chunks for email compatibility, and removing metadata for privacy.", "secureWorkflow": "Security Workflow", - "secureWorkflowDesc": "Secures PDF documents by removing potentially malicious content like JavaScript and embedded files, then adds password protection to prevent unauthorised access.", + "secureWorkflowDesc": "Secures PDF documents by removing potentially malicious content like JavaScript and embedded files, then adds password protection to prevent unauthorised access. Password is set to 'password' by default.", "processImages": "Process Images", "processImagesDesc": "Converts multiple image files into a single PDF document, then applies OCR technology to extract searchable text from the images." } diff --git a/frontend/public/locales/en-US/translation.json b/frontend/public/locales/en-US/translation.json index ab5b66802..b0a19539a 100644 --- a/frontend/public/locales/en-US/translation.json +++ b/frontend/public/locales/en-US/translation.json @@ -2111,10 +2111,10 @@ "suggested": { "securePdfIngestion": "Secure PDF Ingestion", "securePdfIngestionDesc": "Comprehensive PDF processing workflow that sanitizes documents, applies OCR with cleanup, converts to PDF/A format for long-term archival, and optimizes file size.", - "emailPreparation": "Email Preparation", + "emailPreparation": "Email Preparation", "emailPreparationDesc": "Optimizes PDFs for email distribution by compressing files, splitting large documents into 20MB chunks for email compatibility, and removing metadata for privacy.", "secureWorkflow": "Security Workflow", - "secureWorkflowDesc": "Secures PDF documents by removing potentially malicious content like JavaScript and embedded files, then adds password protection to prevent unauthorized access.", + "secureWorkflowDesc": "Secures PDF documents by removing potentially malicious content like JavaScript and embedded files, then adds password protection to prevent unauthorized access. Password is set to 'password' by default.", "processImages": "Process Images", "processImagesDesc": "Converts multiple image files into a single PDF document, then applies OCR technology to extract searchable text from the images." } diff --git a/frontend/src/components/shared/FileUploadButton.tsx b/frontend/src/components/shared/FileUploadButton.tsx index 27f58400f..434aad1b4 100644 --- a/frontend/src/components/shared/FileUploadButton.tsx +++ b/frontend/src/components/shared/FileUploadButton.tsx @@ -32,9 +32,10 @@ const FileUploadButton = ({ onChange={onChange} accept={accept} disabled={disabled} + > {(props) => ( - )} diff --git a/frontend/src/components/shared/QuickAccessBar.tsx b/frontend/src/components/shared/QuickAccessBar.tsx index ad91b2ac2..fc4301181 100644 --- a/frontend/src/components/shared/QuickAccessBar.tsx +++ b/frontend/src/components/shared/QuickAccessBar.tsx @@ -22,7 +22,7 @@ const QuickAccessBar = forwardRef(({ const { t } = useTranslation(); const { isRainbowMode } = useRainbowThemeContext(); const { openFilesModal, isFilesModalOpen } = useFilesModalContext(); - const { handleReaderToggle, handleBackToTools, handleToolSelect, selectedToolKey, leftPanelView, toolRegistry, readerMode } = useToolWorkflow(); + const { handleReaderToggle, handleBackToTools, handleToolSelect, selectedToolKey, leftPanelView, toolRegistry, readerMode, resetTool } = useToolWorkflow(); const [configModalOpen, setConfigModalOpen] = useState(false); const [activeButton, setActiveButton] = useState('tools'); const scrollableRef = useRef(null); @@ -74,7 +74,12 @@ const QuickAccessBar = forwardRef(({ type: 'navigation', onClick: () => { setActiveButton('automate'); - handleToolSelect('automate'); + // If already on automate tool, reset it directly + if (selectedToolKey === 'automate') { + resetTool('automate'); + } else { + handleToolSelect('automate'); + } } }, { diff --git a/frontend/src/components/tools/addWatermark/WatermarkTypeSettings.tsx b/frontend/src/components/tools/addWatermark/WatermarkTypeSettings.tsx index f97454c5c..84bbb296a 100644 --- a/frontend/src/components/tools/addWatermark/WatermarkTypeSettings.tsx +++ b/frontend/src/components/tools/addWatermark/WatermarkTypeSettings.tsx @@ -16,7 +16,7 @@ const WatermarkTypeSettings = ({ watermarkType, onWatermarkTypeChange, disabled