From 821acc439692669cbf72d9ef99d46a682fb3130f Mon Sep 17 00:00:00 2001
From: Sluijsens
Date: Tue, 17 Nov 2026 23:01:05 +0100
Subject: [PATCH] Compacte tegels in de opruim- en verwijderdialoog
PhotoSelectionList krijgt layout 'compact' (kleine vierkante thumbnails, naam en gebruik op een regel, details in de tooltip). De opruimdialoog gebruikt die; de plekken-lijst van de tweede verwijderstap is een compact raster.
Co-Authored-By: Claude Sonnet 5.5
---
.../assumptions-and-open-questions.md | 1 +
.../media/components/CleanupDialog.tsx | 1 +
.../media/components/DeleteDialog.tsx | 23 ++++++--
.../components/PhotoSelectionList.test.tsx | 16 +++++-
.../media/components/PhotoSelectionList.tsx | 56 ++++++++++++++++---
5 files changed, 81 insertions(+), 16 deletions(-)
diff --git a/aidlc-docs/features/media-library/assumptions-and-open-questions.md b/aidlc-docs/features/media-library/assumptions-and-open-questions.md
index 344c1e6..511d9b2 100644
--- a/aidlc-docs/features/media-library/assumptions-and-open-questions.md
+++ b/aidlc-docs/features/media-library/assumptions-and-open-questions.md
@@ -74,3 +74,4 @@ Kept while Bryan is away (2026-11-17): no questions to him, a most probable assu
| 43 | **"Slide toevoegen" replaces the per-slide library button** (Bryan, 2026-11-17, after seeing it on test; replaces assumption 36's per-slide button). | The per-slide "Kies uit bibliotheek" is gone. The existing add button is "Slide toevoegen" and opens the shared picker: choose a library photo or upload one on the spot (it also lands in the library, ML-17); one photo makes one NEW slide. A slide's photo cannot be changed or replaced: remove the slide and add another. Dropping files on the section still adds one slide per file (same upload as before). The crop per slide stays a goal (phase 2). | Keep a per-slide change button: Bryan said no. | `HeroPage.addSlideWithPhoto`, `LibraryPickerDialog` |
| 44 | **Tiles or list in the library** (Bryan, 2026-11-17). | The library and the trash show the photos as tiles (grid of thumbnails, selectable, same usage and links) by default, with a switch Tiles / List next to the filters. The choice is remembered in the browser (`localStorage`, guarded; it falls back to tiles). The clean-up dialog keeps its list. The picker already is a grid. | Remember the choice on the server per user: needs a user-settings store. | `PhotoSelectionList` (`layout`), `lib/layoutPreference.ts`, `MediaLibraryPage` |
| 45 | **Media screen details** (Bryan, 2026-11-17): bulk bar keeps its height; the whole tile selects; smaller tiles; 0 days in the clean-up; no time-basis choice. | The bar is an invisible placeholder of the same height (h-9) while nothing is selected. A click on a tile selects it (shift for a range); links, buttons and the box itself do their own thing. One more tile per row at every width. The clean-up slider goes from 0: 0 days means every photo that is not in use right now qualifies at the next clean-up (preview and confirmation unchanged, with a note at 0). The period always counts from the last use (assumption 29); there was no separate checkbox for the time basis in the clean-up (the only checkbox is "Alleen ongebruikte foto's", a filter, which stays because it protects photos in use), so nothing was removed. | If Bryan meant "Alleen ongebruikte foto's": removing it would put photos in use in the clean-up (counted from their upload date). | `BulkActionBar`, `PhotoSelectionList`, `CleanupDialog`, `CleanupSelection.MinDays` |
+| 46 | **Compact tiles in the clean-up and the delete confirmation** (product owner request, 2026-11-17). | `PhotoSelectionList` has a third layout `compact` (3/4/6/8 columns, square small thumbnails, name and a short usage line on one truncated line each, full name, date, size and usage in the tooltip; checkbox chip, whole-tile select, select all and the bulk bar unchanged). The clean-up dialog uses it. The "places that lose the photo" list in the second step of `DeleteDialog` is a read-only compact grid of the same kind. `PurgeDialog` shows no photo list (only a count), so it is unchanged; the library tiles and the ImagePicker are unchanged. | Long row lists again in the dialogs (much scrolling, little overview). | `PhotoSelectionList.tsx` (`layout="compact"`), `CleanupDialog.tsx`, `DeleteDialog.tsx` (`delete-places`) |
diff --git a/frontend/src/features/media/components/CleanupDialog.tsx b/frontend/src/features/media/components/CleanupDialog.tsx
index 4765032..8066058 100644
--- a/frontend/src/features/media/components/CleanupDialog.tsx
+++ b/frontend/src/features/media/components/CleanupDialog.tsx
@@ -108,6 +108,7 @@ export function CleanupDialog({ open, onOpenChange }: { open: boolean; onOpenCha
items={items}
selection={selection}
onSelectionChange={setSelection}
+ layout="compact"
bulk={{
actions: [],
onClear: () => setSelection(new Set()),
diff --git a/frontend/src/features/media/components/DeleteDialog.tsx b/frontend/src/features/media/components/DeleteDialog.tsx
index 33bcccf..3c64b25 100644
--- a/frontend/src/features/media/components/DeleteDialog.tsx
+++ b/frontend/src/features/media/components/DeleteDialog.tsx
@@ -85,12 +85,23 @@ function DeleteDialogBody({ items, onClose, onDone }: { items: readonly PhotoIte
)}
{step === 'second' && (
-
- {inUse.map((item) => (
- -
- {item.name}: {item.uses.map((use) => usageLabel(t, use)).join('; ')}
-
- ))}
+
+ {inUse.map((item) => {
+ const places = item.uses.map((use) => usageLabel(t, use)).join('; ');
+ return (
+ -
+ {item.thumbnailUrl ? (
+
+ ) : (
+ {t('media.list.noThumbnail')}
+ )}
+
+
{item.name}
+
{places}
+
+
+ );
+ })}
)}
{trash.isError && (
diff --git a/frontend/src/features/media/components/PhotoSelectionList.test.tsx b/frontend/src/features/media/components/PhotoSelectionList.test.tsx
index f1b50fd..984a509 100644
--- a/frontend/src/features/media/components/PhotoSelectionList.test.tsx
+++ b/frontend/src/features/media/components/PhotoSelectionList.test.tsx
@@ -13,7 +13,7 @@ const items: PhotoItem[] = [
{ id: 'p4', name: 'Foto 4', bytes: 10, createdAt: '2026-11-14T10:00:00Z', uses: [] },
];
-function Harness({ disabled, layout }: { disabled?: (item: PhotoItem) => boolean; layout?: 'list' | 'tiles' }) {
+function Harness({ disabled, layout }: { disabled?: (item: PhotoItem) => boolean; layout?: 'list' | 'tiles' | 'compact' }) {
const [selection, setSelection] = useState(emptySelection);
return (
<>
@@ -192,6 +192,20 @@ describe('the bulk bar is part of the list header, above the photos', () => {
expect(screen.getByRole('checkbox', { name: 'Foto 3' })).toBeChecked();
});
+ it('compact layout: small tiles, the whole tile selects, name and usage stay available', async () => {
+ render();
+
+ expect(screen.getByTestId('photo-items')).toHaveAttribute('data-layout', 'compact');
+ expect(screen.getByTestId('photo-chip-p1')).toBeInTheDocument();
+ expect(screen.getByTestId('photo-usage-p1')).toBeInTheDocument();
+ expect(screen.getByTestId('photo-row-p1')).toHaveAttribute('title', expect.stringContaining('Foto 1'));
+
+ await userEvent.click(screen.getByTestId('photo-row-p1'));
+ expect(screen.getByRole('checkbox', { name: 'Foto 1' })).toBeChecked();
+ await userEvent.click(screen.getByTestId('photo-select-all'));
+ expect(screen.getByRole('checkbox', { name: 'Foto 3' })).toBeChecked();
+ });
+
it('does not select a disabled tile by clicking it', async () => {
render( item.id === 'p1'} />);
diff --git a/frontend/src/features/media/components/PhotoSelectionList.tsx b/frontend/src/features/media/components/PhotoSelectionList.tsx
index 0429b64..9802a10 100644
--- a/frontend/src/features/media/components/PhotoSelectionList.tsx
+++ b/frontend/src/features/media/components/PhotoSelectionList.tsx
@@ -39,8 +39,8 @@ interface PhotoSelectionListProps {
renderUse?: (use: PhotoUse, label: string) => ReactNode;
/** The actions on the selection. They appear in the header of the list, above the photos, once something is selected. */
bulk?: Omit;
- /** A list of rows (default) or a grid of tiles with big thumbnails. Everything works in both. */
- layout?: 'list' | 'tiles';
+ /** A list of rows (default), a grid of tiles with big thumbnails, or a dense grid of small thumbnails ('compact', for the dialogs). Everything works in all. */
+ layout?: 'list' | 'tiles' | 'compact';
}
/**
@@ -89,7 +89,13 @@ export function PhotoSelectionList({ items, selection, onSelectionChange, isDisa
{
const disabled = isDisabled?.(item) ?? false;
const labelId = `photo-${item.id}-label`;
- const tiles = layout === 'tiles';
+ const compact = layout === 'compact';
+ const tiles = layout === 'tiles' || compact;
const checkbox = (
);
const thumbnail = item.thumbnailUrl ? (
-
+
) : (
-
+
{t('media.list.noThumbnail')}
);
- const details = (
+ // The compact tile keeps everything in the tooltip: the full name, date and size, and where the photo is used.
+ const usageText = item.deletedAt
+ ? t('media.trash.since', { date: dateFormat.format(new Date(item.deletedAt)) })
+ : item.uses.length === 0
+ ? item.unusedSince
+ ? t('media.use.noneSince', { date: dateFormat.format(new Date(item.unusedSince)) })
+ : t('media.use.none')
+ : item.uses.map((use) => usageLabel(t, use)).join('; ');
+ const tooltip = `${item.name} (${dateFormat.format(new Date(item.createdAt))} ยท ${formatBytes(item.bytes, i18n.language)}): ${usageText}`;
+ const details = compact ? (
+
+
+ {item.name}
+
+
+ {item.deletedAt || item.uses.length === 0 ? (
+ {usageText}
+ ) : (
+ item.uses.map((use, index) => {
+ const label = usageLabel(t, use);
+ return (
+
+ {index > 0 && '; '}
+ {renderUse ? renderUse(use, label) : label}
+
+ );
+ })
+ )}
+
+
+ ) : (
{item.name}
@@ -149,6 +186,7 @@ export function PhotoSelectionList({ items, selection, onSelectionChange, isDisa
return tiles ? (
-
{/* flex (not a block with an inline box inside): no line box, so no extra space under the checkbox and equal padding on all four sides */}
-
{checkbox}
+ {checkbox}
{thumbnail}
- {details}
+ {details}
) : (
-