Variant E (tijdreis): vijf tijdperken, 2006-pakketten, 1989-terminalformulier en tests

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-10 18:56:38 +01:00
co-authored by Claude Sonnet 5.5
parent 00f6f0653b
commit 4d9abd695d
25 changed files with 2032 additions and 45 deletions
@@ -5,7 +5,7 @@
- **Feature Slug**: redesign-modern-timetravel
- **Project Type**: Brownfield
- **Start Date**: 2026-11-09T13:00:00Z
- **Current Stage**: CONSTRUCTION - U4 contact-form Code Generation (awaiting approval)
- **Current Stage**: CONSTRUCTION - U5 e-timetravel code complete (awaiting user review on test)
- **Branch**: feature/redesign-modern-timetravel
## Workspace State
@@ -778,3 +778,63 @@
**Context**: Interim test feedback.
---
## U4 Approved; U5 Started
**Timestamp**: 2026-11-11T15:00:00Z
**User Input**: "Dat is goed. Akkoord en ga verder" (after the card-title fix on mobile, run 651 deployed to test)
**AI Response**: "U4 (contact-form) code approved. Starting U5 e-timetravel: Functional Design is skipped per the execution plan (design exists); NFR Requirements and NFR Design written from the canvas files Tijdreis2.dc.html and PakkettenTijd.dc.html; Infrastructure Design skipped (no infra impact)."
**Context**: Construction U5.
---
## U5 NFR Requirements and NFR Design Written
**Timestamp**: 2026-11-11T15:30:00Z
**User Input**: "(none)"
**AI Response**: "Wrote construction/e-timetravel/nfr-requirements/{nfr-requirements.md (NFR-U5-1..9), tech-stack-decisions.md} and nfr-design/{nfr-design-patterns.md, logical-components.md}. No questions were needed: all decisions follow the canvas and earlier approved rules (lazy chunk, fonts only in the E chunk, reduced motion, contrast tests, reuse of shared logic). Combined completion message presented."
**Context**: U5 NFR stages; next the Code Generation plan.
---
## U5 Code Generation Plan Presented
**Timestamp**: 2026-11-11T15:45:00Z
**User Input**: "(none)"
**AI Response**: "Wrote construction/plans/e-timetravel-code-generation-plan.md (14 steps). Awaiting explicit approval."
**Context**: U5 Code Generation, Part 1 Planning.
---
## U5 Plan Approved; PR #12 Merge Approved
**Timestamp**: 2026-11-11T16:10:00Z
**User Input**: "Ja, mergen" (PR #12, after measurement run 642) and "Akkoord, bouwen" (U5 code generation plan)
**AI Response**: "Asked CMS & API to merge PR #12 only. Starting U5 code generation."
**Context**: U5 Code Generation Part 2.
---
## U5 Code Generation Complete
**Timestamp**: 2026-11-11T17:30:00Z
**User Input**: "(none)"
**AI Response**: "Built variant E (five eras, terminal form, 2006 packages), 304 tests green, lint and build OK. Committing, pushing and test-deploying (deploy_test only)."
**Context**: U5 Code Generation Part 2 finished.
---
@@ -0,0 +1,13 @@
# Code Summary — e-timetravel (U5)
All new code in `src/variants/e/`:
- `LandingE.tsx` (own skip link, header, `main#main`, footer), `ENav.tsx`
- `Era2026.tsx` hero, `Era2013.tsx` about, `Era2006.tsx` packages (shared `usePackagesQuery`, `usePackageFilter`, `useSwipeRow`, `useContactPreselect`, B's `SwipeDots`), `Era1998.tsx` process, `Era1989.tsx` contact + `TerminalForm.tsx` (shared `useContactForm`, `useContactAvailability`)
- `eraTokens.ts` (light/dark CSS variables + contrast pairs), `era.css` (effects, bevels, gloss, dither, scanlines; motion off under reduced motion), `fonts.ts` (Open Sans, VT323 — E chunk only), `eraContent.ts` (E-only strings)
- Tests: `__tests__/eraTokens.test.ts` (WCAG contrast, both modes), `__tests__/LandingE.test.tsx` (landmarks, headings, packages, filter, preselect, steps, mailto fallback, terminal form send/errors, decorative aria-hidden). `VariantRenderer.test.tsx` updated for the real E landing.
Results: lint 0 errors (2 pre-existing warnings); 21 files / 304 tests pass; build OK. E chunk JS 24.9 kB (7.8 kB gzip), E CSS 56 kB (24.5 kB gzip, mostly @font-face rules); main JS 468.5 kB (152.1 kB gzip), unchanged.
Deviations from the canvas (accessibility): glossy red tops and the green "Klaar!" header are slightly darker for contrast; the form has the fixed contract fields (name, e-mail, subject, message) instead of the canvas fields (soort/telefoon); star badge text is real text.
Observation (B and E, not changed): `useContactForm` applies a package preselect only while the form is mounted. A card click before the form has mounted (it mounts when the contact section nears the viewport) is not applied.
@@ -0,0 +1,24 @@
# Logical Components — e-timetravel (U5)
```mermaid
graph TD
le[LandingE] --> nav[ENav with toggles]
le --> s26[Era 2026 hero]
le --> s13[Era 2013 about]
le --> s06[Era 2006 packages]
le --> s98[Era 1998 process]
le --> dith[Dither strips]
le --> s89[Era 1989 terminal contact]
s06 --> shared[usePackagesQuery usePackageFilter useSwipeRow]
s89 --> form[useContactForm and availability]
s98 --> marq[Marquee static under reduced motion]
le -.styles.-> css[era.css and e fonts]
classDef ui fill:#2196F3,stroke:#0d47a1,color:#000;
classDef hook fill:#9C27B0,stroke:#4a148c,color:#000;
classDef style fill:#FF9800,stroke:#e65100,color:#000;
class le,nav,s26,s13,s06,s98,dith,s89,marq ui;
class shared,form hook;
class css style;
```
Text alternative: the lazy E landing contains a nav and five era sections plus dither strips; the 2006 and 1989 sections reuse the shared packages and form logic, and the E chunk brings its own CSS and fonts.
@@ -0,0 +1,18 @@
# NFR Design Patterns — e-timetravel (U5)
| Pattern | Where | Purpose |
|---|---|---|
| Chunk isolation | `src/variants/e` + `loadVariant` | E code, fonts and CSS load only when the visitor chooses E |
| Era tokens | `era.css` | one set of variables per era and mode; components use `var(--e-...)` so light/dark needs no component logic |
| Decorative vs content | era badges, marquee, dither, scanlines, bevel numbers | `aria-hidden` and `pointer-events: none`; real content never depends on them |
| Reduced-motion switch | `usePrefersReducedMotion` + CSS media query | marquee renders as a static line, caret and scanlines static; no `animation` property remains |
| Shared logic, separate skin | packages and form | the same hooks as B with era-specific markup and styles |
| Focus integrity | every era | era styles never set `outline: none` without a replacement; `:focus-visible` ring uses the era text colour |
| Fallback fonts | font stacks | text stays readable before fonts load (swap), widths comparable to avoid layout shift |
| Contrast by construction | token test | all text/background pairs of the E token sets are asserted ≥ 4.5:1 (≥ 3:1 for large display text) |
## Misuse / robustness scenarios
1. Visitor with reduced motion switches to E: no moving content (marquee, caret, scanlines) and no dither transition (U1 rule).
2. Screen-reader user switches to E: the live region announces the new variant; era badges and glyphs are ignored; headings keep a logical order.
3. Slow network: the E chunk or its fonts fail to load: U1 falls back to B with an alert; if only a font fails, system fallbacks keep the text readable.
4. Dark mode in the 1998 section: bevel and paper colours come from the dark token set (no light-only hard-coded colours).
@@ -0,0 +1,18 @@
# NFR Requirements — e-timetravel (U5)
Source design: canvas `Tijdreis2.dc.html` (light/dark via `Tijdreis2Dark`) and `PakkettenTijd.dc.html`. Functional Design is skipped (the canvas is the design); this stage fixes the non-functional rules.
| Id | Category | Requirement |
|---|---|---|
| NFR-U5-1 | Performance | Variant E is a separate lazy chunk. Its fonts (Open Sans 300/400/600/700, VT323) are self-hosted via `@fontsource` and imported **only inside the E chunk**; Trebuchet MS, Verdana, Times New Roman and Arial are system fonts (no download). Budget: E chunk JS ≤ 60 kB gzip excluding fonts; fonts use `font-display: swap`. B's main bundle must not grow because of E. |
| NFR-U5-2 | Accessibility | WCAG 2.1 AA in all five eras and both modes: text contrast ≥ 4.5:1 (large text ≥ 3:1) verified by a token test; all decorative elements (marquee, year badges, dither strips, scanline overlay, glyph tiles, numbers in boxes, arrows, "800×600" joke is real text and stays readable) are `aria-hidden` or non-interactive; one `h1`, logical heading order across eras; each era section has an accessible name; keyboard operable, visible focus in every era style (focus ring never removed by an era style). |
| NFR-U5-3 | Reduced motion | Under `prefers-reduced-motion: reduce`: marquee, blinking caret and any dither/CRT animation are static or hidden; no auto-moving content remains (WCAG 2.2.2). |
| NFR-U5-4 | Theme | Both modes use the era tokens of the canvas (light and dark sets per era). The 1989 terminal looks the same in both modes (amber on black). The mode toggle and the way back to B stay in the E nav. |
| NFR-U5-5 | Content fidelity | Texts come from `content.ts` (live copy) and the shared logic (packages query/filter/swipe, preselect, `cms-client` form). Only era-specific strings (marquee, "Klaar!", terminal prompts) live in `src/variants/e`. Years are badges, not menu items. |
| NFR-U5-6 | Responsiveness | 360 px to 1440 px+: no horizontal page scroll; the 1998 step cards stack with rotated arrows below 960 px; package cards use the swipe row on mobile like B; terminal form fields wrap. |
| NFR-U5-7 | Security / privacy | No new external requests or third-party scripts; no inline scripts; the terminal form reuses `useContactForm` (no values logged, same honeypot/token/idempotency rules); fonts local. Security Baseline: same compliance as U4 for the form, N/A elsewhere. |
| NFR-U5-8 | Testability | Per-era render tests (structure, text, landmarks), token contrast test for the E sets, reduced-motion tests (no animation classes/elements), variant switch round trip B → E → B, terminal form flows reusing the U4 contract tests, package block in 2006 style reusing the U3 logic tests. |
| NFR-U5-9 | Maintainability | E code is isolated in `src/variants/e/**`; shared logic is imported, not copied; era styles are Tailwind utilities plus a small scoped CSS file for effects (marquee, scanlines, dither, bevels) loaded with the chunk. |
## Security Baseline compliance (U5 scope)
SECURITY-03/05/09/10/13/15 compliant or N/A as in U4 (form reuse, no new dependency except `@fontsource` font packages: official registry, lock file committed). SECURITY-04 stays open at infrastructure level (see U4 infrastructure design). Others N/A.
@@ -0,0 +1,8 @@
# Tech Stack Decisions — e-timetravel (U5)
- **Fonts**: add `@fontsource/open-sans` (300, 400, 600, 700) and `@fontsource/vt323` (400); import them from `src/variants/e/fonts.ts`, which is imported only by the E chunk. Archivo and JetBrains Mono (already loaded by B) are reused for the 2026 section. Verdana/Trebuchet/Times/Arial/Courier are system stacks with the fallbacks of the canvas. If a package is blocked by the repo's release-age policy, stop and report.
- **Styling**: Tailwind utilities plus `src/variants/e/era.css` (imported by the E chunk) for what utilities cannot express cleanly: bevel borders (`outset/inset/groove`), glossy gradients, repeating dither backgrounds, marquee and scanline overlays, scoped under `[data-variant='e']`.
- **Tokens**: era tokens as CSS variables per era and mode (`--e-flat-bg`, `--e-w2-card`, `--e-w98-bevel`, ...) in `era.css`, selected by `html[data-variant='e'][data-mode]` (extends the base tokens from U1).
- **Packages**: reuse `packageLogic`, `usePackageFilter`, `useSwipeRow`, `useContactPreselect`; new presentation components only (2006 style).
- **Form**: reuse `src/cms-client/contact` (`useContactForm`, client, messages) and the availability hook; new terminal skin.
- **No new runtime logic libraries.**
@@ -0,0 +1,25 @@
# Code Generation Plan — e-timetravel (U5)
Brownfield, same repo. All new code in `src/variants/e/**` unless stated. Design source: canvas `Tijdreis2.dc.html` + `PakkettenTijd.dc.html`. NFRs: `construction/e-timetravel/nfr-*`.
## Steps
- [x] 1. **Fonts + era CSS**: add `@fontsource/open-sans` (300/400/600/700) and `@fontsource/vt323`; `fonts.ts` and `era.css` (era tokens per mode: flat, w2, w98, term; bevel, gloss, dither, marquee, scanline classes; reduced-motion rules; focus ring per era).
- [x] 2. **Token contrast test** (`__tests__/eraTokens.test.ts`): parse token pairs, assert ≥ 4.5:1 (large ≥ 3:1) for both modes and all eras.
- [x] 3. **Era content module** (`eraContent.ts`): era-only strings (marquee, "Klaar!", terminal prompts, year badges, "Meest gekozen!"); everything else from `content.ts`.
- [x] 4. **ENav**: brand, anchor links, mode toggle + way back to B (reuses `ModeToggle`/`VariantToggle`), mobile behaviour as B (always-mounted animated menu), year badge not a menu item.
- [x] 5. **Era 2026 (hero)** and **Era 2013 (about)**: flat style, photo circle + 3 tiles, decorative glyphs `aria-hidden`; one `h1`.
- [x] 6. **Era 2006 (packages)**: glossy tabs from `usePackageFilter`, panel, glossy cards, star badge, optional banner per `bannerSlugs`, swipe row on mobile via `useSwipeRow`, preselect to the form via `useContactPreselect`; skeleton/error states like B.
- [x] 7. **Era 1998 (process)**: Win98 style, marquee (static under reduced motion), step cards with progress blocks, rotated arrows below 960 px, "Klaar!" card.
- [x] 8. **Dither strips** between eras (decorative, `aria-hidden`).
- [x] 9. **Era 1989 (contact)**: `ContactFormTerminal` on `useContactForm` + `useContactAvailability` (mailto fallback in terminal style, honeypot, field errors via `aria-describedby`, status messages in a live region, retry/reset), scanlines overlay (`aria-hidden`, off under reduced motion).
- [x] 10. **LandingE** composition replacing the placeholder; section order, ids and accessible names; skip link target stays `#main`.
- [x] 11. **Tests**: per-era render tests; reduced-motion test; terminal form flows (reuse U4 contract mocks); 2006 packages (filter, preselect, swipe); variant round trip B → E → B including mode persistence.
- [x] 12. **Quality gates**: `pnpm lint`, `pnpm test`, `pnpm build` (check E chunk size ≤ 60 kB gz excluding fonts; main bundle not larger than before); fix findings; no unrelated reformatting (prettier only on touched files).
- [x] 13. **Docs**: `construction/e-timetravel/code/code-summary.md`, update aidlc-state/audit, mark checkboxes.
- [x] 14. **Commit** (Dutch message, Co-Authored-By line) on `feature/redesign-modern-timetravel`; push; trigger test deploy only (`deploy_test`, never production); report the run result.
## Not in this unit
SEO/prerender decisions (U6), any production deploy, enabling the contact form in production.
## Story coverage
Variant E (all five eras, light/dark), form in E, packages in E style, easter-egg toggle already delivered in U1.