2025-08-20 11:38:41 +01:00
|
|
|
import { useTranslation } from "react-i18next";
|
|
|
|
import { createToolFlow } from "../components/tools/shared/createToolFlow";
|
|
|
|
import { useSingleLargePageParameters } from "../hooks/tools/singleLargePage/useSingleLargePageParameters";
|
|
|
|
import { useSingleLargePageOperation } from "../hooks/tools/singleLargePage/useSingleLargePageOperation";
|
2025-09-03 14:35:50 +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:38:41 +01:00
|
|
|
|
2025-09-03 14:35:50 +01:00
|
|
|
const SingleLargePage = (props: BaseToolProps) => {
|
2025-08-20 11:38:41 +01:00
|
|
|
const { t } = useTranslation();
|
|
|
|
|
2025-09-03 14:35:50 +01:00
|
|
|
const base = useBaseTool(
|
|
|
|
'singleLargePage',
|
|
|
|
useSingleLargePageParameters,
|
|
|
|
useSingleLargePageOperation,
|
|
|
|
props
|
|
|
|
);
|
2025-08-20 11:38:41 +01:00
|
|
|
|
|
|
|
return createToolFlow({
|
|
|
|
files: {
|
2025-09-03 14:35:50 +01:00
|
|
|
selectedFiles: base.selectedFiles,
|
|
|
|
isCollapsed: base.hasResults,
|
2025-08-20 11:38:41 +01:00
|
|
|
placeholder: t("pdfToSinglePage.files.placeholder", "Select a PDF file in the main view to get started"),
|
|
|
|
},
|
|
|
|
steps: [],
|
|
|
|
executeButton: {
|
|
|
|
text: t("pdfToSinglePage.submit", "Convert To Single Page"),
|
2025-09-03 14:35:50 +01:00
|
|
|
isVisible: !base.hasResults,
|
2025-08-20 11:38:41 +01:00
|
|
|
loadingText: t("loading"),
|
2025-09-03 14:35:50 +01:00
|
|
|
onClick: base.handleExecute,
|
|
|
|
disabled: !base.params.validateParameters() || !base.hasFiles || !base.endpointEnabled,
|
2025-08-20 11:38:41 +01:00
|
|
|
},
|
|
|
|
review: {
|
2025-09-03 14:35:50 +01:00
|
|
|
isVisible: base.hasResults,
|
|
|
|
operation: base.operation,
|
2025-08-20 11:38:41 +01:00
|
|
|
title: t("pdfToSinglePage.results.title", "Single Page Results"),
|
2025-09-03 14:35:50 +01:00
|
|
|
onFileClick: base.handleThumbnailClick,
|
|
|
|
onUndo: base.handleUndo,
|
2025-08-20 11:38:41 +01:00
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2025-08-22 14:40:27 +01:00
|
|
|
// Static method to get the operation hook for automation
|
|
|
|
SingleLargePage.tool = () => useSingleLargePageOperation;
|
|
|
|
|
2025-09-03 14:35:50 +01:00
|
|
|
export default SingleLargePage as ToolComponent;
|