2025-08-19 18:00:50 +01:00
|
|
|
import { useTranslation } from "react-i18next";
|
|
|
|
import { createToolFlow } from "../components/tools/shared/createToolFlow";
|
|
|
|
import { useRepairParameters } from "../hooks/tools/repair/useRepairParameters";
|
|
|
|
import { useRepairOperation } from "../hooks/tools/repair/useRepairOperation";
|
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-19 18:00:50 +01:00
|
|
|
|
2025-08-28 10:59:38 +01:00
|
|
|
const Repair = (props: BaseToolProps) => {
|
2025-08-19 18:00:50 +01:00
|
|
|
const { t } = useTranslation();
|
|
|
|
|
2025-08-28 10:59:38 +01:00
|
|
|
const base = useBaseTool(
|
|
|
|
'repair',
|
|
|
|
useRepairParameters,
|
|
|
|
useRepairOperation,
|
|
|
|
props
|
|
|
|
);
|
2025-08-19 18:00:50 +01:00
|
|
|
|
|
|
|
return createToolFlow({
|
|
|
|
files: {
|
2025-08-28 10:59:38 +01:00
|
|
|
selectedFiles: base.selectedFiles,
|
|
|
|
isCollapsed: base.hasResults,
|
2025-08-19 18:00:50 +01:00
|
|
|
placeholder: t("repair.files.placeholder", "Select a PDF file in the main view to get started"),
|
|
|
|
},
|
|
|
|
steps: [],
|
|
|
|
executeButton: {
|
|
|
|
text: t("repair.submit", "Repair PDF"),
|
2025-08-28 10:59:38 +01:00
|
|
|
isVisible: !base.hasResults,
|
2025-08-19 18:00:50 +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-19 18:00:50 +01:00
|
|
|
},
|
|
|
|
review: {
|
2025-08-28 10:59:38 +01:00
|
|
|
isVisible: base.hasResults,
|
|
|
|
operation: base.operation,
|
2025-08-19 18:00:50 +01:00
|
|
|
title: t("repair.results.title", "Repair Results"),
|
2025-08-28 10:59:38 +01:00
|
|
|
onFileClick: base.handleThumbnailClick,
|
2025-08-19 18:00:50 +01:00
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2025-08-22 14:40:27 +01:00
|
|
|
// Static method to get the operation hook for automation
|
|
|
|
Repair.tool = () => useRepairOperation;
|
|
|
|
|
|
|
|
export default Repair as ToolComponent;
|