diff --git a/frontend/public/locales/en-GB/translation.json b/frontend/public/locales/en-GB/translation.json index 7d0949618..314169a8d 100644 --- a/frontend/public/locales/en-GB/translation.json +++ b/frontend/public/locales/en-GB/translation.json @@ -1906,6 +1906,11 @@ "title": "Compress", "desc": "Compress PDFs to reduce their file size.", "header": "Compress PDF", + "method": { + "title": "Compression Method", + "quality": "Quality", + "filesize": "File Size" + }, "credit": "This service uses qpdf for PDF Compress/Optimisation.", "grayscale": { "label": "Apply Grayscale for Compression" diff --git a/frontend/src/components/shared/ButtonSelector.tsx b/frontend/src/components/shared/ButtonSelector.tsx new file mode 100644 index 000000000..9837ea433 --- /dev/null +++ b/frontend/src/components/shared/ButtonSelector.tsx @@ -0,0 +1,49 @@ +import { Button } from "@mantine/core"; + +export interface ButtonOption { + value: T; + label: string; + disabled?: boolean; +} + +interface ButtonSelectorProps { + value: T | undefined; + onChange: (value: T) => void; + options: ButtonOption[]; + disabled?: boolean; + fullWidth?: boolean; +} + +const ButtonSelector = ({ + value, + onChange, + options, + disabled = false, + fullWidth = true, +}: ButtonSelectorProps) => { + return ( +
+ {options.map((option) => ( + + ))} +
+ ); +}; + +export default ButtonSelector; diff --git a/frontend/src/components/tools/addWatermark/WatermarkTypeSettings.tsx b/frontend/src/components/tools/addWatermark/WatermarkTypeSettings.tsx index 04949c27c..d55037a17 100644 --- a/frontend/src/components/tools/addWatermark/WatermarkTypeSettings.tsx +++ b/frontend/src/components/tools/addWatermark/WatermarkTypeSettings.tsx @@ -1,5 +1,6 @@ -import { Button, Stack } from "@mantine/core"; +import { Stack } from "@mantine/core"; import { useTranslation } from "react-i18next"; +import ButtonSelector from "../../shared/ButtonSelector"; interface WatermarkTypeSettingsProps { watermarkType?: 'text' | 'image'; @@ -10,32 +11,25 @@ interface WatermarkTypeSettingsProps { const WatermarkTypeSettings = ({ watermarkType, onWatermarkTypeChange, disabled = false }: WatermarkTypeSettingsProps) => { const { t } = useTranslation(); + const options = [ + { + value: 'text' as const, + label: t('watermark.watermarkType.text', 'Text') + }, + { + value: 'image' as const, + label: t('watermark.watermarkType.image', 'Image') + } + ]; + return ( -
- - -
+
); }; diff --git a/frontend/src/components/tools/compress/CompressSettings.tsx b/frontend/src/components/tools/compress/CompressSettings.tsx index 42d270abb..11706a6c0 100644 --- a/frontend/src/components/tools/compress/CompressSettings.tsx +++ b/frontend/src/components/tools/compress/CompressSettings.tsx @@ -1,7 +1,8 @@ import React, { useState } from "react"; -import { Button, Stack, Text, NumberInput, Select, Divider } from "@mantine/core"; +import { Stack, Text, NumberInput, Select, Divider } from "@mantine/core"; import { useTranslation } from "react-i18next"; import { CompressParameters } from "../../../hooks/tools/compress/useCompressParameters"; +import ButtonSelector from "../../shared/ButtonSelector"; interface CompressSettingsProps { parameters: CompressParameters; @@ -19,31 +20,16 @@ const CompressSettings = ({ parameters, onParameterChange, disabled = false }: C {/* Compression Method */} - Compression Method -
- - -
+ {t('compress.method.title', 'Compression Method')} + onParameterChange('compressionMethod', value)} + options={[ + { value: 'quality', label: t('compress.method.quality', 'Quality') }, + { value: 'filesize', label: t('compress.method.filesize', 'File Size') }, + ]} + disabled={disabled} + />
{/* Quality Adjustment */} diff --git a/frontend/src/components/tools/redact/RedactModeSelector.tsx b/frontend/src/components/tools/redact/RedactModeSelector.tsx index 03e872ad5..2ca1b39c2 100644 --- a/frontend/src/components/tools/redact/RedactModeSelector.tsx +++ b/frontend/src/components/tools/redact/RedactModeSelector.tsx @@ -1,6 +1,7 @@ import { useTranslation } from 'react-i18next'; -import { Button, Stack, Text } from '@mantine/core'; +import { Stack, Text } from '@mantine/core'; import { RedactMode } from '../../../hooks/tools/redact/useRedactParameters'; +import ButtonSelector from '../../shared/ButtonSelector'; interface RedactModeSelectorProps { mode: RedactMode; @@ -11,36 +12,30 @@ interface RedactModeSelectorProps { export default function RedactModeSelector({ mode, onModeChange, disabled }: RedactModeSelectorProps) { const { t } = useTranslation(); + const options = [ + { + value: 'automatic' as const, + label: t('redact.modeSelector.automatic', 'Automatic') + }, + { + value: 'manual' as const, + label: t('redact.modeSelector.manual', 'Manual'), + disabled: true // Keep manual mode disabled until implemented + } + ]; + return ( {t('redact.modeSelector.mode', 'Mode')} -
- - -
+
); }