From 9758e871d4da5fdffb8fd2df78b36bb2f73e1195 Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Fri, 26 Sep 2025 12:45:15 +0100 Subject: [PATCH] feat: Add React-based extract-images tool (#4501) --- .../public/locales/en-GB/translation.json | 8 ++- .../public/locales/en-US/translation.json | 8 ++- .../extractImages/ExtractImagesSettings.tsx | 46 ++++++++++++++++ .../src/data/useTranslatedToolRegistry.tsx | 11 +++- .../useExtractImagesOperation.ts | 51 +++++++++++++++++ .../useExtractImagesParameters.ts | 19 +++++++ frontend/src/tools/ExtractImages.tsx | 55 +++++++++++++++++++ 7 files changed, 194 insertions(+), 4 deletions(-) create mode 100644 frontend/src/components/tools/extractImages/ExtractImagesSettings.tsx create mode 100644 frontend/src/hooks/tools/extractImages/useExtractImagesOperation.ts create mode 100644 frontend/src/hooks/tools/extractImages/useExtractImagesParameters.ts create mode 100644 frontend/src/tools/ExtractImages.tsx diff --git a/frontend/public/locales/en-GB/translation.json b/frontend/public/locales/en-GB/translation.json index c737b85a5..9a976c3af 100644 --- a/frontend/public/locales/en-GB/translation.json +++ b/frontend/public/locales/en-GB/translation.json @@ -1595,7 +1595,13 @@ "header": "Extract Images", "selectText": "Select image format to convert extracted images to", "allowDuplicates": "Save duplicate images", - "submit": "Extract" + "submit": "Extract", + "settings": { + "title": "Settings" + }, + "error": { + "failed": "An error occurred while extracting images from the PDF." + } }, "pdfToPDFA": { "tags": "archive,long-term,standard,conversion,storage,preservation", diff --git a/frontend/public/locales/en-US/translation.json b/frontend/public/locales/en-US/translation.json index ae23ddd73..f12e54fbf 100644 --- a/frontend/public/locales/en-US/translation.json +++ b/frontend/public/locales/en-US/translation.json @@ -1056,7 +1056,13 @@ "header": "Extract Images", "selectText": "Select image format to convert extracted images to", "allowDuplicates": "Save duplicate images", - "submit": "Extract" + "submit": "Extract", + "settings": { + "title": "Settings" + }, + "error": { + "failed": "An error occurred while extracting images from the PDF." + } }, "pdfToPDFA": { "tags": "archive,long-term,standard,conversion,storage,preservation", diff --git a/frontend/src/components/tools/extractImages/ExtractImagesSettings.tsx b/frontend/src/components/tools/extractImages/ExtractImagesSettings.tsx new file mode 100644 index 000000000..2dde8b53a --- /dev/null +++ b/frontend/src/components/tools/extractImages/ExtractImagesSettings.tsx @@ -0,0 +1,46 @@ +import { useTranslation } from 'react-i18next'; +import { Stack, Select, Checkbox } from '@mantine/core'; +import { ExtractImagesParameters } from '../../../hooks/tools/extractImages/useExtractImagesParameters'; + +interface ExtractImagesSettingsProps { + parameters: ExtractImagesParameters; + onParameterChange: (key: K, value: ExtractImagesParameters[K]) => void; + disabled?: boolean; +} + +const ExtractImagesSettings = ({ + parameters, + onParameterChange, + disabled = false +}: ExtractImagesSettingsProps) => { + const { t } = useTranslation(); + + return ( + +