WIP: bulkbalk boven de lijst, definitief verwijderen en prullenbak legen, uitsnede direct zonder opslaan, teller per batch

This commit is contained in:
2026-11-17 16:58:23 +01:00
parent 8ad071da1c
commit 1384cafa7b
28 changed files with 816 additions and 134 deletions
@@ -112,25 +112,44 @@ export function PhotoPlaceholder({ failed, testId, step }: { failed: boolean; te
}
/**
* The photo of a slide whose crop is being made again (a changed focus point): the old picture stays visible underneath,
* with the same calm shimmer and a short text, so it is clear that the change is not on the website yet.
* The photo of a slide whose crop is being made again (a new crop): the old picture stays visible underneath, with one
* short, readable line ("Wordt verwerkt…"), a progress bar from 0 to 100 percent and the percentage. No spinner, so it also
* works without motion. A new crop needs no save: it goes live by itself when the new variants are complete.
*/
export function RecutThumbnail({ src, failed, testId, step }: { src: string; failed: boolean; testId: string; step?: { done: number; total: number } | null }) {
const { t } = useTranslation();
const percent = step && step.total > 0 ? Math.min(100, Math.round((step.done / step.total) * 100)) : 0;
return (
<div
className={`relative h-20 w-28 shrink-0 overflow-hidden rounded ${failed ? 'ring-2 ring-destructive' : 'hero-shimmer'}`}
role="status"
aria-busy={!failed}
title={t('hero.slides.recutHint')}
data-testid={testId}
>
<div className={`relative h-20 w-28 shrink-0 overflow-hidden rounded ${failed ? 'ring-2 ring-destructive' : ''}`} title={t('hero.slides.recutHint')} data-testid={testId}>
<img src={src} alt="" className="h-full w-full object-cover" />
<span className={`absolute inset-x-0 bottom-0 flex items-center justify-center gap-1 px-1 py-0.5 text-center text-[10px] leading-tight ${failed ? 'bg-destructive text-destructive-foreground' : 'bg-background/85 text-foreground'}`}>
{failed ? null : <Spinner className="size-3" />}
<span>{failed ? t('hero.slides.failed') : t('hero.slides.recut')}</span>
{!failed && step ? <span className="tabular-nums opacity-80" data-testid={`${testId}-step`}>{step.done}/{step.total}</span> : null}
</span>
<div
className={`absolute inset-x-0 bottom-0 space-y-1 px-1.5 py-1 text-xs ${failed ? 'bg-destructive text-destructive-foreground' : 'bg-background text-foreground'}`}
role="status"
aria-busy={!failed}
>
{failed ? (
<span>{t('hero.slides.failed')}</span>
) : (
<>
<div className="flex items-center justify-between gap-1">
<span data-testid={`${testId}-text`}>{t('hero.slides.processing')}</span>
<span className="tabular-nums" data-testid={`${testId}-percent`}>{percent}%</span>
</div>
<div
role="progressbar"
aria-label={t('hero.slides.processing')}
aria-valuemin={0}
aria-valuemax={100}
aria-valuenow={percent}
aria-valuetext={`${percent}%`}
className="h-1.5 w-full overflow-hidden rounded bg-muted"
data-testid={`${testId}-bar`}
>
<div className="h-full bg-primary transition-all motion-reduce:transition-none" style={{ width: `${percent}%` }} />
</div>
</>
)}
</div>
</div>
);
}