From 2291b14d79e80a9b747f84e4351f2e662be9ad29 Mon Sep 17 00:00:00 2001 From: Connor Yoh Date: Wed, 23 Jul 2025 12:01:40 +0100 Subject: [PATCH] Convert to drop down --- .../tools/convert/ConvertSettings.tsx | 65 +++++--- .../tools/convert/GroupedFormatDropdown.tsx | 143 ++++++++++++++++++ 2 files changed, 188 insertions(+), 20 deletions(-) create mode 100644 frontend/src/components/tools/convert/GroupedFormatDropdown.tsx diff --git a/frontend/src/components/tools/convert/ConvertSettings.tsx b/frontend/src/components/tools/convert/ConvertSettings.tsx index 568eeb744..36cc9b76d 100644 --- a/frontend/src/components/tools/convert/ConvertSettings.tsx +++ b/frontend/src/components/tools/convert/ConvertSettings.tsx @@ -1,6 +1,8 @@ import React from "react"; -import { Stack, Text, Select, NumberInput, Group, Divider } from "@mantine/core"; +import { Stack, Text, Select, NumberInput, Group, Divider, UnstyledButton, useMantineTheme, useMantineColorScheme } from "@mantine/core"; +import KeyboardArrowDownIcon from "@mui/icons-material/KeyboardArrowDown"; import { useTranslation } from "react-i18next"; +import GroupedFormatDropdown from "./GroupedFormatDropdown"; import { ConvertParameters } from "../../../hooks/tools/convert/useConvertParameters"; import { FROM_FORMAT_OPTIONS, @@ -23,6 +25,8 @@ const ConvertSettings = ({ disabled = false }: ConvertSettingsProps) => { const { t } = useTranslation(); + const theme = useMantineTheme(); + const { colorScheme } = useMantineColorScheme(); const handleFromExtensionChange = (value: string | null) => { if (value) { @@ -38,18 +42,17 @@ const ConvertSettings = ({ } }; - const handleToExtensionChange = (value: string | null) => { - if (value) { - onParameterChange('toExtension', value); - // Reset format-specific options when target extension changes - onParameterChange('imageOptions', { - colorType: COLOR_TYPES.COLOR, - dpi: 300, - singleOrMultiple: OUTPUT_OPTIONS.MULTIPLE, - }); - } + const handleToExtensionChange = (value: string) => { + onParameterChange('toExtension', value); + // Reset format-specific options when target extension changes + onParameterChange('imageOptions', { + colorType: COLOR_TYPES.COLOR, + dpi: 300, + singleOrMultiple: OUTPUT_OPTIONS.MULTIPLE, + }); }; + return ( {/* Format Selection */} @@ -72,15 +75,37 @@ const ConvertSettings = ({ {t("convert.convertTo", "Convert to")}: -