From 374d94932ba7125f2e37c7fd3cf5863c666b56ff Mon Sep 17 00:00:00 2001 From: notsafeforgit Date: Mon, 23 Mar 2026 01:40:43 -0700 Subject: [PATCH] feat(ui): improve duplicate checker select options and fix resolution check Renamed the dropdown options in the duplicate checkers to be much clearer about their behavior (e.g. 'Keep the largest file'). Also fixed a bug in the Image Duplicate Checker where 'select highest resolution' would fail or do nothing because 'checkSameResolution' was incorrectly trying to access array index [0] on visual_files instead of finding the max resolution across all files, causing it to incorrectly abort the selection. --- .../ImageDuplicateChecker/ImageDuplicateChecker.tsx | 9 ++++++--- ui/v2.5/src/locales/en-GB.json | 8 ++++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/ui/v2.5/src/components/ImageDuplicateChecker/ImageDuplicateChecker.tsx b/ui/v2.5/src/components/ImageDuplicateChecker/ImageDuplicateChecker.tsx index 81207af41..d55a7a0cc 100644 --- a/ui/v2.5/src/components/ImageDuplicateChecker/ImageDuplicateChecker.tsx +++ b/ui/v2.5/src/components/ImageDuplicateChecker/ImageDuplicateChecker.tsx @@ -250,9 +250,12 @@ const ImageDuplicateChecker: React.FC = () => { }; function checkSameResolution(dataGroup: GQL.SlimImageDataFragment[]) { - const resolutions = dataGroup.map( - (s) => (s.visual_files[0]?.width ?? 0) * (s.visual_files[0]?.height ?? 0) - ); + const resolutions = dataGroup.map((s) => { + return s.visual_files.reduce( + (prev, f) => Math.max(prev, (f.height ?? 0) * (f.width ?? 0)), + 0 + ); + }); return new Set(resolutions).size === 1; } diff --git a/ui/v2.5/src/locales/en-GB.json b/ui/v2.5/src/locales/en-GB.json index 53c8cb9e8..8c4bae0b1 100644 --- a/ui/v2.5/src/locales/en-GB.json +++ b/ui/v2.5/src/locales/en-GB.json @@ -1136,12 +1136,12 @@ "medium": "Medium" }, "search_accuracy_label": "Search Accuracy", - "select_all_but_largest_file": "Select every file in each duplicated group, except the largest file", - "select_all_but_largest_resolution": "Select every file in each duplicated group, except the file with highest resolution", + "select_all_but_largest_file": "Keep the largest file (select all but the largest)", + "select_all_but_largest_resolution": "Keep the highest resolution file (select all but the highest resolution)", "select_none": "Select None", - "select_oldest": "Select the oldest file in the duplicate group", + "select_oldest": "Keep the oldest file (select all but the oldest)", "select_options": "Select Options…", - "select_youngest": "Select the youngest file in the duplicate group", + "select_youngest": "Keep the youngest file (select all but the youngest)", "title": "Duplicate Scenes" }, "duplicated": "Duplicated",