Adds the Prijzen section to the homepage

Shows the three live packages as cards with their price and what is
included. Each card links to the contact section with ?pakket=<id>, so
the contact form can preselect it. Invalid packages from the CMS are
skipped and the pakket value is only accepted when it names a package.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-20 01:07:36 +02:00
co-authored by Claude Opus 5.5
parent 0b54a67dc4
commit 30dab1af42
32 changed files with 1250 additions and 6 deletions
@@ -0,0 +1,51 @@
# Code Summary — Unit 3: Prijzen
Plan: [prijzen-code-generation-plan.md](../../plans/prijzen-code-generation-plan.md). Functional design: [../functional-design/](../functional-design/). Branch: `feature/homepage-sections`.
## Files
### Created
| File | Purpose |
|---|---|
| `web/src/assets/home/deco-1.png`, `deco-2.png` | Design decorations, unchanged (15 KB, 42 KB) |
| `web/src/content/packages.ts` | The three live packages (Zwangerschap 175, Newborn 185, Gezin 175) |
| `web/src/lib/formatPrice.ts` + test | `€ 175` with a non-breaking space (BR-PRICE-01) |
| `web/src/lib/visiblePackages.ts` + test | `isValidPackage` + filter with first-wins de-duplication (BR-PRICE-02) |
| `web/src/lib/bookLabel.ts` + test | "Boek <name>" up to 14 characters, else "Boek je shoot" + hidden name (BR-BOOK-02) |
| `web/src/lib/packageFromSearch.ts` + test | `?pakket=` → known id or undefined (BR-PARAM-01) |
| `web/src/components/home/Pricing/Pricing.tsx` + test | The section: decorations, heading, card grid |
| `web/src/components/home/Pricing/PriceCard.tsx` + test | One package card with the booking link |
### Modified
| File | Change |
|---|---|
| `web/src/content/types.ts` | `PricingPackage`; `HomeContent.pricing` |
| `web/src/content/homeContent.ts` | Pricing title, lead, decorations |
| `web/src/recipes/linkButton.ts` | `size: 'fit'` — no wrapping, smaller side padding on phones (BR-BOOK-03); default unchanged |
| `web/src/theme.ts` | Shadow token `lift` for the card hover |
| `web/src/test/arbitraries.ts` | `pricingPackage`, `uniquePackages`, `anyPackage` |
| `web/src/routes/index.tsx` | `validateSearch` keeps `pakket` only as a string; renders `Pricing` after `AboutBlock` |
| `web/src/app.test.tsx` | "Prijzen" in the page order; `?pakket=newborn`, `?pakket=123` and `?pakket=<script>` render without errors and without reflecting the value |
## Notes and deviations
- **Typed link**: the shared `RouterLink` (`chakra(Link)`) drops TanStack Router's route generics, so `search={{ pakket }}` would not type-check. The card uses the router's own `Link` with the `linkButton` recipe applied via Chakra's `asChild`, so the search parameter is checked against the homepage route.
- **Second decoration**: the design positions it relative to the whole section; in the content box the last card covered it, so it was moved into the section's bottom padding (found in the visual check).
- **Literal special spaces**: an editing tool turned ` `/` ` escapes into the characters themselves, which ESLint rejects (`no-irregular-whitespace`); they were written back as escapes and `src` was scanned for others.
## Property-based tests (PBT)
| Function | Properties |
|---|---|
| `formatPrice` | digit round-trip; starts with `€` + NBSP, no breaking space |
| `visiblePackages` | only valid + unique ids; subsequence; idempotent; oracle on valid unique input |
| `bookLabel` | name always in the full text; visible form follows the 14-character rule |
| `packageFromSearch` | result undefined or a given id; any case/whitespace oracle; non-strings undefined; idempotent |
## Verification (`pnpm check`)
- Lint ✅, Prettier ✅, build ✅
- Tests: 38 files, **170 passed**; 100% coverage on the new `lib/` files (threshold)
- Lighthouse home: mobile **0.83–0.89** across runs (LCP 2.3–3.9 s), desktop **1.0**; accessibility, best practices, SEO **1.0**
- Visual check (CDP): 1440 three cards with decorations; 390 and 320 one column; "Boek Zwangerschap" stays on one line at 320 px
## Extension compliance
- **Security Baseline**: `pakket` never reflected (tested with a script-like value); only known ids come out; no new dependencies or external resources. Other rules N/A.
- **PBT**: PBT-02/03/04/05 covered per the table, PBT-07 domain generators, PBT-08/09 existing setup, PBT-10 example tests alongside; PBT-06 N/A (no stateful component).