From f14ea692233090670063711be9f80b7ab50eee02 Mon Sep 17 00:00:00 2001 From: Claudio Date: Mon, 11 May 2026 00:49:02 +0200 Subject: [PATCH] ui(duplicates): show grandparent + parent in path strip MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When two duplicates live in folders with the same parent name (e.g. matching '2023' subfolders under different archives), showing only the parent gave both thumbnails the same label. Walk one level up: the path strip now renders '…//' so the user can always tell two copies apart at a glance. Filename still surfaces via the title tooltip. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../components/duplicates/DuplicatesView.tsx | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/frontend/src/components/duplicates/DuplicatesView.tsx b/frontend/src/components/duplicates/DuplicatesView.tsx index 4d3264f..c65ef44 100644 --- a/frontend/src/components/duplicates/DuplicatesView.tsx +++ b/frontend/src/components/duplicates/DuplicatesView.tsx @@ -515,20 +515,25 @@ function formatBytes(n: number): string { } /** Short label for the bottom path strip on a duplicate thumbnail. - * Goal: tell two copies-with-the-same-filename apart at a glance, so - * we want the parent folder name — that's almost always the - * discriminator (different shoots, different years, different - * upload sources). When the parent folder is unhelpful (e.g. the - * filename is itself sitting at the root) we fall back to the file - * basename. Long folder names get text-overflow-ellipsis'd by the - * enclosing strip's `truncate`. */ + * Goal: tell two copies-with-the-same-filename apart at a glance. + * Shows the last two folders ("…//") so the + * discriminator is visible even when both copies live under the + * same parent name (e.g. matching `2023` subfolders under different + * archives). The leading "…/" is always present when there's any + * truncated prefix; the enclosing strip's `truncate` handles any + * excess width. */ function duplicatePathLabel(filepath: string): string { if (!filepath) return '' const parts = filepath.split('/').filter(Boolean) if (parts.length === 0) return filepath - if (parts.length === 1) return parts[0] - // The second-to-last segment IS the parent directory. - return parts[parts.length - 2] + // Strip the filename (last segment); only the directory chain + // discriminates between copies with matching basenames. + const folders = parts.slice(0, -1) + if (folders.length === 0) return parts[0] + if (folders.length === 1) return `…/${folders[0]}` + const parent = folders[folders.length - 1] + const grandparent = folders[folders.length - 2] + return `…/${grandparent}/${parent}` } /** Adapt a DuplicateGroupMember (the slim API shape) to a Photo, which