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 53b6c14..344c1e6 100644
--- a/aidlc-docs/features/media-library/assumptions-and-open-questions.md
+++ b/aidlc-docs/features/media-library/assumptions-and-open-questions.md
@@ -73,3 +73,4 @@ Kept while Bryan is away (2026-11-17): no questions to him, a most probable assu
| 42 | **One progress pattern for upload, processing and a new crop** (Bryan, 2026-11-17, after seeing it on test). | A shared `ProcessingProgress` (text "Wordt verwerkt…", one 0-100% bar, the percentage, no spinner, no step counts) is used on every photo and for the batch. The batch bar covers upload and processing together; there are no byte counts from the upload, so a photo's percentage is staged: waiting 0, uploading 15, uploaded 30, then 30-100 from the server's processing steps. A new crop uses the full 0-100 from its steps. The counter "x van y verwerkt" stays per batch. | Real upload byte progress (needs XHR progress in the API client). | `features/media/components/ProcessingProgress.tsx`, `lib/photoProgress.ts`, `hero/components/ProcessingStatus.tsx` |
| 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` |
diff --git a/frontend/src/features/media/components/BulkActionBar.tsx b/frontend/src/features/media/components/BulkActionBar.tsx
index 96ab255..15153a1 100644
--- a/frontend/src/features/media/components/BulkActionBar.tsx
+++ b/frontend/src/features/media/components/BulkActionBar.tsx
@@ -23,11 +23,13 @@ export interface BulkActionBarProps {
/**
* The actions on the selected photos: the count, a way to clear the selection and the actions. It sits in the header of
* the photo list (see PhotoSelectionList), which is the one shared place for it. The actions are data, so more of
- * them (tags, move) can be added without touching the list. It shows nothing while nothing is selected.
+ * them (tags, move) can be added without touching the list. While nothing is selected it is an empty box of the same height.
*/
export function BulkActionBar({ count, actions, onClear, summary }: BulkActionBarProps) {
const { t } = useTranslation();
- if (count === 0) return null;
+ // The bar keeps its height while nothing is selected (an invisible placeholder), so the photos never jump when the first
+ // photo is selected.
+ if (count === 0) return
;
return (
diff --git a/frontend/src/features/media/components/CleanupDialog.tsx b/frontend/src/features/media/components/CleanupDialog.tsx
index 6449d59..4765032 100644
--- a/frontend/src/features/media/components/CleanupDialog.tsx
+++ b/frontend/src/features/media/components/CleanupDialog.tsx
@@ -12,11 +12,11 @@ import { DeleteDialog } from './DeleteDialog';
import { PhotoSelectionList } from './PhotoSelectionList';
const DEFAULT_DAYS = 7;
-const MIN_DAYS = 1;
+const MIN_DAYS = 0;
const MAX_DAYS = 365;
/**
- * "Clean up": the photos older than the chosen number of days (by default 7), by default only the unused ones, newest
+ * "Clean up": the photos not used for the chosen number of days (by default 7; 0 = every unused photo now), by default only the unused ones, newest
* first and all selected so single photos can be taken out. Confirming moves exactly the selected photos to the trash
* (a photo in use asks for a second confirmation naming the places).
*/
@@ -61,7 +61,7 @@ export function CleanupDialog({ open, onOpenChange }: { open: boolean; onOpenCha
-
+
+ {days === 0 && (
+
+ {t('media.cleanup.zeroNote')}
+
+ )}
boolean }) {
+function Harness({ disabled, layout }: { disabled?: (item: PhotoItem) => boolean; layout?: 'list' | 'tiles' }) {
const [selection, setSelection] = useState(emptySelection);
return (
<>
@@ -22,12 +22,30 @@ function Harness({ disabled }: { disabled?: (item: PhotoItem) => boolean }) {
selection={selection}
onSelectionChange={setSelection}
isDisabled={disabled}
+ layout={layout}
bulk={{ actions: [{ id: 'delete', label: 'Verwijderen', destructive: true, run: vi.fn() }], onClear: () => setSelection(emptySelection) }}
/>
>
);
}
+function PhotoSelectionListWithLink() {
+ const [selection, setSelection] = useState(emptySelection);
+ return (
+ (
+ event.preventDefault()} data-testid="use-link-p1">
+ {label}
+
+ )}
+ />
+ );
+}
+
beforeEach(async () => {
await i18n.changeLanguage('nl');
});
@@ -140,4 +158,45 @@ describe('the bulk bar is part of the list header, above the photos', () => {
const first = screen.getByTestId('photo-row-p1');
expect(bar.compareDocumentPosition(first) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
});
+ it('keeps the header the same height before and after the first selection, so nothing jumps', async () => {
+ render();
+ const placeholder = screen.getByTestId('bulk-action-bar-placeholder');
+ expect(placeholder).toHaveClass('h-9');
+ expect(placeholder).toHaveAttribute('aria-hidden', 'true');
+
+ await userEvent.click(screen.getByRole('checkbox', { name: 'Foto 2' }));
+
+ expect(screen.queryByTestId('bulk-action-bar-placeholder')).not.toBeInTheDocument();
+ // The buttons of the bar are small (h-9), the same as the placeholder.
+ expect(screen.getByTestId('bulk-clear')).toHaveClass('h-9');
+ });
+
+ it('selects a tile by clicking the photo, but not when a link on the tile is clicked', async () => {
+ render(
+ <>
+
+ >,
+ );
+
+ await userEvent.click(screen.getByTestId('photo-row-p2'));
+ expect(screen.getByRole('checkbox', { name: 'Foto 2' })).toBeChecked();
+
+ await userEvent.click(screen.getByTestId('photo-row-p2'));
+ expect(screen.getByRole('checkbox', { name: 'Foto 2' })).not.toBeChecked();
+
+ await userEvent.click(screen.getAllByTestId('use-link-p1')[0]!);
+ expect(screen.getByRole('checkbox', { name: 'Foto 1' })).not.toBeChecked();
+
+ // The box itself toggles once (the click on the box does not also toggle the tile).
+ await userEvent.click(screen.getByRole('checkbox', { name: 'Foto 3' }));
+ expect(screen.getByRole('checkbox', { name: 'Foto 3' })).toBeChecked();
+ });
+
+ it('does not select a disabled tile by clicking it', async () => {
+ render( item.id === 'p1'} />);
+
+ await userEvent.click(screen.getByTestId('photo-row-p1'));
+
+ expect(screen.getByRole('checkbox', { name: 'Foto 1' })).not.toBeChecked();
+ });
});
diff --git a/frontend/src/features/media/components/PhotoSelectionList.tsx b/frontend/src/features/media/components/PhotoSelectionList.tsx
index d2987e8..0429b64 100644
--- a/frontend/src/features/media/components/PhotoSelectionList.tsx
+++ b/frontend/src/features/media/components/PhotoSelectionList.tsx
@@ -89,7 +89,7 @@ export function PhotoSelectionList({ items, selection, onSelectionChange, isDisa
{
+ if (disabled || (event.target as HTMLElement).closest('a, button, input, label')) return;
+ onItemClick(item.id, !selection.has(item.id), event.shiftKey);
+ }}
>
{/* 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}
diff --git a/frontend/src/features/media/pages/MediaLibraryPage.test.tsx b/frontend/src/features/media/pages/MediaLibraryPage.test.tsx
index fdcb7d7..c1d008e 100644
--- a/frontend/src/features/media/pages/MediaLibraryPage.test.tsx
+++ b/frontend/src/features/media/pages/MediaLibraryPage.test.tsx
@@ -1,6 +1,6 @@
import { beforeEach, describe, expect, it } from 'vitest';
import { http, HttpResponse } from 'msw';
-import { screen, waitFor, within } from '@testing-library/react';
+import { fireEvent, screen, waitFor, within } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import i18n from '@/i18n/config';
import { server } from '@/mocks/server';
@@ -323,6 +323,22 @@ describe('MediaLibraryPage', () => {
expect(screen.getByTestId('layout-list')).toBeInTheDocument();
});
+ it('allows 0 days in the clean-up and says what that means', async () => {
+ renderPage();
+ await screen.findByTestId('photo-selection-list');
+ await userEvent.click(screen.getByTestId('cleanup-open'));
+ const dialog = await screen.findByTestId('cleanup-dialog');
+ const slider = within(dialog).getByTestId('cleanup-days');
+ expect(slider).toHaveAttribute('min', '0');
+
+ fireEvent.change(slider, { target: { value: '0' } });
+
+ expect(await within(dialog).findByTestId('cleanup-zero-note')).toHaveTextContent('direct in aanmerking');
+ expect(within(dialog).getByText('Direct: elke ongebruikte foto')).toBeInTheDocument();
+ await waitFor(() => expect(within(dialog).getByTestId('cleanup-summary')).toBeInTheDocument());
+ expect(within(dialog).getByTestId('cleanup-confirm')).toBeInTheDocument();
+ });
+
it('shows an error when the library cannot be loaded', async () => {
server.use(http.get('*/media-library/photos', () => new HttpResponse(null, { status: 500 })));
renderPage();
diff --git a/frontend/src/i18n/locales/en/translation.json b/frontend/src/i18n/locales/en/translation.json
index 2375ed2..5148c9b 100644
--- a/frontend/src/i18n/locales/en/translation.json
+++ b/frontend/src/i18n/locales/en/translation.json
@@ -834,7 +834,7 @@
"cleanup": {
"open": "Clean up",
"title": "Clean up",
- "description": "Photos older than the number of days below, newest first. Take out the photos you want to keep.",
+ "description": "Photos that have not been used for a number of days (counted from the last use), newest first. Take out the photos you want to keep.",
"days_one": "Older than {{count}} day",
"days_other": "Older than {{count}} days",
"onlyUnused": "Only unused photos",
@@ -843,7 +843,9 @@
"selectedSize": "Selected: {{size}}",
"trashNote": "The selected photos go to the trash and can be restored for 7 days.",
"confirm_one": "{{count}} photo to the trash",
- "confirm_other": "{{count}} photos to the trash"
+ "confirm_other": "{{count}} photos to the trash",
+ "daysZero": "Immediately: every unused photo",
+ "zeroNote": "At 0 days every photo that is not used anywhere right now qualifies at once, even if it was just detached. You see the overview first and confirm yourself; the photos go to the trash."
},
"picker": {
"upload": "Upload an image",
diff --git a/frontend/src/i18n/locales/nl/translation.json b/frontend/src/i18n/locales/nl/translation.json
index 541895e..803ef1a 100644
--- a/frontend/src/i18n/locales/nl/translation.json
+++ b/frontend/src/i18n/locales/nl/translation.json
@@ -834,7 +834,7 @@
"cleanup": {
"open": "Opruimen",
"title": "Opruimen",
- "description": "Foto's die ouder zijn dan het aantal dagen hieronder, nieuwste eerst. Haal foto's uit de selectie die je wilt houden.",
+ "description": "Foto's die al een aantal dagen niet gebruikt zijn (geteld vanaf het laatste gebruik), nieuwste eerst. Haal foto's uit de selectie die je wilt houden.",
"days_one": "Ouder dan {{count}} dag",
"days_other": "Ouder dan {{count}} dagen",
"onlyUnused": "Alleen ongebruikte foto's",
@@ -843,7 +843,9 @@
"selectedSize": "Geselecteerd: {{size}}",
"trashNote": "De geselecteerde foto's gaan naar de prullenbak en kunnen 7 dagen worden teruggezet.",
"confirm_one": "{{count}} foto naar de prullenbak",
- "confirm_other": "{{count}} foto's naar de prullenbak"
+ "confirm_other": "{{count}} foto's naar de prullenbak",
+ "daysZero": "Direct: elke ongebruikte foto",
+ "zeroNote": "Bij 0 dagen komt elke foto die op dit moment nergens wordt gebruikt direct in aanmerking, ook als hij net is losgekoppeld. Je ziet eerst het overzicht en bevestigt zelf; de foto’s gaan naar de prullenbak."
},
"picker": {
"upload": "Afbeelding uploaden",
diff --git a/src/SlpModularCms.Core.Tests/Media/MediaLibraryTests.cs b/src/SlpModularCms.Core.Tests/Media/MediaLibraryTests.cs
index 09b416c..d14cbb2 100644
--- a/src/SlpModularCms.Core.Tests/Media/MediaLibraryTests.cs
+++ b/src/SlpModularCms.Core.Tests/Media/MediaLibraryTests.cs
@@ -45,13 +45,23 @@ public class MediaLibraryTests
}
[Theory]
- [InlineData(-5, 1)]
- [InlineData(0, 1)]
+ [InlineData(-5, 0)]
+ [InlineData(0, 0)]
+ [InlineData(1, 1)]
[InlineData(7, 7)]
[InlineData(365, 365)]
[InlineData(4000, 365)]
public void The_period_stays_inside_the_slider_range(int days, int expected) => CleanupSelection.ClampDays(days).Should().Be(expected);
+ [Fact]
+ public void Zero_days_selects_every_unused_photo_at_once_and_keeps_those_in_use_out_unless_asked()
+ {
+ var used = Item(0, used: true);
+ var unused = Item(0);
+
+ CleanupSelection.Select([used, unused], Now.AddMinutes(1), 0, onlyUnused: true).Should().ContainSingle().Which.Should().Be(unused);
+ }
+
[Fact]
public void A_photo_exactly_at_the_boundary_is_not_selected_yet()
{
diff --git a/src/SlpModularCms.Core/Media/Library/CleanupSelection.cs b/src/SlpModularCms.Core/Media/Library/CleanupSelection.cs
index cb55219..47c4702 100644
--- a/src/SlpModularCms.Core/Media/Library/CleanupSelection.cs
+++ b/src/SlpModularCms.Core/Media/Library/CleanupSelection.cs
@@ -8,7 +8,8 @@ namespace SlpModularCms.Core.Media.Library;
public static class CleanupSelection
{
public const int DefaultDays = 7;
- public const int MinDays = 1;
+ /// 0 means: every photo that is not in use qualifies at the next clean-up (Bryan, 2026-11-17).
+ public const int MinDays = 0;
public const int MaxDays = 365;
/// The days kept inside the slider range.