From 8dcf820a019dcc1bdb5950dcd1ad745a7c942186 Mon Sep 17 00:00:00 2001 From: James Brunton Date: Tue, 19 Aug 2025 16:17:37 +0100 Subject: [PATCH] Redesign sort UI --- .../tools/merge/MergeFileSorter.tsx | 76 ++++++++++--------- 1 file changed, 40 insertions(+), 36 deletions(-) diff --git a/frontend/src/components/tools/merge/MergeFileSorter.tsx b/frontend/src/components/tools/merge/MergeFileSorter.tsx index 3cb716d0d..2b21afc64 100644 --- a/frontend/src/components/tools/merge/MergeFileSorter.tsx +++ b/frontend/src/components/tools/merge/MergeFileSorter.tsx @@ -1,10 +1,7 @@ import React, { useState } from 'react'; -import { Group, Button, Text, ActionIcon, Stack } from '@mantine/core'; +import { Group, Button, Text, ActionIcon, Stack, Select } from '@mantine/core'; import { useTranslation } from 'react-i18next'; import SortIcon from '@mui/icons-material/Sort'; -import SortByAlphaIcon from '@mui/icons-material/SortByAlpha'; -import AccessTimeIcon from '@mui/icons-material/AccessTime'; -import CalendarTodayIcon from '@mui/icons-material/CalendarToday'; import ArrowUpwardIcon from '@mui/icons-material/ArrowUpward'; import ArrowDownwardIcon from '@mui/icons-material/ArrowDownward'; @@ -18,54 +15,61 @@ const MergeFileSorter: React.FC = ({ disabled = false, }) => { const { t } = useTranslation(); + const [sortType, setSortType] = useState<'filename' | 'dateModified'>('filename'); const [ascending, setAscending] = useState(true); - const sortButtons = [ - { - key: 'filename' as const, - icon: , - label: t('merge.sortBy.filename', 'Sort by Filename'), - }, - { - key: 'dateModified' as const, - icon: , - label: t('merge.sortBy.dateModified', 'Sort by Date Modified'), - }, + const sortOptions = [ + { value: 'filename', label: t('merge.sortBy.filename', 'File Name') }, + { value: 'dateModified', label: t('merge.sortBy.dateModified', 'Date Modified') }, ]; - const handleSortDirectionToggle = () => { + const handleSort = () => { + onSortFiles(sortType, ascending); + }; + + const handleDirectionToggle = () => { setAscending(!ascending); }; return ( - {t('merge.sortBy.description', "Files will be merged in the order they're selected. Drag to reorder or use the buttons below to sort.")} + {t('merge.sortBy.description', "Files will be merged in the order they're selected. Drag to reorder or sort below.")} - - {sortButtons.map(({ key, icon, label }) => ( -