2.3 KiB
2.3 KiB
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.