Mediabibliotheek: tegels als standaardweergave, schakelaar tegels/lijst met onthouden keuze
Continuous Integration / config-sls (pull_request) Successful in 8s
Continuous Integration / config-asf (pull_request) Successful in 8s
Continuous Integration / changes (pull_request) Successful in 15s
Continuous Integration / backend-build (pull_request) Successful in 1m57s
Continuous Integration / compile-sites (pull_request) Successful in 1m57s
Continuous Integration / vulnerability-scan (pull_request) Successful in 1m44s
Continuous Integration / frontend-prepare (pull_request) Successful in 29s
Continuous Integration / frontend-build (pull_request) Successful in 1m18s
Continuous Integration / backend-test (pull_request) Successful in 3m41s
Continuous Integration / frontend-test (pull_request) Successful in 3m15s
Continuous Integration / frontend-lint (pull_request) Successful in 3m46s
Continuous Integration / publish-sls-test (pull_request) Skipped
Continuous Integration / publish-sls-production (pull_request) Skipped
Continuous Integration / deploy-sls-test (pull_request) Skipped
Continuous Integration / deploy-sls-production (pull_request) Skipped
Continuous Integration / publish-asf-test (pull_request) Skipped
Continuous Integration / deploy-asf-test (pull_request) Skipped
Continuous Integration / smoke-sls-test (pull_request) Skipped
Continuous Integration / smoke-asf-test (pull_request) Skipped
Continuous Integration / config-sls (pull_request) Successful in 8s
Continuous Integration / config-asf (pull_request) Successful in 8s
Continuous Integration / changes (pull_request) Successful in 15s
Continuous Integration / backend-build (pull_request) Successful in 1m57s
Continuous Integration / compile-sites (pull_request) Successful in 1m57s
Continuous Integration / vulnerability-scan (pull_request) Successful in 1m44s
Continuous Integration / frontend-prepare (pull_request) Successful in 29s
Continuous Integration / frontend-build (pull_request) Successful in 1m18s
Continuous Integration / backend-test (pull_request) Successful in 3m41s
Continuous Integration / frontend-test (pull_request) Successful in 3m15s
Continuous Integration / frontend-lint (pull_request) Successful in 3m46s
Continuous Integration / publish-sls-test (pull_request) Skipped
Continuous Integration / publish-sls-production (pull_request) Skipped
Continuous Integration / deploy-sls-test (pull_request) Skipped
Continuous Integration / deploy-sls-production (pull_request) Skipped
Continuous Integration / publish-asf-test (pull_request) Skipped
Continuous Integration / deploy-asf-test (pull_request) Skipped
Continuous Integration / smoke-sls-test (pull_request) Skipped
Continuous Integration / smoke-asf-test (pull_request) Skipped
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -72,3 +72,4 @@ Kept while Bryan is away (2026-11-17): no questions to him, a most probable assu
|
|||||||
| 41 | **The picker has a single and a multiple mode** (Bryan, 2026-11-17). | `ImagePicker` takes `mode="single"` (default, radio group, used by the hero slides) or `mode="multiple"` (checkboxes, several photos, several files per upload, ready for the gallery). Both use the same upload checks. | n/a | `ImagePicker.tsx` |
|
| 41 | **The picker has a single and a multiple mode** (Bryan, 2026-11-17). | `ImagePicker` takes `mode="single"` (default, radio group, used by the hero slides) or `mode="multiple"` (checkboxes, several photos, several files per upload, ready for the gallery). Both use the same upload checks. | n/a | `ImagePicker.tsx` |
|
||||||
| 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` |
|
| 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` |
|
| 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` |
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { useRef, type ReactNode } from 'react';
|
import { useRef, type ReactNode } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { Checkbox } from '@/components/ui/checkbox';
|
import { Checkbox } from '@/components/ui/checkbox';
|
||||||
|
import { cn } from '@/lib/utils';
|
||||||
import { formatBytes } from '../lib/format';
|
import { formatBytes } from '../lib/format';
|
||||||
import { BulkActionBar, type BulkActionBarProps } from './BulkActionBar';
|
import { BulkActionBar, type BulkActionBarProps } from './BulkActionBar';
|
||||||
import { usageLabel } from '../lib/usageLabel';
|
import { usageLabel } from '../lib/usageLabel';
|
||||||
@@ -38,13 +39,15 @@ interface PhotoSelectionListProps {
|
|||||||
renderUse?: (use: PhotoUse, label: string) => ReactNode;
|
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. */
|
/** The actions on the selection. They appear in the header of the list, above the photos, once something is selected. */
|
||||||
bulk?: Omit<BulkActionBarProps, 'count'>;
|
bulk?: Omit<BulkActionBarProps, 'count'>;
|
||||||
|
/** A list of rows (default) or a grid of tiles with big thumbnails. Everything works in both. */
|
||||||
|
layout?: 'list' | 'tiles';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The photos with a checkbox each: click or Space to toggle, shift-click for a range, a "select all" box in the header
|
* The photos with a checkbox each: click or Space to toggle, shift-click for a range, a "select all" box in the header
|
||||||
* (with the in-between state), and a live announcement of the count. One component for the library and the clean-up.
|
* (with the in-between state), and a live announcement of the count. One component for the library and the clean-up.
|
||||||
*/
|
*/
|
||||||
export function PhotoSelectionList({ items, selection, onSelectionChange, isDisabled, renderUse, bulk }: PhotoSelectionListProps) {
|
export function PhotoSelectionList({ items, selection, onSelectionChange, isDisabled, renderUse, bulk, layout = 'list' }: PhotoSelectionListProps) {
|
||||||
const { t, i18n } = useTranslation();
|
const { t, i18n } = useTranslation();
|
||||||
const anchor = useRef<string | null>(null);
|
const anchor = useRef<string | null>(null);
|
||||||
const selectable = items.filter((item) => !isDisabled?.(item));
|
const selectable = items.filter((item) => !isDisabled?.(item));
|
||||||
@@ -85,56 +88,79 @@ export function PhotoSelectionList({ items, selection, onSelectionChange, isDisa
|
|||||||
{t('media.bulk.selected', { count: selection.size })}
|
{t('media.bulk.selected', { count: selection.size })}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<ul className="divide-y" aria-label={t('media.list.label')}>
|
<ul
|
||||||
|
className={layout === 'tiles' ? 'grid grid-cols-2 gap-3 py-3 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5' : 'divide-y'}
|
||||||
|
aria-label={t('media.list.label')}
|
||||||
|
data-layout={layout}
|
||||||
|
data-testid="photo-items"
|
||||||
|
>
|
||||||
{items.map((item) => {
|
{items.map((item) => {
|
||||||
const disabled = isDisabled?.(item) ?? false;
|
const disabled = isDisabled?.(item) ?? false;
|
||||||
const labelId = `photo-${item.id}-label`;
|
const labelId = `photo-${item.id}-label`;
|
||||||
return (
|
const tiles = layout === 'tiles';
|
||||||
|
const checkbox = (
|
||||||
|
<Checkbox
|
||||||
|
aria-labelledby={labelId}
|
||||||
|
data-testid={`photo-select-${item.id}`}
|
||||||
|
checked={selection.has(item.id)}
|
||||||
|
disabled={disabled}
|
||||||
|
onChange={() => undefined}
|
||||||
|
onClick={(event) => onItemClick(item.id, event.currentTarget.checked, event.shiftKey)}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
const thumbnail = item.thumbnailUrl ? (
|
||||||
|
<img src={item.thumbnailUrl} alt="" loading="lazy" className={cn('object-cover', tiles ? 'aspect-[3/2] w-full' : 'size-14 shrink-0 rounded')} />
|
||||||
|
) : (
|
||||||
|
<span className={cn('flex items-center justify-center bg-muted text-xs text-muted-foreground', tiles ? 'aspect-[3/2] w-full' : 'size-14 shrink-0 rounded')}>
|
||||||
|
{t('media.list.noThumbnail')}
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
const details = (
|
||||||
|
<div className="min-w-0 flex-1">
|
||||||
|
<p id={labelId} className="truncate text-sm font-medium">
|
||||||
|
{item.name}
|
||||||
|
</p>
|
||||||
|
<p className="text-xs text-muted-foreground">
|
||||||
|
{dateFormat.format(new Date(item.createdAt))} · {formatBytes(item.bytes, i18n.language)}
|
||||||
|
</p>
|
||||||
|
<p className="text-xs" data-testid={`photo-usage-${item.id}`}>
|
||||||
|
{item.deletedAt ? (
|
||||||
|
<span className="text-muted-foreground">{t('media.trash.since', { date: dateFormat.format(new Date(item.deletedAt)) })}</span>
|
||||||
|
) : item.uses.length === 0 ? (
|
||||||
|
<span className="text-muted-foreground">
|
||||||
|
{item.unusedSince ? t('media.use.noneSince', { date: dateFormat.format(new Date(item.unusedSince)) }) : t('media.use.none')}
|
||||||
|
</span>
|
||||||
|
) : (
|
||||||
|
<span>
|
||||||
|
{item.uses.map((use, index) => {
|
||||||
|
const label = usageLabel(t, use);
|
||||||
|
return (
|
||||||
|
<span key={`${use.module}-${use.kind}-${use.position ?? index}`}>
|
||||||
|
{index > 0 && '; '}
|
||||||
|
{renderUse ? renderUse(use, label) : label}
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
return tiles ? (
|
||||||
|
<li
|
||||||
|
key={item.id}
|
||||||
|
className={cn('relative overflow-hidden rounded-md border bg-card', selection.has(item.id) && 'ring-2 ring-primary')}
|
||||||
|
data-testid={`photo-row-${item.id}`}
|
||||||
|
>
|
||||||
|
<div className="absolute left-2 top-2 z-[1] rounded bg-background/90 p-1 shadow-sm">{checkbox}</div>
|
||||||
|
{thumbnail}
|
||||||
|
<div className="p-2">{details}</div>
|
||||||
|
</li>
|
||||||
|
) : (
|
||||||
<li key={item.id} className="flex items-center gap-3 px-2 py-2" data-testid={`photo-row-${item.id}`}>
|
<li key={item.id} className="flex items-center gap-3 px-2 py-2" data-testid={`photo-row-${item.id}`}>
|
||||||
<Checkbox
|
{checkbox}
|
||||||
aria-labelledby={labelId}
|
{thumbnail}
|
||||||
data-testid={`photo-select-${item.id}`}
|
{details}
|
||||||
checked={selection.has(item.id)}
|
|
||||||
disabled={disabled}
|
|
||||||
onChange={() => undefined}
|
|
||||||
onClick={(event) => onItemClick(item.id, event.currentTarget.checked, event.shiftKey)}
|
|
||||||
/>
|
|
||||||
{item.thumbnailUrl ? (
|
|
||||||
<img src={item.thumbnailUrl} alt="" loading="lazy" className="size-14 shrink-0 rounded object-cover" />
|
|
||||||
) : (
|
|
||||||
<span className="flex size-14 shrink-0 items-center justify-center rounded bg-muted text-xs text-muted-foreground">
|
|
||||||
{t('media.list.noThumbnail')}
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
<div className="min-w-0 flex-1">
|
|
||||||
<p id={labelId} className="truncate text-sm font-medium">
|
|
||||||
{item.name}
|
|
||||||
</p>
|
|
||||||
<p className="text-xs text-muted-foreground">
|
|
||||||
{dateFormat.format(new Date(item.createdAt))} · {formatBytes(item.bytes, i18n.language)}
|
|
||||||
</p>
|
|
||||||
<p className="text-xs" data-testid={`photo-usage-${item.id}`}>
|
|
||||||
{item.deletedAt ? (
|
|
||||||
<span className="text-muted-foreground">{t('media.trash.since', { date: dateFormat.format(new Date(item.deletedAt)) })}</span>
|
|
||||||
) : item.uses.length === 0 ? (
|
|
||||||
<span className="text-muted-foreground">
|
|
||||||
{item.unusedSince ? t('media.use.noneSince', { date: dateFormat.format(new Date(item.unusedSince)) }) : t('media.use.none')}
|
|
||||||
</span>
|
|
||||||
) : (
|
|
||||||
<span>
|
|
||||||
{item.uses.map((use, index) => {
|
|
||||||
const label = usageLabel(t, use);
|
|
||||||
return (
|
|
||||||
<span key={`${use.module}-${use.kind}-${use.position ?? index}`}>
|
|
||||||
{index > 0 && '; '}
|
|
||||||
{renderUse ? renderUse(use, label) : label}
|
|
||||||
</span>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</li>
|
</li>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
import { useCallback, useState } from 'react';
|
||||||
|
|
||||||
|
export type PhotoLayout = 'tiles' | 'list';
|
||||||
|
|
||||||
|
const KEY = 'slp.media.layout';
|
||||||
|
|
||||||
|
/** The layout this user chose last (tiles by default). Browser storage may be blocked, so every access is guarded. */
|
||||||
|
export function readLayout(): PhotoLayout {
|
||||||
|
try {
|
||||||
|
return window.localStorage.getItem(KEY) === 'list' ? 'list' : 'tiles';
|
||||||
|
} catch {
|
||||||
|
return 'tiles';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The layout of the photos and a setter that remembers the choice per user (per browser). */
|
||||||
|
export function useLayoutPreference(): [PhotoLayout, (layout: PhotoLayout) => void] {
|
||||||
|
const [layout, setLayoutState] = useState<PhotoLayout>(readLayout);
|
||||||
|
const setLayout = useCallback((next: PhotoLayout) => {
|
||||||
|
setLayoutState(next);
|
||||||
|
try {
|
||||||
|
window.localStorage.setItem(KEY, next);
|
||||||
|
} catch {
|
||||||
|
// Blocked or full: the choice then only lasts for this visit.
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
return [layout, setLayout];
|
||||||
|
}
|
||||||
@@ -23,6 +23,7 @@ function renderPage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
|
window.localStorage.removeItem('slp.media.layout');
|
||||||
await i18n.changeLanguage('nl');
|
await i18n.changeLanguage('nl');
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -289,6 +290,36 @@ describe('MediaLibraryPage', () => {
|
|||||||
expect(await screen.findByTestId('purge-partial')).toHaveTextContent('1 foto kon niet worden verwijderd');
|
expect(await screen.findByTestId('purge-partial')).toHaveTextContent('1 foto kon niet worden verwijderd');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('shows tiles by default, switches to a list, remembers the choice and keeps every function in both', async () => {
|
||||||
|
const first = renderPage();
|
||||||
|
await screen.findByTestId('photo-selection-list');
|
||||||
|
expect(screen.getByTestId('photo-items')).toHaveAttribute('data-layout', 'tiles');
|
||||||
|
expect(screen.getByTestId('layout-tiles')).toHaveAttribute('aria-pressed', 'true');
|
||||||
|
|
||||||
|
// Selecting and the bulk bar work on tiles.
|
||||||
|
await userEvent.click(screen.getByRole('checkbox', { name: 'zomer.jpg' }));
|
||||||
|
expect(await screen.findByTestId('bulk-count')).toHaveTextContent('1 foto geselecteerd');
|
||||||
|
|
||||||
|
// The filter works on tiles.
|
||||||
|
await userEvent.click(screen.getByTestId('filter-unused'));
|
||||||
|
expect(within(screen.getByTestId('photo-items')).getAllByRole('listitem')).toHaveLength(1);
|
||||||
|
await userEvent.click(screen.getByTestId('filter-all'));
|
||||||
|
|
||||||
|
await userEvent.click(screen.getByTestId('layout-list'));
|
||||||
|
expect(screen.getByTestId('photo-items')).toHaveAttribute('data-layout', 'list');
|
||||||
|
expect(screen.getByTestId('layout-list')).toHaveAttribute('aria-pressed', 'true');
|
||||||
|
expect(window.localStorage.getItem('slp.media.layout')).toBe('list');
|
||||||
|
first.unmount();
|
||||||
|
|
||||||
|
// A later visit starts with the remembered layout, also in the trash view.
|
||||||
|
renderPage();
|
||||||
|
await screen.findByTestId('photo-selection-list');
|
||||||
|
expect(screen.getByTestId('photo-items')).toHaveAttribute('data-layout', 'list');
|
||||||
|
await userEvent.click(screen.getByTestId('view-trash'));
|
||||||
|
await screen.findByTestId('trash-note');
|
||||||
|
expect(screen.getByTestId('layout-list')).toBeInTheDocument();
|
||||||
|
});
|
||||||
|
|
||||||
it('shows an error when the library cannot be loaded', async () => {
|
it('shows an error when the library cannot be loaded', async () => {
|
||||||
server.use(http.get('*/media-library/photos', () => new HttpResponse(null, { status: 500 })));
|
server.use(http.get('*/media-library/photos', () => new HttpResponse(null, { status: 500 })));
|
||||||
renderPage();
|
renderPage();
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
import { useMemo, useState, type ReactNode } from 'react';
|
import { useMemo, useState, type ReactNode } from 'react';
|
||||||
import { Link } from '@tanstack/react-router';
|
import { Link } from '@tanstack/react-router';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { Eraser, RotateCcw, Trash2, XCircle } from 'lucide-react';
|
import { Eraser, LayoutGrid, List, RotateCcw, Trash2, XCircle } from 'lucide-react';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { CleanupDialog } from '../components/CleanupDialog';
|
import { CleanupDialog } from '../components/CleanupDialog';
|
||||||
import { DeleteDialog } from '../components/DeleteDialog';
|
import { DeleteDialog } from '../components/DeleteDialog';
|
||||||
import { PurgeDialog } from '../components/PurgeDialog';
|
import { PurgeDialog } from '../components/PurgeDialog';
|
||||||
import { PhotoSelectionList, type PhotoUse } from '../components/PhotoSelectionList';
|
import { PhotoSelectionList, type PhotoUse } from '../components/PhotoSelectionList';
|
||||||
import { StorageMeter } from '../components/StorageMeter';
|
import { StorageMeter } from '../components/StorageMeter';
|
||||||
|
import { useLayoutPreference } from '../lib/layoutPreference';
|
||||||
import { emptySelection, prune, type Selection } from '../lib/selection';
|
import { emptySelection, prune, type Selection } from '../lib/selection';
|
||||||
import { rememberHeroImagesTab, usageTarget } from '../lib/usageLabel';
|
import { rememberHeroImagesTab, usageTarget } from '../lib/usageLabel';
|
||||||
import { toPhotoItem } from '../lib/toPhotoItem';
|
import { toPhotoItem } from '../lib/toPhotoItem';
|
||||||
@@ -44,6 +45,7 @@ export function MediaLibraryPage() {
|
|||||||
const [deleting, setDeleting] = useState(false);
|
const [deleting, setDeleting] = useState(false);
|
||||||
const [purging, setPurging] = useState<'selected' | 'all' | null>(null);
|
const [purging, setPurging] = useState<'selected' | 'all' | null>(null);
|
||||||
const [filter, setFilter] = useState<UseFilter>('all');
|
const [filter, setFilter] = useState<UseFilter>('all');
|
||||||
|
const [layout, setLayout] = useLayoutPreference();
|
||||||
|
|
||||||
const source = view === 'library' ? photos : trash;
|
const source = view === 'library' ? photos : trash;
|
||||||
const items = useMemo(
|
const items = useMemo(
|
||||||
@@ -97,15 +99,27 @@ export function MediaLibraryPage() {
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{view === 'library' && (
|
<div className="flex flex-wrap items-center justify-between gap-2">
|
||||||
<div className="flex gap-2" role="group" aria-label={t('media.filter.label')}>
|
{view === 'library' ? (
|
||||||
{(['all', 'used', 'unused'] as const).map((value) => (
|
<div className="flex gap-2" role="group" aria-label={t('media.filter.label')}>
|
||||||
<Button key={value} type="button" size="sm" variant={filter === value ? 'secondary' : 'ghost'} aria-pressed={filter === value} onClick={() => setFilter(value)} data-testid={`filter-${value}`}>
|
{(['all', 'used', 'unused'] as const).map((value) => (
|
||||||
{t(`media.filter.${value}`)}
|
<Button key={value} type="button" size="sm" variant={filter === value ? 'secondary' : 'ghost'} aria-pressed={filter === value} onClick={() => setFilter(value)} data-testid={`filter-${value}`}>
|
||||||
|
{t(`media.filter.${value}`)}
|
||||||
|
</Button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<span />
|
||||||
|
)}
|
||||||
|
<div className="flex gap-1" role="group" aria-label={t('media.layout.label')}>
|
||||||
|
{([['tiles', LayoutGrid], ['list', List]] as const).map(([value, Icon]) => (
|
||||||
|
<Button key={value} type="button" size="sm" variant={layout === value ? 'secondary' : 'ghost'} aria-pressed={layout === value} onClick={() => setLayout(value)} data-testid={`layout-${value}`}>
|
||||||
|
<Icon className="mr-1.5 size-4" aria-hidden="true" />
|
||||||
|
{t(`media.layout.${value}`)}
|
||||||
</Button>
|
</Button>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
)}
|
</div>
|
||||||
|
|
||||||
{view === 'trash' && (
|
{view === 'trash' && (
|
||||||
<div className="flex flex-wrap items-center justify-between gap-3">
|
<div className="flex flex-wrap items-center justify-between gap-3">
|
||||||
@@ -128,7 +142,7 @@ export function MediaLibraryPage() {
|
|||||||
{t('media.page.noModules')}
|
{t('media.page.noModules')}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
{source.data && <PhotoSelectionList items={items} selection={selection} onSelectionChange={setSelection} renderUse={renderUse} bulk={{ actions, onClear: () => setSelection(emptySelection) }} />}
|
{source.data && <PhotoSelectionList layout={layout} items={items} selection={selection} onSelectionChange={setSelection} renderUse={renderUse} bulk={{ actions, onClear: () => setSelection(emptySelection) }} />}
|
||||||
|
|
||||||
<CleanupDialog open={cleanupOpen} onOpenChange={setCleanupOpen} />
|
<CleanupDialog open={cleanupOpen} onOpenChange={setCleanupOpen} />
|
||||||
<PurgeDialog
|
<PurgeDialog
|
||||||
|
|||||||
@@ -788,6 +788,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"media": {
|
"media": {
|
||||||
|
"layout": {
|
||||||
|
"label": "View",
|
||||||
|
"tiles": "Tiles",
|
||||||
|
"list": "List"
|
||||||
|
},
|
||||||
"progress": {
|
"progress": {
|
||||||
"working": "Processing…"
|
"working": "Processing…"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -788,6 +788,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"media": {
|
"media": {
|
||||||
|
"layout": {
|
||||||
|
"label": "Weergave",
|
||||||
|
"tiles": "Tegels",
|
||||||
|
"list": "Lijst"
|
||||||
|
},
|
||||||
"progress": {
|
"progress": {
|
||||||
"working": "Wordt verwerkt…"
|
"working": "Wordt verwerkt…"
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user