Files
Stirling-PDF/frontend/src/tools/UnlockPdfForms.tsx
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

45 lines
1.5 KiB
TypeScript
Raw Normal View History

2025-08-20 11:34:28 +01:00
import { useTranslation } from "react-i18next";
import { createToolFlow } from "../components/tools/shared/createToolFlow";
import { useUnlockPdfFormsParameters } from "../hooks/tools/unlockPdfForms/useUnlockPdfFormsParameters";
import { useUnlockPdfFormsOperation } from "../hooks/tools/unlockPdfForms/useUnlockPdfFormsOperation";
2025-08-28 10:59:38 +01:00
import { useBaseTool } from "../hooks/tools/shared/useBaseTool";
2025-08-22 14:40:27 +01:00
import { BaseToolProps, ToolComponent } from "../types/tool";
2025-08-20 11:34:28 +01:00
2025-08-28 10:59:38 +01:00
const UnlockPdfForms = (props: BaseToolProps) => {
2025-08-20 11:34:28 +01:00
const { t } = useTranslation();
2025-08-28 10:59:38 +01:00
const base = useBaseTool(
'unlockPdfForms',
useUnlockPdfFormsParameters,
useUnlockPdfFormsOperation,
props
);
2025-08-20 11:34:28 +01:00
return createToolFlow({
files: {
2025-08-28 10:59:38 +01:00
selectedFiles: base.selectedFiles,
isCollapsed: base.hasFiles || base.hasResults,
2025-08-20 11:34:28 +01:00
},
steps: [],
executeButton: {
text: t("unlockPDFForms.submit", "Unlock Forms"),
2025-08-28 10:59:38 +01:00
isVisible: !base.hasResults,
2025-08-20 11:34:28 +01:00
loadingText: t("loading"),
2025-08-28 10:59:38 +01:00
onClick: base.handleExecute,
disabled: !base.params.validateParameters() || !base.hasFiles || !base.endpointEnabled,
2025-08-20 11:34:28 +01:00
},
review: {
2025-08-28 10:59:38 +01:00
isVisible: base.hasResults,
operation: base.operation,
2025-08-20 11:34:28 +01:00
title: t("unlockPDFForms.results.title", "Unlocked Forms Results"),
2025-08-28 10:59:38 +01:00
onFileClick: base.handleThumbnailClick,
onUndo: base.handleUndo,
2025-08-20 11:34:28 +01:00
},
});
};
2025-08-22 14:40:27 +01:00
// Static method to get the operation hook for automation
UnlockPdfForms.tool = () => useUnlockPdfFormsOperation;
2025-08-28 10:59:38 +01:00
export default UnlockPdfForms as ToolComponent;