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
+16 -1
View File
@@ -1,6 +1,6 @@
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
import { api } from '@/lib/api-client';
import type { HeroAdminDto, HeroImageDto, HeroSaveRequest, HeroUploadLimits } from './types';
import type { HeroAdminDto, HeroFocusRequest, HeroImageDto, HeroSaveRequest, HeroUploadLimits } from './types';
export const HERO_KEY = ['hero'];
@@ -68,3 +68,18 @@ export const heroImageQuery = (imageId: string) => ({
refetchInterval: (query: { state: { data?: HeroImageDto } }) => (query.state.data?.processing ? 5000 : false),
refetchIntervalInBackground: true,
});
/**
* 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 useSetHeroImageFocus() {
const queryClient = useQueryClient();
return useMutation<HeroImageDto, Error, { imageId: string; request: HeroFocusRequest }>({
mutationFn: ({ imageId, request }) => api.put<HeroImageDto>(`/api/v1/hero/images/${imageId}/focus`, request),
onSuccess: (image) => {
queryClient.setQueryData(['hero', 'image', image.id], image);
return queryClient.invalidateQueries({ queryKey: HERO_KEY });
},
});
}