Fix/v2/automate_settings_gap_fill (#4574)

All implemented tools now support automation bar Sign. Sign will need
custom automation UI support

---------

Co-authored-by: Connor Yoh <[email protected]>
Co-authored-by: Reece Browne <[email protected]>
This commit is contained in:
ConnorYoh
2025-10-01 23:13:54 +01:00
committed by GitHub
co-authored by Connor Yoh Reece Browne
parent ec05c5c049
commit 510e1c38eb
28 changed files with 1300 additions and 678 deletions
@@ -3,6 +3,8 @@ import { useTranslation } from 'react-i18next';
import { AutomationTool, AutomationConfig, AutomationMode } from '../../../types/automation';
import { AUTOMATION_CONSTANTS } from '../../../constants/automation';
import { ToolRegistry } from '../../../data/toolsTaxonomy';
import { ToolId } from 'src/types/toolId';
interface UseAutomationFormProps {
mode: AutomationMode;
@@ -41,11 +43,15 @@ export function useAutomationForm({ mode, existingAutomation, toolRegistry }: Us
const operations = existingAutomation.operations || [];
const tools = operations.map((op, index) => {
const operation = typeof op === 'string' ? op : op.operation;
const toolEntry = toolRegistry[operation as ToolId];
// If tool has no settingsComponent, it's automatically configured
const isConfigured = mode === AutomationMode.EDIT ? true : !toolEntry?.automationSettings;
return {
id: `${operation}-${Date.now()}-${index}`,
operation: operation,
name: getToolName(operation),
configured: mode === AutomationMode.EDIT ? true : false,
configured: isConfigured,
parameters: typeof op === 'object' ? op.parameters || {} : {}
};
});
@@ -65,11 +71,15 @@ export function useAutomationForm({ mode, existingAutomation, toolRegistry }: Us
}, [mode, existingAutomation, t, getToolName]);
const addTool = (operation: string) => {
const toolEntry = toolRegistry[operation as ToolId];
// If tool has no settingsComponent, it's automatically configured
const isConfigured = !toolEntry?.automationSettings;
const newTool: AutomationTool = {
id: `${operation}-${Date.now()}`,
operation,
name: getToolName(operation),
configured: false,
configured: isConfigured,
parameters: getToolDefaultParameters(operation)
};
@@ -3,6 +3,7 @@ import { useTranslation } from 'react-i18next';
import React from 'react';
import LocalIcon from '../../../components/shared/LocalIcon';
import { SuggestedAutomation } from '../../../types/automation';
import { SPLIT_METHODS } from '../../../constants/splitConstants';
// Create icon components
const CompressIcon = () => React.createElement(LocalIcon, { icon: 'compress', width: '1.5rem', height: '1.5rem' });
@@ -83,18 +84,18 @@ export function useSuggestedAutomations(): SuggestedAutomation[] {
}
},
{
operation: "splitPdf",
operation: "split",
parameters: {
mode: 'bySizeOrCount',
method: SPLIT_METHODS.BY_SIZE,
pages: '',
hDiv: '1',
vDiv: '1',
merge: false,
splitType: 'size',
splitValue: '20MB',
bookmarkLevel: '1',
includeMetadata: false,
allowDuplicates: false,
duplexMode: false,
}
},
{
+1 -1
View File
@@ -22,7 +22,7 @@ export function useToolNavigation(): {
const getToolNavigation = useCallback((toolId: string, tool: ToolRegistryEntry): ToolNavigationProps => {
// Generate SSR-safe relative path
const path = getToolUrlPath(toolId, tool);
const path = getToolUrlPath(toolId);
const href = path; // Relative path, no window.location needed
// Click handler that maintains SPA behavior