Files
SlpSoftware/aidlc-docs/features/redesign-modern-timetravel/inception/application-design/components.md
T
SluijsensandClaude Sonnet 5.5 1047c738b5 AI-DLC: inception en ontwerp voor redesign B/E met contactformulier
Requirements, application design (incl. concept-API-contract voor het contactformulier), units en functional design voor U1.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-09 21:06:25 +01:00

5.5 KiB

Components

Source layout (target):

src/
  cms-client/                 # self-contained, movable to SlpModularCms (no imports from outside)
    index.ts                  # barrel, but sites import subpaths
    http/                     # apiUrl, fetch helpers, ProblemDetails parsing
    contact/                  # headless contact form
    offerings/                # (later) typed offerings client; types from OpenAPI
  theme/                      # variant x mode state (replaces red/purple)
  shared/                     # a11y/motion hooks, packages logic (filter, swipe), content
  variants/
    b/                        # Modern (default, eager)
    e/                        # Time-travel (lazy chunk)
  components/                 # RootLayout shell, ErrorBoundary, analytics
  routes/ , router.tsx        # unchanged (hash history)

Theme and switching

ThemeProvider (changed)

  • Purpose: owns variant ('b' | 'e') and mode ('light' | 'dark').
  • Responsibilities: initial mode from stored value else prefers-color-scheme; persist only mode; write data-variant and data-mode on <html>; variant always starts as 'b' and is never persisted.
  • Interface: useTheme(): { variant, mode, toggleMode(), setVariant(v), toggleVariant() }.

ModeToggle (replaces ThemeToggle)

  • Purpose: light/dark switch in the nav of both variants. Accessible name "Wissel tussen licht en donker", aria-pressed for dark.

VariantToggle (new)

  • Purpose: icon-only button next to ModeToggle; tooltip and accessible label ("Tijdreis" in B, "Terug naar nu" in E). Uses toggleVariant.

VariantRenderer (new)

  • Purpose: renders LandingB or the lazy LandingE depending on variant; Suspense fallback (small neutral loader); focus and scroll position reset when the variant changes; announces the change to screen readers (aria-live).

tokens (changed)

  • Purpose: CSS variable sets per [data-variant][data-mode] (B light/dark, E light/dark), semantic Tailwind color names kept (bg, surface, text, muted, accent, ...), plus variant-only tokens for E eras.

Variant B (eager)

  • LandingB: composition of NavB, HeroB, AboutB, PackagesB, ProcessB, ContactB, FooterB.
  • NavB: wordmark, anchor links (no years), CTA, ModeToggle, VariantToggle, mobile menu.
  • HeroB / AboutB / ProcessB / FooterB: presentational ports of the canvas design B using shared content.
  • PackagesB: B styling of the packages block (square filter chips, cards, black "Past er niets bij?" banner), uses shared packages logic.
  • ContactB: red contact block with white (light) / dark form panel; uses ContactFormView from the B skin.

Variant E (lazy chunk)

  • LandingE: eras in order 2026 → 2013 → 2006 → 1998 → 1989 with year badges; own nav bar style including ModeToggle and VariantToggle.
  • Era sections (EHero2026, EAbout2013, EPackages2006, EProcess1998, EContact1989): presentational ports of design E; the 1998 Werkwijze uses the step-card layout; the 1989 terminal looks the same in both modes.
  • EffectsLayer: marquee, scanlines, dither transitions, caret; all disabled via usePrefersReducedMotion.

Shared (variant-independent)

  • content.ts (kept): nav links (without years), hero, about, process, contact copy, package seed; E-only era captions live in variants/e.
  • usePackagesQuery (kept): TanStack Query against /api/v1/offerings; type gains category.
  • usePackageFilter: derives categories (order of first appearance), counts, current filter, filtered list; showChips when packages.length >= 4.
  • useSwipeRow: scroll-snap helper for the mobile row (active index for dots, scrollToIndex, initial index = featured package); no JS needed for scrolling itself.
  • usePrefersReducedMotion, usePrefersDark (media query helpers).
  • ContactPreselectContext: { subject, key }; the "Kies …" button of a package sets it (key increments on each click) and scrolls to the contact section.

cms-client (movable package, headless)

  • contact/ContactFormState: pure reducer + types (editing | sending | sent | failed).
  • contact/validateContact: pure validation with limits (name 100, email 254, message 2000) and error codes (required, tooLong, invalid).
  • contact/useContactForm: React hook tying state, validation, preselect (initial value + change key), idPrefix, honeypot, token handling and submit; returns prop getters and slots data. No markup, no styles.
  • contact/createContactClient: fetch implementation of the API contract (getToken, submit) incl. ProblemDetails parsing, Idempotency-Key, 429 handling; submit function is injectable.
  • contact/messages.nl: default Dutch messages (injectable/overridable).
  • http/: apiUrl() honoring VITE_API_BASE_URL, shared error types.

Form skins

  • ContactFormView (B) and ContactFormTerminal (E 1989): presentational components consuming useContactForm output; render honeypot slot (visually hidden, aria-hidden, tabIndex=-1), privacy line, status regions (role=alert on error, role=status + focus on success).
  • ContactGate (optional): feature flag / env switch VITE_CONTACT_FORM_ENABLED; when off, shows the existing mailto fallback (address assembled client-side after mount, not in static HTML).

Backend components (SlpModularCms, for hand-off; not built here)

  • Contact/Forms module: endpoints, validation, storage, mail via IEmailSender, spam checks, rate-limit policy, retention job, per-site config.
  • Offerings module: new optional category field.