Hero-admin: schakelaar Actief, destructieve knoppen rood, slide-kopjes, juiste voorvertoning in het focusvenster, status per foto
- Schakelaar (role=switch) Actief / Niet actief bij de knoppen, gedimde rij; 'Verberg voor schermlezers'; veld 'Beschrijving' binnen een groep 'Slide N'
- Alle foto's zonder complete set tonen 'Wordt verwerkt' (voortgang bij de foto die bezig is, 'in de wachtrij' bij de rest); totaal bovenaan telt ook nog niet opgeslagen foto's
- Per foto 'Verwerking afgerond' (zelfde weergave voor een hergebruikte foto), foto direct bruikbaar; niet-opgeslagen foto's worden zelf ververst (GET /hero/images/{id}), ook in een achtergrondtab
- Focusvenster toont de hele foto (full-preview in elke set, achtergrond-aanvulling voor oude sets) in plaats van de uitgesneden wide-variant (vervorming)
- Prullenbak en 'Wijzigingen weggooien' in de destructieve stijl
- upload-respons: reused (intern)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -38,6 +38,8 @@ const percent = (fraction: number) => Math.round(fraction * 1000) / 10;
|
||||
function FocusEditor({ image, onApply, onClose }: { image: HeroImageDto; onApply: (imageId: string, request: HeroFocusRequest) => void; onClose: () => void }) {
|
||||
const { t } = useTranslation();
|
||||
const area = useRef<HTMLDivElement>(null);
|
||||
// The whole picture: image.src is already a crop of the wide shape and would be shown stretched and out of place.
|
||||
const previewUrl = image.previewSrc ? mediaUrl(image.previewSrc) : null;
|
||||
const [target, setTarget] = useState<Target>('general');
|
||||
const [general, setGeneral] = useState<FocusDto>(image.focus ?? CENTRE);
|
||||
const [wide, setWide] = useState<FocusDto | null>(image.wideFocus);
|
||||
@@ -143,7 +145,13 @@ function FocusEditor({ image, onApply, onClose }: { image: HeroImageDto; onApply
|
||||
onKeyDown={onKeyDown}
|
||||
data-testid="focus-area"
|
||||
>
|
||||
<img src={mediaUrl(image.src)} alt="" draggable={false} className="pointer-events-none absolute inset-0 h-full w-full" />
|
||||
{previewUrl ? (
|
||||
<img src={previewUrl} alt="" draggable={false} className="pointer-events-none absolute inset-0 h-full w-full object-cover" />
|
||||
) : (
|
||||
<p className="absolute inset-0 flex items-center justify-center bg-muted p-4 text-center text-sm text-muted-foreground" role="status" data-testid="focus-preview-pending">
|
||||
{t('hero.focus.previewPending')}
|
||||
</p>
|
||||
)}
|
||||
<div className="pointer-events-none absolute border-2 border-sky-400" style={outline(WIDE, effective.wide)} data-testid="focus-outline-wide" />
|
||||
<div className="pointer-events-none absolute border-2 border-amber-400" style={outline(TALL, effective.tall)} data-testid="focus-outline-tall" />
|
||||
<div
|
||||
@@ -212,8 +220,8 @@ function FocusEditor({ image, onApply, onClose }: { image: HeroImageDto; onApply
|
||||
style={{ aspectRatio: `${ratio.numerator} / ${ratio.denominator}`, maxWidth: ratio.name === 'tall' ? '8rem' : '12rem' }}
|
||||
data-testid={`focus-preview-${ratio.name}`}
|
||||
>
|
||||
<img
|
||||
src={mediaUrl(image.src)}
|
||||
{previewUrl && <img
|
||||
src={previewUrl}
|
||||
alt=""
|
||||
className="absolute max-w-none"
|
||||
style={{
|
||||
@@ -222,7 +230,7 @@ function FocusEditor({ image, onApply, onClose }: { image: HeroImageDto; onApply
|
||||
// top is a percentage of the box height, which is the box width times denominator over numerator.
|
||||
top: `${(-crop.y / crop.width) * (ratio.numerator / ratio.denominator) * 100}%`,
|
||||
}}
|
||||
/>
|
||||
/>}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user