H5: admin-scherm voor de hero (formulier, slides, upload, focus-editor met voorbeeld, TypeScript-tweeling van FocusMath)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-16 16:07:49 +01:00
co-authored by Claude Sonnet 5.5
parent 4369c905cd
commit 5559d459c3
21 changed files with 1635 additions and 15 deletions
@@ -53,7 +53,7 @@
- [x] NFR Requirements (construction/nfr-requirements/)
- [x] NFR Design (construction/nfr-design/)
- [x] Infrastructure Design (media directory; construction/infrastructure-design/)
- [ ] Code Generation - per unit: H0, H1, H2, H3, H4 done; H5 (admin) and H6 (seed, docs, smoke) open
- [ ] Code Generation - per unit: H0 to H5 done; H6 (seed, docs, smoke, LCP measure) open
- [ ] Build and Test - EXECUTE
### 🟡 OPERATIONS PHASE
- [ ] SKIP (Q19 = B; points go into the joint production checklist)
@@ -0,0 +1,20 @@
# H5 Admin frontend: code summary
Built 2026-11-16 on `feature/hero-module`. Frontend: 604 of 604 tests pass (73 new), `tsc` and `eslint` are clean.
| Area | What |
|---|---|
| Navigation | route `/hero` (Owner and Administrator, module `Hero`), sidebar item "Hero", nl and en texts under `hero.*` |
| Screen | `features/hero/pages/HeroPage.tsx`: live or not-live badge (only a badge, Bryan, Q5), title (new line = line break, 5 lines), tagline, lead, display (single or slideshow), two buttons with label and target, schedule (on or off, from, until), slide list |
| Slides | upload (file picker, the server messages on refusal), alt text per slide or decorative, on or off, up and down, remove from the hero, a note when there are more slides than the publication ceiling; the number of slides has no limit in the screen |
| Focus | `FocusDialog`: the photo with a draggable and keyboard-movable focus point (arrow keys, Shift for bigger steps), numeric X and Y, a zoom slider, a general setting plus an optional own setting for the wide and the tall display with a reset, outlines of both crops on the photo and live previews of the two crops |
| Maths | `lib/focusMath.ts` is the twin of the host `FocusMath` (round half up); its tests use the same vectors as the C# tests plus a random check that the crop stays inside the image and holds the focus point |
| Validation | `schemas/hero.ts` (zod): title, tagline, lead, buttons (both or neither, target allow-list twin of the host validator, tested with the same cases), alt text unless decorative, schedule order; error texts are i18n keys in both languages |
| Client | `ApiClient` sends `FormData` as is (multipart upload) |
| Safety | unsaved changes trigger the browser warning when leaving |
| Tests | form, validation, navigation, saving, reorder, remove, switch off, decorative, upload and refused upload, ceiling note, focus dialog (stored values, keyboard, general plus own tall setting, reset, cancel), the shared maths vectors, the target validator cases |
## Notes
- Uploaded images that are never saved into a slide are removed by the host clean-up after 7 days; the screen has no separate delete for an image.
- Changing the focus of an image that is live changes the live hero at once (the images are shared by the hero), as the host re-cuts the variants.