Files
AndreaSlopFotografie/aidlc-docs/features/homepage-sections/construction/lieve-woorden/code/code-summary.md
T
SluijsensandClaude Opus 5.5 0fce403ebc Adds the Contact section to the homepage
Adds the contact form with the live fields, validation and browser-side
anti-spam, behind a coming-soon notice with a mail button until the API
exists. A "Boek" link on a price card selects its package, tidies the
URL and moves focus to the form. The form loads only when it comes near
the screen, so the hero does not wait for it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 00:36:43 +02:00

4.9 KiB
Raw Blame History

Code Summary — Unit 4: Lieve woorden

Plan: lieve-woorden-code-generation-plan.md. Functional design: ../functional-design/. Branch: feature/homepage-sections.

Files

Created

File Purpose
web/src/assets/home/review-trouwshoot.jpg, review-newbornshoot.jpg Live photos, centre-cropped to 4:5, 880×1100, ±100 KB
web/src/content/testimonials.ts The two live reviews
web/src/lib/visibleTestimonials.ts + test Invariants filter, first-wins de-duplication (BR-REV-01)
web/src/lib/slideLabel.ts + test "Review n van m" (BR-REV-08/09)
web/src/recipes/carouselControl.ts Arrow and dot buttons under a carousel
web/src/components/home/Testimonials/Testimonials.tsx + test The section; heading always rendered; carousel loaded when near the screen
web/src/components/home/Testimonials/TestimonialCarousel.tsx Chakra Carousel (Zag) with our own controls and live region; separate chunk
web/src/components/home/Testimonials/TestimonialSlide.tsx + test One review: framed photo, quotation mark, shoot, quote, names

Modified

File Change
web/src/content/types.ts, homeContent.ts Testimonial; HomeContent.testimonials
web/src/theme.ts Registers carouselControl
web/src/test/arbitraries.ts testimonial, uniqueTestimonials, anyTestimonial
web/src/test/setup.ts No-op ResizeObserver (jsdom lacks it; the carousel needs it)
web/src/routes/index.tsx Renders Testimonials after Pricing
web/src/app.test.tsx "Lieve woorden" in the page order; stubs IntersectionObserver and Element.scrollTo for the carousel

Decisions and fixes during generation

  • Own controls for reduced motion (plan finding 1): Zag's built-in triggers, dots and keys scroll smoothly from JavaScript; ours pass instant when the visitor prefers reduced motion. Verified in real Chrome: normally the slide moves over ±330 ms, with reduced motion it is in place in the first frame.
  • One announcement (finding 2): the item group's aria-live is off; our polite region says "Review n van m" on each change, nothing on load.
  • Slides clipped each other's frame: the sand block sticks out 1.5 rem left and below the photo, and the item group clips everything outside a slide, so the next slide's block showed over the quote. Fixed with 4 rem spacing between slides and 1.5 rem padding left/bottom in each slide (from sm).
  • Carousel cost on page load: the carousel in the route chunk lowered home mobile Lighthouse from a median 0.83 (unit 3, 5 runs) to 0.81; React.lazy alone did not help (the chunk still loaded at once). Now the section and heading render immediately, and the carousel chunk loads only when the section comes within 200 px of the screen (same rule as the deferred photos), with a placeholder of the measured height. Median back to 0.83 (LCP 3.84 s).
  • Testing approach: jsdom has no layout, so Zag cannot page there. Unit tests check our wiring (calls to scrollNext/scrollPrev/scrollTo with the right instant, announcements, labels, loop option, deferred loading); paging, looping, dots and the hidden off-screen slide were checked in real Chrome via the DevTools protocol (next → "Review 2 van 2", next again → back to review 1, dot 2 → review 2).

Change request after testing on test (2026-10-20)

The photo was too large on phones (it filled the screen). Now: phones max 180 px wide (±75% of a first 240 px step), tablets max 320 px, centred above the quote. Desktop grid 5fr 11fr after reviewing screenshots of both, so the photo is ±75% of its earlier size (±395×495 px at 1440) and the whole block fits a ±1000 px high screen. Stacked slides align their content to the top (a short review no longer floats in the middle of the shared height) with a 1.25 rem gap between photo and text. Placeholder heights re-measured.

Later change (unit 5)

The quote is a plain figure/blockquote/figcaption instead of Chakra's Blockquote: its slot recipe pulled a shared chunk into the route bundle on page load (see the unit 5 code summary, performance).

Verification (pnpm check)

  • Lint ✅, Prettier ✅, build ✅ — carousel in its own chunk (TestimonialCarousel-*.js, 43 KB raw)
  • Tests: 42 files, 190 passed; 100% coverage on the new lib/ files
  • Lighthouse home: mobile 0.83 (LCP 3.8 s), desktop 1.0 (LCP 0.8 s); accessibility, best practices, SEO 1.0
  • Visual check: 1440 and 390, both reviews

Extension compliance

  • Security Baseline: content rendered as text; no new dependencies (Chakra Carousel and Ant Design icons already installed); no external resources. Other rules N/A.
  • PBT: PBT-02 (slideLabel round-trip), PBT-03 (invariants), PBT-04 (idempotency), PBT-05 (oracle), PBT-07 (generators), PBT-08/09 (existing), PBT-10 (example tests). PBT-06 N/A — the stateful part is Zag's.