Hero: een gewijzigd focuspunt geldt pas bij het opslaan van de hero (Bryan); het focus-venster houdt de wijziging lokaal

Het eindpunt PUT /hero/images/{id}/focus is vervallen; de focus gaat mee in de opslag (imageFocus) en de varianten worden dan in nieuwe bestanden opnieuw gesneden.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-16 20:05:17 +01:00
co-authored by Claude Sonnet 5.5
parent 01703ccddf
commit 0b56fa6294
20 changed files with 318 additions and 197 deletions
@@ -4,7 +4,7 @@ Kept while Bryan was away (2026-11-16): no questions to him, a likely assumption
| # | Question | Assumption made | If Bryan chooses differently | Where |
|---|---|---|---|---|
| 1 | Does a change of the **focus** of an image that is already live take effect at once? | Yes. Saving is publishing (Q11 = A) and the images are shared, so a new focus re-cuts the variants and the live page shows them within the cache time. | Add a draft step for images (focus applies when the hero is saved), or a confirmation in the focus dialog. | `HeroImageService.SetFocusAsync`; `FocusDialog.tsx` |
| 1 | Does a change of the **focus** of an image that is already live take effect at once? | **Decided by Bryan (2026-11-16): no, only when the hero is saved.** The admin keeps it locally (Apply in the focus dialog), sends it with the save (`imageFocus`), the host then cuts the variants again into new files and saves hero and images together; leaving the page drops it. | n/a | `HeroSaveRequest.ImageFocus`, `HeroService.SaveAsync`, `HeroImageService.StageFocusAsync`, `FocusDialog.tsx`, `HeroPage.tsx` |
| 2 | Is a photo uploaded but never put in a slide cleaned up, and when? | Yes, after the same 7 days as retired files (Bryan decided 7 days for old files; extended to unused uploads). | Another period, or never (then storage grows). | `HeroMediaCleanup` (step 1), `Media:RetentionDays` |
| 3 | Should an uploaded photo that is **identical** to an existing one be a new image? | No: same bytes = same image (and a re-upload repairs lost files). | Always a new image: drop the SHA-256 unique index and the lookup. | `HeroImageService.UploadAsync`, `HeroDbContext` (unique `OriginalSha256`) |
| 4 | Is the **alt text** per slide or per photo? | Per slide (the same photo may carry another description in another place). | Per photo: move `Alt` and `Decorative` from `HeroSlide` to `HeroImage`. | `HeroSlide`, `HeroSaveRequest`, `HeroPage.tsx` |
@@ -16,7 +16,7 @@ Kept while Bryan was away (2026-11-16): no questions to him, a likely assumption
| 10 | Is **AVIF** used on the page? | Only for slides 2 and up on the client; the first image and the preload are WebP only (ASF: a preload cannot say AVIF if supported). | Add `<source type="image/avif">` before the WebP source and a second preload per format (costs a double download in some browsers). | `HeroPictureRenderer` |
| 11 | Who may use the Hero screen? | Owner and Administrator, like Offerings. | Owner only: change the route and nav roles. | `router.tsx`, `Sidebar.tsx`, `[Authorize(Policy = "AdminOnly")]` |
| 12 | Upload limits. | 10 MB per file, 64 megapixels, at most 20 uploads per user per hour, 2 images processed at once, 2 GB in total. The proxy allows 15 MB (Bryan). | Other limits via `Media__*` and `RateLimiting__HeroUpload`; a higher file limit also needs the proxy limit. | `MediaOptions`, `ServiceCollectionExtensions` (policy `hero-upload`) |
| 13 | Can the admin **delete an image** itself? | No button: removing it from the hero is enough; unused images go after 7 days. The API (`DELETE /hero/images/{id}`, 409 while in use) exists. | Add a media library screen with delete. | `HeroImagesController.Delete`, `HeroPage.tsx` |
| 13 | Can the admin **delete an image** itself? | **Decided: no button**; replacing the image of a slide or removing the slide is enough; unused photos go after 7 days. The API (`DELETE /hero/images/{id}`, 409 while in use) exists. | Add a media library screen with delete. | `HeroImagesController.Delete`, `HeroPage.tsx` |
| 14 | Wording of the **messages** (Dutch), for example the focus dialog and the validation texts. | My wording; the admin has nl and en. | Edit the texts. | `frontend/src/i18n/locales/*/translation.json` (`hero.*`), `SlpModularCms.Modules.Hero/Texts/*.json` |
| 15 | The **button target** rules. | The CMS accepts only `#anchor` (letters, digits, `-`, `_`, starting with a letter), `/path` (no `//`, no spaces) or `https://host/...`; the page renderer is a little wider (ASF rules) because it also copes with data it did not check. | Allow `mailto:` or `tel:` (add to both validators and the renderer, and agree it with the sites). | `ButtonTargetValidator`, `schemas/hero.ts`, `HeroPictureRenderer.IsButtonTarget` |
| 16 | Maximum **published** slides. | 50, a safety ceiling (not an administrator limit). | Another number or a hard limit shown in the admin. | `HeroOptions.MaxPublishedSlides` |