Fase 2 stap B (frontend): uitsnede per slide in het scherm, herstelpunt in het plan

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 21:51:21 +01:00
co-authored by Claude Sonnet 5.5
parent e30d885d64
commit e44ca80d1d
11 changed files with 195 additions and 54 deletions
@@ -12,6 +12,9 @@ interface CropThumbnailProps {
edit?: HeroFocusRequest;
onClick: () => void;
testId: string;
/** The crop cannot be changed now (for example the slide is not saved yet); `hint` says why. */
disabled?: boolean;
hint?: string;
}
/**
@@ -20,7 +23,7 @@ interface CropThumbnailProps {
* icon is always there, so it can be found on a touch screen as well. After "Apply" in the dialog the thumbnail shows
* the new crop right away (the same calculation as the host) with a clear "not saved yet" note.
*/
export function CropThumbnail({ image, savedSrc, edit, onClick, testId }: CropThumbnailProps) {
export function CropThumbnail({ image, savedSrc, edit, onClick, testId, disabled = false, hint }: CropThumbnailProps) {
const { t } = useTranslation();
const local = edit && image.previewSrc ? localCrop(image, edit) : null;
@@ -28,8 +31,10 @@ export function CropThumbnail({ image, savedSrc, edit, onClick, testId }: CropTh
<button
type="button"
onClick={onClick}
disabled={disabled}
title={disabled ? hint : undefined}
aria-label={t('hero.slides.cropEdit')}
className={`group relative block aspect-[3/2] w-28 shrink-0 cursor-pointer overflow-hidden rounded bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring ${edit ? 'ring-2 ring-amber-500' : ''}`}
className={`group relative block aspect-[3/2] w-28 shrink-0 ${disabled ? 'cursor-not-allowed opacity-70' : 'cursor-pointer'} overflow-hidden rounded bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring ${edit ? 'ring-2 ring-amber-500' : ''}`}
data-testid={testId}
>
{local && image.previewSrc ? (
@@ -18,9 +18,11 @@ interface FocusDialogProps {
/** Keeps the change locally: it is sent and made live when the hero is saved, and dropped when the page is left. */
onApply: (imageId: string, request: HeroFocusRequest) => void;
onClose: () => void;
/** The slide has a crop of its own: offers "use the crop of the photo again". */
onReset?: () => void;
}
export function FocusDialog({ image, onApply, onClose }: FocusDialogProps) {
export function FocusDialog({ image, onApply, onClose, onReset }: FocusDialogProps) {
const { t } = useTranslation();
return (
<Dialog open={image !== null} onOpenChange={(next) => { if (!next) onClose(); }}>
@@ -29,7 +31,7 @@ export function FocusDialog({ image, onApply, onClose }: FocusDialogProps) {
<DialogTitle>{t('hero.focus.title')}</DialogTitle>
</DialogHeader>
{/* Mounted only while open, so every opening starts from the stored values. */}
{image && <FocusEditor image={image} onApply={onApply} onClose={onClose} />}
{image && <FocusEditor image={image} onApply={onApply} onClose={onClose} onReset={onReset} />}
</DialogContent>
</Dialog>
);
@@ -37,7 +39,7 @@ export function FocusDialog({ image, onApply, onClose }: FocusDialogProps) {
const percent = (fraction: number) => Math.round(fraction * 1000) / 10;
function FocusEditor({ image, onApply, onClose }: { image: HeroImageDto; onApply: (imageId: string, request: HeroFocusRequest) => void; onClose: () => void }) {
function FocusEditor({ image, onApply, onClose, onReset }: { image: HeroImageDto; onApply: (imageId: string, request: HeroFocusRequest) => void; onClose: () => void; onReset?: () => 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.
@@ -235,7 +237,21 @@ function FocusEditor({ image, onApply, onClose }: { image: HeroImageDto; onApply
</div>
</div>
<div className="flex justify-end gap-2">
<div className="flex flex-wrap justify-end gap-2">
{onReset && (
<Button
type="button"
variant="ghost"
className="mr-auto"
onClick={() => {
onReset();
onClose();
}}
data-testid="focus-reset"
>
{t('hero.focus.reset')}
</Button>
)}
<Button type="button" variant="outline" onClick={onClose} data-testid="focus-cancel">
{t('common.cancel')}
</Button>
+28 -2
View File
@@ -58,6 +58,7 @@ export const resetMockHero = (): void => {
uploadFailure = null;
retried = [];
focusRequests = [];
resetSlideRequests = [];
recutting = new Set();
};
@@ -80,9 +81,11 @@ export const getRetriedImages = (): string[] => retried;
export const getSavedHeroRequests = (): HeroSaveRequest[] => saved;
let focusRequests: { imageId: string; body: HeroFocusRequest }[] = [];
let focusRequests: { imageId: string; slideId?: string; body: HeroFocusRequest }[] = [];
let resetSlideRequests: string[] = [];
export const getResetSlideRequests = (): string[] => resetSlideRequests;
/** The crops sent at once with PUT hero/images/{id}/focus (no save of the hero involved). */
export const getFocusRequests = (): { imageId: string; body: HeroFocusRequest }[] => focusRequests;
export const getFocusRequests = (): { imageId: string; slideId?: string; body: HeroFocusRequest }[] => focusRequests;
export const failNextUpload = (failure: { status: number; error: string; message: string } | null): void => {
uploadFailure = failure;
@@ -123,6 +126,29 @@ export const heroHandlers = [
return HttpResponse.json(hero);
}),
// A crop for one slide (crop per use): the slide gets its own crop and shows the photo as processing.
http.put(`${API_BASE}/api/v1/hero/slides/:id/focus`, async ({ params, request }) => {
const slideId = String(params.id);
const body = (await request.json()) as HeroFocusRequest;
const slide = hero.slides.find((s) => s.id === slideId);
if (!slide) return new HttpResponse(null, { status: 404 });
focusRequests.push({ imageId: slide.imageId, slideId, body });
const updated = { ...slide, ownCrop: true, image: { ...slide.image, focus: body.focus, wideFocus: body.wide ?? null, tallFocus: body.tall ?? null, processing: true } };
recutting.add(slide.imageId);
hero = { ...hero, slides: hero.slides.map((s) => (s.id === slideId ? updated : s)) };
return HttpResponse.json(updated);
}),
http.delete(`${API_BASE}/api/v1/hero/slides/:id/focus`, ({ params }) => {
const slideId = String(params.id);
const slide = hero.slides.find((s) => s.id === slideId);
if (!slide) return new HttpResponse(null, { status: 404 });
resetSlideRequests.push(slideId);
const updated = { ...slide, ownCrop: false, image: { ...slide.image, processing: false } };
hero = { ...hero, slides: hero.slides.map((s) => (s.id === slideId ? updated : s)) };
return HttpResponse.json(updated);
}),
http.put(`${API_BASE}/api/v1/hero/images/:id/focus`, async ({ params, request }) => {
const id = String(params.id);
const body = (await request.json()) as HeroFocusRequest;
@@ -5,7 +5,7 @@ import { http, HttpResponse } from 'msw';
import { server } from '@/mocks/server';
import { API_BASE } from '@/features/auth/mocks/fixtures';
import { renderApp, mockAuthenticated } from '@/test/utils';
import { emptyHero, failNextUpload, finishMockRecut, getRetriedImages, getFocusRequests,
import { emptyHero, failNextUpload, finishMockRecut, getRetriedImages, getFocusRequests, getResetSlideRequests,
getSavedHeroRequests, resetMockHero, setMockHero, slide } from '@/features/hero/mocks/handlers';
import { _resetSetupStatusCache } from '@/router';
@@ -308,7 +308,7 @@ describe('Focus dialog', () => {
await waitFor(() => expect(screen.queryByTestId('focus-dialog')).not.toBeInTheDocument());
await waitFor(() => expect(getFocusRequests()).toHaveLength(1));
expect(getFocusRequests()[0]).toEqual({
expect(getFocusRequests()[0]).toMatchObject({
imageId: '10000000-0000-0000-0000-000000000001',
body: { focus: { x: 0.3, y: 0.5, zoom: 1 }, wide: null, tall: { x: 0.8, y: 0.5, zoom: 2 } },
});
@@ -908,7 +908,7 @@ describe('Each photo shows by itself when its processing is finished', () => {
expect(screen.getByTestId('hero-slide-0-done')).toHaveAttribute('role', 'status');
expect(screen.getByTestId('hero-slide-0-done')).toHaveAttribute('aria-live', 'polite');
expect(screen.queryByTestId('hero-slide-0-processing')).not.toBeInTheDocument();
expect(screen.getByTestId('hero-slide-0-focus')).toBeEnabled();
expect(screen.getByTestId('hero-slide-0-focus')).toBeInTheDocument(); // the crop button is there (disabled until the slide is saved)
// The note names the slide for a screen reader, and goes away by itself after a few seconds.
expect(note.textContent).toMatch(/Slide 1: (verwerking afgerond|processing finished)/);
await waitFor(() => expect(screen.queryByTestId('hero-slide-0-done-text')).not.toBeInTheDocument(), { timeout: 8000 });
@@ -923,7 +923,7 @@ describe('Each photo shows by itself when its processing is finished', () => {
expect(await screen.findByTestId('hero-slide-0-done-text', {}, T)).toHaveTextContent(/Verwerking afgerond|Processing finished/);
expect(screen.queryByTestId('hero-slide-0-processing')).not.toBeInTheDocument();
expect(screen.getByTestId('hero-slide-0-focus')).toBeEnabled();
expect(screen.getByTestId('hero-slide-0-focus')).toBeInTheDocument(); // the crop button is there (disabled until the slide is saved)
expect(screen.queryByText(/stond al|already/i)).not.toBeInTheDocument();
});
@@ -981,7 +981,7 @@ describe('Each photo shows by itself when its processing is finished', () => {
finished.add(ids[0]);
await screen.findByTestId('hero-slide-0-done-text', {}, { timeout: 12000 });
expect(screen.getByTestId('hero-slide-0-focus')).toBeEnabled();
expect(screen.getByTestId('hero-slide-0-focus')).toBeInTheDocument(); // the crop button is there (disabled until the slide is saved)
expect(screen.getByTestId('hero-slide-1-processing')).toBeInTheDocument();
expect(screen.queryByTestId('hero-slide-1-focus')).not.toBeInTheDocument();
expect(screen.getByTestId('hero-processing-count')).toHaveTextContent(/1 van 2|1 of 2/);
@@ -1296,15 +1296,57 @@ describe('Add a slide with a photo from the library or an upload', () => {
expect(getSavedHeroRequests()[0].slides.map((x) => x.imageId)).toEqual(['10000000-0000-0000-0000-000000000001', '10000000-0000-0000-0000-000000000002', '10000000-0000-0000-0000-000000000002']);
});
it('tells that the crop is shared when the same photo is in more than one slide', async () => {
it('gives every slide its own crop: the same photo on two slides is cropped per slide', async () => {
const one = slide(1);
setMockHero({ ...emptyHero(), id: 'h1', title: 'T', slides: [one, { ...slide(2), imageId: one.imageId, image: one.image }, slide(3)] });
setMockHero({ ...emptyHero(), id: 'h1', title: 'T', slides: [one, { ...slide(2), imageId: one.imageId, image: one.image }] });
await openPage();
expect(screen.getByTestId('hero-slide-0-shared-crop')).toBeInTheDocument();
expect(screen.getByTestId('hero-slide-1-shared-crop')).toBeInTheDocument();
expect(screen.queryByTestId('hero-slide-2-shared-crop')).not.toBeInTheDocument();
await userEvent.click(screen.getByTestId('hero-slide-1-focus'));
await screen.findByTestId('focus-dialog');
fireEvent.change(screen.getByTestId('focus-x'), { target: { value: '20' } });
await userEvent.click(screen.getByTestId('focus-save'));
await waitFor(() => expect(getFocusRequests()).toHaveLength(1));
expect(getFocusRequests()[0].slideId).toBe(slide(2).id);
expect(await screen.findByTestId('hero-slide-1-recut', {}, T)).toBeInTheDocument();
expect(screen.getByTestId('hero-slide-0-focus')).toBeInTheDocument();
expect(screen.queryByTestId('hero-slide-0-recut')).not.toBeInTheDocument();
expect(screen.queryByTestId('hero-slide-0-shared-crop')).not.toBeInTheDocument();
});
it('offers to go back to the crop of the photo for a slide with a crop of its own', async () => {
const one = slide(1);
setMockHero({ ...emptyHero(), id: 'h1', title: 'T', slides: [{ ...one, ownCrop: true }, slide(2)] });
await openPage();
await userEvent.click(screen.getByTestId('hero-slide-0-focus'));
await screen.findByTestId('focus-dialog');
await userEvent.click(screen.getByTestId('focus-reset'));
await waitFor(() => expect(getResetSlideRequests()).toEqual([one.id]));
});
it('does not offer the reset for a slide that uses the crop of its photo', async () => {
setMockHero({ ...emptyHero(), id: 'h1', title: 'T', slides: [slide(1)] });
await openPage();
await userEvent.click(screen.getByTestId('hero-slide-0-focus'));
await screen.findByTestId('focus-dialog');
expect(screen.queryByTestId('focus-reset')).not.toBeInTheDocument();
});
it('asks to save a new slide first before its crop can be changed', async () => {
setMockHero({ ...emptyHero(), id: 'h1', title: 'T', slides: [slide(1)] });
server.use(http.get('*/media-library/photos', () => HttpResponse.json({ photos: [], modules: ['hero'] })));
await openPage();
await userEvent.click(screen.getByTestId('hero-upload-button'));
const dialog = await screen.findByTestId('library-picker', {}, T);
await userEvent.upload(within(dialog).getByTestId('picker-file'), new File([new Uint8Array(100)], 'nieuw.jpg', { type: 'image/jpeg' }));
await waitFor(() => expect(screen.queryByTestId('library-picker')).not.toBeInTheDocument());
expect(await screen.findByTestId('hero-slide-1-save-first')).toBeInTheDocument();
expect(screen.queryByTestId('hero-slide-0-save-first')).not.toBeInTheDocument();
});
it('uploads a new photo on the spot with the hero upload and puts it in the slide', async () => {
+52 -23
View File
@@ -1,4 +1,4 @@
import { useEffect, useMemo, useRef, useState } from 'react';
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { useQueries, useQueryClient } from '@tanstack/react-query';
import { useFieldArray, useForm, useWatch } from 'react-hook-form';
import { zodResolver } from '@hookform/resolvers/zod';
@@ -27,7 +27,7 @@ import { UnsavedChangesGuard } from '../components/UnsavedChangesGuard';
import { UploadProgress, type UploadItem } from '../components/UploadProgress';
import { mediaUrl } from '../lib/media';
import { heroFormSchema, type HeroFormData } from '../schemas/hero';
import { heroImageQuery, useHero, useHeroUploadLimits, useSaveHero, useSetHeroImageFocus, useUploadHeroImage } from '../services/hooks';
import { heroImageQuery, useHero, useHeroUploadLimits, useResetSlideFocus, useSaveHero, useSetSlideFocus, useUploadHeroImage } from '../services/hooks';
import type { HeroAdminDto, HeroFocusRequest, HeroImageDto, HeroSaveRequest } from '../services/types';
const textareaClass =
@@ -147,9 +147,11 @@ function HeroEditor({ hero }: { hero: HeroAdminDto }) {
const nextUploadKey = useRef(0);
const limits = useHeroUploadLimits().data;
const [localImages, setLocalImages] = useState<Record<string, HeroImageDto>>({});
const [focusImageId, setFocusImageId] = useState<string | null>(null);
// The slide whose crop is being edited (a crop belongs to the slide, not to the photo).
const [focusSlideIndex, setFocusSlideIndex] = useState<number | null>(null);
// A new crop is applied at once (no save needed): the server cuts the new variants in the background.
const setImageFocus = useSetHeroImageFocus();
const setSlideFocus = useSetSlideFocus();
const resetSlideFocus = useResetSlideFocus();
// The photos of the current upload batch, for the counter "x of y processed": only the photos uploaded together, not
// every photo of the hero. A new batch starts when the previous one is finished.
const [batch, setBatch] = useState<string[]>([]);
@@ -168,7 +170,8 @@ function HeroEditor({ hero }: { hero: HeroAdminDto }) {
reset,
} = useForm<HeroFormData>({ resolver: zodResolver(heroFormSchema), mode: 'onTouched', shouldFocusError: false, defaultValues: toForm(hero) });
const slides = useFieldArray({ control, name: 'slides' });
const watchedSlides = useWatch({ control, name: 'slides' }) ?? [];
const watchedSlidesRaw = useWatch({ control, name: 'slides' });
const watchedSlides = useMemo(() => watchedSlidesRaw ?? [], [watchedSlidesRaw]);
// The two tabs share one form, one Save button and one "unsaved changes" state. The chosen tab is remembered for this
// browser session.
@@ -219,10 +222,24 @@ function HeroEditor({ hero }: { hero: HeroAdminDto }) {
const images = useMemo(() => {
const map: Record<string, HeroImageDto> = { ...localImages };
for (const image of polled) if (image) map[image.id] = image;
for (const s of hero.slides) map[s.imageId] = s.image;
// A slide with a crop of its own shows another version of the photo: it never replaces the photo's own entry.
for (const s of hero.slides) if (!s.ownCrop || !(s.imageId in map)) map[s.imageId] = s.image;
return map;
}, [hero.slides, localImages, polled]);
// The photo as a slide shows it: for a saved slide the server's version (its own crop and set), else the photo itself.
const savedSlideOf = useCallback(
(index: number) => {
const id = watchedSlides[index]?.id;
return id ? hero.slides.find((s) => s.id === id && s.imageId === watchedSlides[index]?.imageId) : undefined;
},
[watchedSlides, hero.slides],
);
const imageOfSlide = useCallback(
(index: number): HeroImageDto | undefined => savedSlideOf(index)?.image ?? images[watchedSlides[index]?.imageId ?? slides.fields[index]?.imageId ?? ''],
[savedSlideOf, images, watchedSlides, slides.fields],
);
// Per photo: when its processing is done it shows "Processing finished" for a few seconds, and can be worked on at once.
// A photo that was ready at once (the same photo was already in the CMS) shows the same note, without a placeholder.
const [justDone, setJustDone] = useState<Record<string, true>>({});
@@ -238,7 +255,7 @@ function HeroEditor({ hero }: { hero: HeroAdminDto }) {
};
useEffect(() => {
for (const field of slides.fields) {
const image = images[field.imageId];
const image = imageOfSlide(slides.fields.indexOf(field));
if (!image) continue;
if (image.processing) {
wasProcessing.current[image.id] = true;
@@ -247,7 +264,7 @@ function HeroEditor({ hero }: { hero: HeroAdminDto }) {
markDone(image.id);
}
}
}, [images, slides.fields]);
}, [images, slides.fields, imageOfSlide]);
// The form is compared with the last saved state (react-hook-form keeps it), so a change that is undone no longer counts.
// Photos still being prepared on the server and the background refresh are not changes of the administrator.
@@ -286,15 +303,16 @@ function HeroEditor({ hero }: { hero: HeroAdminDto }) {
}
};
// A new crop goes to the server at once; the page then shows the photo as processing until the new variants are ready.
const applyFocus = (imageId: string, request: HeroFocusRequest) => {
// A new crop for ONE slide goes to the server at once; the slide then shows its photo as processing until its own variants are ready.
const applyFocus = (slideIndex: number, request: HeroFocusRequest) => {
const slideId = watchedSlides[slideIndex]?.id;
if (!slideId) return;
setServerError(null);
setImageFocus.mutate(
{ imageId, request },
setSlideFocus.mutate(
{ slideId, request },
{
onSuccess: (image) => {
setLocalImages((current) => ({ ...current, [image.id]: image }));
setRecutIds((current) => [...new Set([...current, image.id])]);
onSuccess: (slide) => {
setRecutIds((current) => [...new Set([...current, slide.imageId])]);
},
onError: (error) => setServerError(serverMessage(error, t('errors.generic'), t('errors.network'))),
},
@@ -552,7 +570,8 @@ function HeroEditor({ hero }: { hero: HeroAdminDto }) {
<SortableContext items={slides.fields.map((f) => f.id)} strategy={verticalListSortingStrategy}>
<ol className="space-y-3" data-testid="hero-slides">
{slides.fields.map((field, index) => {
const image = images[field.imageId];
const image = imageOfSlide(index);
const savedSlide = savedSlideOf(index);
const decorative = watchedSlides[index]?.decorative ?? false;
return (
<SortableSlide key={field.id} id={field.id} index={index} dimmed={!(watchedSlides[index]?.isActive ?? true)}>
@@ -565,16 +584,18 @@ function HeroEditor({ hero }: { hero: HeroAdminDto }) {
<CropThumbnail
image={image}
savedSrc={thumbnail(image)}
onClick={() => setFocusImageId(field.imageId)}
onClick={() => setFocusSlideIndex(index)}
testId={`hero-slide-${index}-focus`}
disabled={!savedSlide}
hint={t('hero.slides.saveFirst')}
/>
) : (
<div className="flex h-20 w-28 items-center justify-center rounded bg-muted text-xs">?</div>
)}
<DoneStatus done={Boolean(image && justDone[image.id] && !image.processing)} slideNumber={index + 1} testId={`hero-slide-${index}-done`} />
{watchedSlides.some((other, otherIndex) => otherIndex !== index && other?.imageId === field.imageId) && (
<p className="max-w-28 text-xs text-muted-foreground" data-testid={`hero-slide-${index}-shared-crop`}>
{t('hero.library.sharedCrop')}
{!savedSlide && (
<p className="max-w-28 text-xs text-muted-foreground" data-testid={`hero-slide-${index}-save-first`}>
{t('hero.slides.saveFirst')}
</p>
)}
</div>
@@ -666,9 +687,17 @@ function HeroEditor({ hero }: { hero: HeroAdminDto }) {
limitsText={limits ? t('hero.slides.limits', { formats: limits.formats.join(', '), size: Math.round(limits.maxUploadBytes / (1024 * 1024)), megapixels: limits.maxMegapixels }) : undefined}
/>
<FocusDialog
image={focusImageId ? images[focusImageId] ?? null : null}
onApply={applyFocus}
onClose={() => setFocusImageId(null)}
image={focusSlideIndex !== null ? imageOfSlide(focusSlideIndex) ?? null : null}
onApply={(_imageId, request) => focusSlideIndex !== null && applyFocus(focusSlideIndex, request)}
onClose={() => setFocusSlideIndex(null)}
onReset={
focusSlideIndex !== null && savedSlideOf(focusSlideIndex)?.ownCrop
? () => {
const slideId = watchedSlides[focusSlideIndex]?.id;
if (slideId) resetSlideFocus.mutate(slideId, { onError: (error) => setServerError(serverMessage(error, t('errors.generic'), t('errors.network'))) });
}
: undefined
}
/>
</form>
);
+18 -1
View File
@@ -1,6 +1,6 @@
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
import { api } from '@/lib/api-client';
import type { HeroAdminDto, HeroFocusRequest, HeroImageDto, HeroSaveRequest, HeroUploadLimits } from './types';
import type { HeroAdminDto, HeroFocusRequest, HeroImageDto, HeroSaveRequest, HeroSlideAdminDto, HeroUploadLimits } from './types';
export const HERO_KEY = ['hero'];
@@ -73,6 +73,23 @@ export const heroImageQuery = (imageId: string) => ({
* A new crop for an image, applied at once without saving the hero (Bryan, 2026-11-17): the server cuts the new variants
* in the background and the image switches to them when they are complete. The answer is the image, now processing.
*/
export function useSetSlideFocus() {
const queryClient = useQueryClient();
return useMutation<HeroSlideAdminDto, Error, { slideId: string; request: HeroFocusRequest }>({
mutationFn: ({ slideId, request }) => api.put<HeroSlideAdminDto>(`/api/v1/hero/slides/${slideId}/focus`, request),
onSuccess: () => queryClient.invalidateQueries({ queryKey: HERO_KEY }),
});
}
/** Takes the slide's own crop away: it uses the crop of its photo again. */
export function useResetSlideFocus() {
const queryClient = useQueryClient();
return useMutation<HeroSlideAdminDto, Error, string>({
mutationFn: (slideId) => api.delete<HeroSlideAdminDto>(`/api/v1/hero/slides/${slideId}/focus`),
onSuccess: () => queryClient.invalidateQueries({ queryKey: HERO_KEY }),
});
}
export function useSetHeroImageFocus() {
const queryClient = useQueryClient();
return useMutation<HeroImageDto, Error, { imageId: string; request: HeroFocusRequest }>({
@@ -48,7 +48,10 @@ export interface HeroSlideAdminDto {
decorative: boolean;
isActive: boolean;
sortOrder: number;
/** The photo as THIS slide shows it (its own crop and set when `ownCrop`); its id is always the photo's id. */
image: HeroImageDto;
/** The slide has a crop of its own (crop per use); otherwise it uses its photo's crop. */
ownCrop?: boolean;
}
export interface HeroAdminDto {