diff --git a/frontend/src/components/tools/convert/ConvertFromImageSettings.tsx b/frontend/src/components/tools/convert/ConvertFromImageSettings.tsx new file mode 100644 index 000000000..a272d90b3 --- /dev/null +++ b/frontend/src/components/tools/convert/ConvertFromImageSettings.tsx @@ -0,0 +1,41 @@ +import React from "react"; +import { Stack, Text, Select } from "@mantine/core"; +import { useTranslation } from "react-i18next"; +import { COLOR_TYPES } from "../../../constants/convertConstants"; +import { ConvertParameters } from "../../../hooks/tools/convert/useConvertParameters"; + +interface ConvertFromImageSettingsProps { + parameters: ConvertParameters; + onParameterChange: (key: keyof ConvertParameters, value: any) => void; + disabled?: boolean; +} + +const ConvertFromImageSettings = ({ + parameters, + onParameterChange, + disabled = false +}: ConvertFromImageSettingsProps) => { + const { t } = useTranslation(); + + return ( + + {t("convert.pdfOptions", "PDF Options")}: + val && onParameterChange('imageOptions', { - ...parameters.imageOptions, - colorType: val as typeof COLOR_TYPES[keyof typeof COLOR_TYPES] - })} - data={[ - { value: COLOR_TYPES.COLOR, label: t("convert.color", "Color") }, - { value: COLOR_TYPES.GREYSCALE, label: t("convert.greyscale", "Greyscale") }, - { value: COLOR_TYPES.BLACK_WHITE, label: t("convert.blackwhite", "Black & White") }, - ]} - disabled={disabled} - /> - typeof val === 'number' && onParameterChange('imageOptions', { - ...parameters.imageOptions, - dpi: val - })} - min={72} - max={600} - step={1} - disabled={disabled} - /> - - val && onParameterChange('imageOptions', { - ...parameters.imageOptions, - colorType: val as typeof COLOR_TYPES[keyof typeof COLOR_TYPES] - })} - data={[ - { value: COLOR_TYPES.COLOR, label: t("convert.color", "Color") }, - { value: COLOR_TYPES.GREYSCALE, label: t("convert.greyscale", "Greyscale") }, - { value: COLOR_TYPES.BLACK_WHITE, label: t("convert.blackwhite", "Black & White") }, - ]} - disabled={disabled} - /> - + )} diff --git a/frontend/src/components/tools/convert/ConvertToImageSettings.tsx b/frontend/src/components/tools/convert/ConvertToImageSettings.tsx new file mode 100644 index 000000000..69a727d12 --- /dev/null +++ b/frontend/src/components/tools/convert/ConvertToImageSettings.tsx @@ -0,0 +1,68 @@ +import React from "react"; +import { Stack, Text, Select, NumberInput, Group } from "@mantine/core"; +import { useTranslation } from "react-i18next"; +import { COLOR_TYPES, OUTPUT_OPTIONS } from "../../../constants/convertConstants"; +import { ConvertParameters } from "../../../hooks/tools/convert/useConvertParameters"; + +interface ConvertToImageSettingsProps { + parameters: ConvertParameters; + onParameterChange: (key: keyof ConvertParameters, value: any) => void; + disabled?: boolean; +} + +const ConvertToImageSettings = ({ + parameters, + onParameterChange, + disabled = false +}: ConvertToImageSettingsProps) => { + const { t } = useTranslation(); + + return ( + + {t("convert.imageOptions", "Image Options")}: + + val && onParameterChange('imageOptions', { + ...parameters.imageOptions, + singleOrMultiple: val as typeof OUTPUT_OPTIONS[keyof typeof OUTPUT_OPTIONS] + })} + data={[ + { value: OUTPUT_OPTIONS.SINGLE, label: t("convert.single", "Single") }, + { value: OUTPUT_OPTIONS.MULTIPLE, label: t("convert.multiple", "Multiple") }, + ]} + disabled={disabled} + /> + + ); +}; + +export default ConvertToImageSettings; \ No newline at end of file