From e5f43481789e2140ed77dc44f00974bbc52244a6 Mon Sep 17 00:00:00 2001 From: Sluijsens Date: Fri, 30 Oct 2026 13:31:46 +0100 Subject: [PATCH] Adds the shoot-type pages content and SEO foundation Five pages under /soorten-fotoshoots/ with draft copy awaiting Andrea's approval (DRAFT markers), structured data (Service, BreadcrumbList, FAQPage), sitemap and Lighthouse entries. The overview route moves to soorten-fotoshoots/index.tsx. Co-Authored-By: Claude Opus 5.5 --- .../reverse-engineering/api-documentation.md | 5 +- .../reverse-engineering/architecture.md | 1 + .../reverse-engineering/code-structure.md | 7 +- aidlc-docs/active-features.md | 1 + .../features/shoot-type-pages/aidlc-state.md | 64 +++ aidlc-docs/features/shoot-type-pages/audit.md | 329 +++++++++++++++ .../code/code-summary.md | 164 ++++++++ .../code/draft-list.txt | 98 +++++ .../code/open-list.txt | 7 + .../content-review/andrea-review.md | 376 ++++++++++++++++++ .../functional-design/business-logic-model.md | 160 ++++++++ .../functional-design/business-rules.md | 132 ++++++ .../functional-design/domain-entities.md | 94 +++++ .../functional-design/frontend-components.md | 174 ++++++++ ...and-seo-foundation-code-generation-plan.md | 287 +++++++++++++ ...navigation-submenu-code-generation-plan.md | 212 ++++++++++ .../plans/navigation-submenu-fd-questions.md | 60 +++ ...vigation-submenu-functional-design-plan.md | 16 + .../shoot-page-ui-code-generation-plan.md | 253 ++++++++++++ .../plans/shoot-page-ui-fd-questions.md | 84 ++++ .../shoot-page-ui-functional-design-plan.md | 23 ++ .../functional-design/business-logic-model.md | 244 ++++++++++++ .../functional-design/business-rules.md | 234 +++++++++++ .../functional-design/domain-entities.md | 157 ++++++++ .../functional-design/frontend-components.md | 292 ++++++++++++++ .../application-design-questions.md | 57 +++ .../application-design/application-design.md | 198 +++++++++ .../component-dependency.md | 110 +++++ .../application-design/component-methods.md | 285 +++++++++++++ .../application-design/components.md | 139 +++++++ .../inception/application-design/services.md | 114 ++++++ .../plans/application-design-plan.md | 27 ++ .../inception/plans/execution-plan.md | 148 +++++++ .../requirement-clarification-questions.md | 25 ++ .../requirement-verification-questions.md | 171 ++++++++ .../inception/requirements/requirements.md | 303 ++++++++++++++ web/lighthouserc.cjs | 20 +- web/lighthouserc.d.cts | 1 + web/src/app.test.tsx | 164 ++++++-- .../StructuredData/StructuredData.test.tsx | 40 ++ .../StructuredData/StructuredData.tsx | 18 + .../shoots/ShootPage/ShootPage.test.tsx | 35 ++ .../components/shoots/ShootPage/ShootPage.tsx | 17 + web/src/content/shootPageShared.ts | 123 ++++++ web/src/content/shootPages/gezin.ts | 147 +++++++ web/src/content/shootPages/loveshoot.ts | 140 +++++++ web/src/content/shootPages/newborn.ts | 195 +++++++++ web/src/content/shootPages/portret.ts | 142 +++++++ web/src/content/shootPages/shootPages.test.ts | 206 ++++++++++ web/src/content/shootPages/zwangerschap.ts | 154 +++++++ web/src/content/shootTypes.ts | 2 +- web/src/content/types.ts | 103 +++++ web/src/lib/fillPlaceholders.test.ts | 187 +++++++++ web/src/lib/fillPlaceholders.ts | 31 ++ web/src/lib/richTextToPlain.test.ts | 33 ++ web/src/lib/richTextToPlain.ts | 10 + web/src/lib/shootLinks.test.ts | 10 + web/src/lib/shootLinks.ts | 10 +- web/src/lib/shootPackage.test.ts | 63 +++ web/src/lib/shootPackage.ts | 12 + web/src/lib/shootPageView.test.ts | 369 +++++++++++++++++ web/src/lib/shootPageView.ts | 232 +++++++++++ web/src/lib/shootPages.test.ts | 131 ++++++ web/src/lib/shootPages.ts | 51 +++ web/src/routeTree.gen.ts | 139 ++++++- .../soorten-fotoshoots/-shootPageSources.ts | 24 ++ web/src/routes/soorten-fotoshoots/gezin.tsx | 30 ++ .../index.tsx} | 46 +-- .../routes/soorten-fotoshoots/loveshoot.tsx | 30 ++ web/src/routes/soorten-fotoshoots/newborn.tsx | 30 ++ web/src/routes/soorten-fotoshoots/portret.tsx | 30 ++ .../soorten-fotoshoots/zwangerschap.tsx | 34 ++ web/src/seo.test.ts | 325 ++++++++++++++- web/src/seo.ts | 106 ++++- web/src/sitePages.ts | 40 ++ web/src/sitemap.test.ts | 5 + web/src/test/arbitraries.ts | 270 +++++++++++++ web/src/test/renderApp.tsx | 33 ++ 78 files changed, 8729 insertions(+), 110 deletions(-) create mode 100644 aidlc-docs/features/shoot-type-pages/aidlc-state.md create mode 100644 aidlc-docs/features/shoot-type-pages/audit.md create mode 100644 aidlc-docs/features/shoot-type-pages/construction/content-and-seo-foundation/code/code-summary.md create mode 100644 aidlc-docs/features/shoot-type-pages/construction/content-and-seo-foundation/code/draft-list.txt create mode 100644 aidlc-docs/features/shoot-type-pages/construction/content-and-seo-foundation/code/open-list.txt create mode 100644 aidlc-docs/features/shoot-type-pages/construction/content-review/andrea-review.md create mode 100644 aidlc-docs/features/shoot-type-pages/construction/navigation-submenu/functional-design/business-logic-model.md create mode 100644 aidlc-docs/features/shoot-type-pages/construction/navigation-submenu/functional-design/business-rules.md create mode 100644 aidlc-docs/features/shoot-type-pages/construction/navigation-submenu/functional-design/domain-entities.md create mode 100644 aidlc-docs/features/shoot-type-pages/construction/navigation-submenu/functional-design/frontend-components.md create mode 100644 aidlc-docs/features/shoot-type-pages/construction/plans/content-and-seo-foundation-code-generation-plan.md create mode 100644 aidlc-docs/features/shoot-type-pages/construction/plans/navigation-submenu-code-generation-plan.md create mode 100644 aidlc-docs/features/shoot-type-pages/construction/plans/navigation-submenu-fd-questions.md create mode 100644 aidlc-docs/features/shoot-type-pages/construction/plans/navigation-submenu-functional-design-plan.md create mode 100644 aidlc-docs/features/shoot-type-pages/construction/plans/shoot-page-ui-code-generation-plan.md create mode 100644 aidlc-docs/features/shoot-type-pages/construction/plans/shoot-page-ui-fd-questions.md create mode 100644 aidlc-docs/features/shoot-type-pages/construction/plans/shoot-page-ui-functional-design-plan.md create mode 100644 aidlc-docs/features/shoot-type-pages/construction/shoot-page-ui/functional-design/business-logic-model.md create mode 100644 aidlc-docs/features/shoot-type-pages/construction/shoot-page-ui/functional-design/business-rules.md create mode 100644 aidlc-docs/features/shoot-type-pages/construction/shoot-page-ui/functional-design/domain-entities.md create mode 100644 aidlc-docs/features/shoot-type-pages/construction/shoot-page-ui/functional-design/frontend-components.md create mode 100644 aidlc-docs/features/shoot-type-pages/inception/application-design/application-design-questions.md create mode 100644 aidlc-docs/features/shoot-type-pages/inception/application-design/application-design.md create mode 100644 aidlc-docs/features/shoot-type-pages/inception/application-design/component-dependency.md create mode 100644 aidlc-docs/features/shoot-type-pages/inception/application-design/component-methods.md create mode 100644 aidlc-docs/features/shoot-type-pages/inception/application-design/components.md create mode 100644 aidlc-docs/features/shoot-type-pages/inception/application-design/services.md create mode 100644 aidlc-docs/features/shoot-type-pages/inception/plans/application-design-plan.md create mode 100644 aidlc-docs/features/shoot-type-pages/inception/plans/execution-plan.md create mode 100644 aidlc-docs/features/shoot-type-pages/inception/requirements/requirement-clarification-questions.md create mode 100644 aidlc-docs/features/shoot-type-pages/inception/requirements/requirement-verification-questions.md create mode 100644 aidlc-docs/features/shoot-type-pages/inception/requirements/requirements.md create mode 100644 web/src/components/StructuredData/StructuredData.test.tsx create mode 100644 web/src/components/StructuredData/StructuredData.tsx create mode 100644 web/src/components/shoots/ShootPage/ShootPage.test.tsx create mode 100644 web/src/components/shoots/ShootPage/ShootPage.tsx create mode 100644 web/src/content/shootPageShared.ts create mode 100644 web/src/content/shootPages/gezin.ts create mode 100644 web/src/content/shootPages/loveshoot.ts create mode 100644 web/src/content/shootPages/newborn.ts create mode 100644 web/src/content/shootPages/portret.ts create mode 100644 web/src/content/shootPages/shootPages.test.ts create mode 100644 web/src/content/shootPages/zwangerschap.ts create mode 100644 web/src/lib/fillPlaceholders.test.ts create mode 100644 web/src/lib/fillPlaceholders.ts create mode 100644 web/src/lib/richTextToPlain.test.ts create mode 100644 web/src/lib/richTextToPlain.ts create mode 100644 web/src/lib/shootPackage.test.ts create mode 100644 web/src/lib/shootPackage.ts create mode 100644 web/src/lib/shootPageView.test.ts create mode 100644 web/src/lib/shootPageView.ts create mode 100644 web/src/lib/shootPages.test.ts create mode 100644 web/src/lib/shootPages.ts create mode 100644 web/src/routes/soorten-fotoshoots/-shootPageSources.ts create mode 100644 web/src/routes/soorten-fotoshoots/gezin.tsx rename web/src/routes/{soorten-fotoshoots.tsx => soorten-fotoshoots/index.tsx} (57%) create mode 100644 web/src/routes/soorten-fotoshoots/loveshoot.tsx create mode 100644 web/src/routes/soorten-fotoshoots/newborn.tsx create mode 100644 web/src/routes/soorten-fotoshoots/portret.tsx create mode 100644 web/src/routes/soorten-fotoshoots/zwangerschap.tsx create mode 100644 web/src/test/renderApp.tsx diff --git a/aidlc-docs/_shared/reverse-engineering/api-documentation.md b/aidlc-docs/_shared/reverse-engineering/api-documentation.md index e163c31..54307a8 100644 --- a/aidlc-docs/_shared/reverse-engineering/api-documentation.md +++ b/aidlc-docs/_shared/reverse-engineering/api-documentation.md @@ -14,7 +14,8 @@ None. There is no back-end yet (`api/` is empty). The static design README antic | `/` | `routes/index.tsx` | `pageHead('/')` | `Hero` + six home sections; search `?pakket=` | yes | | `/over-mij` | `routes/over-mij.tsx` | `pageHead('/over-mij')` + `AboutPage` JSON-LD | `PageIntro`, `AboutIntro`, `StorySection` ×2, `PhotoDuo`, `LinkButton` | yes | | `/portfolio` | `routes/portfolio.tsx` | `pageHead('/portfolio')` + `ImageGallery` JSON-LD; search `?shoot=` (`ShootTypeId`) | `PageIntro`, `PortfolioGallery`, `InstagramGrid` | yes | -| `/soorten-fotoshoots` | `routes/soorten-fotoshoots.tsx` | `pageHead('/soorten-fotoshoots')` + `WebPage` JSON-LD (`webPage()` + `shootServices()`) | `PageIntro`, `shoots/ShootList` (5× `ShootBlock`), `CallToAction`, `RichParagraph`, `LinkButton` | yes | +| `/soorten-fotoshoots` | `routes/soorten-fotoshoots/index.tsx` | `pageHead('/soorten-fotoshoots')` + `WebPage` JSON-LD via `StructuredData` (`webPage()` + `shootServices()`; Service `@id` `…/soorten-fotoshoots/#service` per D2) | `PageIntro`, `shoots/ShootList` (5× `ShootBlock`), `CallToAction`, `RichParagraph`, `LinkButton` | yes | +| `/soorten-fotoshoots/` (newborn, zwangerschap, gezin, loveshoot, portret) | `routes/soorten-fotoshoots/.tsx` | `pageHead('/soorten-fotoshoots/')`; JSON-LD via `StructuredData` (`shootPageGraph`: `WebPage` with the shoot's Service, `FAQPage` when there are questions) | `shoots/ShootPage` (`PageIntro` only in unit 1), `NotFound` when `shootPageView` returns `undefined` | yes | | `/contact` | `routes/contact.tsx` | `pageHead(...)` | `PageIntro` placeholder | no | | `/privacyverklaring` | `routes/privacyverklaring.tsx` | `pageHead(...)` | `PageIntro` placeholder | no | | (not found) | — | — | `NotFound` | — | @@ -25,6 +26,7 @@ None. There is no back-end yet (`api/` is empty). The static design README antic - `canonicalUrl(path, base?)`, `jsonLdScript(data)`, `structuredDataScript(data)`, `professionalService(content)` (with `@id` `businessId` and `founder` → `personId`), `person(content, site, image)`, `aboutPage(path, content, site)` - `sitePages: Record`, `pageList(pages)` - `sitemapXml(...)` — used by `config/sitemapPlugin.ts` +- Shoot pages (unit 1): `shootServiceId(id)` (`…/soorten-fotoshoots/#service`), `shootService(shoot, site, pkg?)` (Service, `offers` only with `pkg`), `breadcrumbList(items)`, `faqPage(path, items)` (`undefined` without items), `shootPageGraph(view, site)` (WebPage + optional FAQPage); `shootServices` builds the overview list with `shootService` ### Components (props) - `AppShell()`, `NavigationBar()`, `BackToTop()`, `NotFound()` — no props @@ -64,6 +66,7 @@ None. There is no back-end yet (`api/` is empty). The static design README antic - `slideLabel`, `formatPrice`, `bookLabel`, `visiblePackages`, `visibleTestimonials`, `packageFromSearch`, `shootOptions`, `mailSubject`/`mailtoLink`, `validateField`/`validateContact`, `isLikelySpam`, `toContactPayload`, `contactFormReducer` - Portfolio (`lib/portfolioFilters.ts`): `isShootTypeId`, `shootTypesWithPhotos(shootTypes, photos)`, `shootFromSearch(value, available)`, `filterPhotos(photos, shoot)`, `filterOptions(shootTypes, allLabel)`, `toGalleryItems(photos, shootTypes)`, `photoCountLabel(n)`; `seo.ts`: `galleryImages(photos)` - Gallery (portfolio-page): `wrapIndex(index, count)`, `swipeDirection(start, end, threshold = 50)`, `masonryRowSpan({ width, height }, K = 40, gapRows = 2)`, `neighbourIndexes(index, count, radius = 2)`, `lightboxReducer(state, event)` (+ `LightboxState`, `LightboxEvent`) +- Shoot pages (unit 1): `shootPagePath(id)`, `shootIdFromSlug(slug)`, `shootIdFromPath(pathname)` (`lib/shootPages.ts`); `shootPackage(shoot, packages)` (`lib/shootPackage.ts`); `fillPlaceholders(text, values)`, `fillRichText(rich, values)` (`lib/fillPlaceholders.ts`); `richTextToPlain(text)` (`lib/richTextToPlain.ts`); `shootPageView(id, page, sources)` (`lib/shootPageView.ts`) ### Monitoring - `monitoringFor(hostname): Monitoring | null`, `startSentry(hostname?)`, `reportError(error)` diff --git a/aidlc-docs/_shared/reverse-engineering/architecture.md b/aidlc-docs/_shared/reverse-engineering/architecture.md index 3ae2d3e..3be5e95 100644 --- a/aidlc-docs/_shared/reverse-engineering/architecture.md +++ b/aidlc-docs/_shared/reverse-engineering/architecture.md @@ -19,6 +19,7 @@ graph TD Outlet --> About["routes/over-mij.tsx: about page"] Outlet --> Portfolio["routes/portfolio.tsx: PortfolioGallery + InstagramGrid"] Outlet --> Placeholders["contact, privacyverklaring: PageIntro"] + Outlet --> ShootPages["routes/soorten-fotoshoots/: overview and five shoot pages"]:::page Home --> Hero["Hero (HeroArrows, HeroPauseButton, HeroSocials, useHeroSlider)"] Home --> Sections["components/home/: IntroGallery, AboutBlock, Pricing, Testimonials, ContactSection; shared InstagramGrid"] Sections --> Blocks["Shared blocks: PageSection, MediaText, CallToAction, RichParagraph, Eyebrow, SectionHeading, FramedImage, DeferredImage, Reveal; gallery: PortfolioGrid, Lightbox, FilterBar"] diff --git a/aidlc-docs/_shared/reverse-engineering/code-structure.md b/aidlc-docs/_shared/reverse-engineering/code-structure.md index ff968dc..b693860 100644 --- a/aidlc-docs/_shared/reverse-engineering/code-structure.md +++ b/aidlc-docs/_shared/reverse-engineering/code-structure.md @@ -59,12 +59,17 @@ Candidates for modification are marked with ★ for the over-mij-page feature. - `web/src/routes/over-mij.tsx` — the about page (indexed; `AboutPage` JSON-LD) - `web/src/components/about/*` — `AboutIntro`, `StorySection` - `web/src/components/shoots/*` — `ShootList`, `ShootBlock` (soorten-fotoshoots page) +- `web/src/components/shoots/ShootPage/ShootPage.tsx` — shoot page shell, `ShootPageView` in (unit 1: intro only; unit 2 adds the sections) +- `web/src/components/StructuredData/StructuredData.tsx` — JSON-LD script via `jsonLdScript`; the only `dangerouslySetInnerHTML` of the shoot pages - `web/src/components/{CallToAction,RichParagraph}/` — shared closing block; paragraph with inline links - `web/src/content/{shootTypes,shootTypesPageContent}.ts` — shoot types (also used by the portfolio filters) and page texts; `web/src/assets/shoots/` — 4:5 shoot photos - `web/src/lib/shootLinks.ts` — contact and portfolio link targets per shoot type +- `web/src/lib/{shootPages,shootPackage,fillPlaceholders,richTextToPlain,shootPageView}.ts` — shoot page helpers (ids and paths, package, placeholders, plain text, view), each with a test - `web/src/components/PhotoDuo/PhotoDuo.tsx` — two photos side by side - `web/src/content/aboutContent.ts` — about page content; `web/src/assets/about/*` — portrait and duo photos; `web/public/og-over-mij.jpg` — preview image -- `web/src/routes/soorten-fotoshoots.tsx` — the shoot types page +- `web/src/routes/soorten-fotoshoots/index.tsx` — the shoot types page (moved from `routes/soorten-fotoshoots.tsx`); `newborn.tsx`, `zwangerschap.tsx`, `gezin.tsx`, `loveshoot.tsx`, `portret.tsx` — one route per shoot page (`/soorten-fotoshoots/`); `-shootPageSources.ts` — the sources the shoot routes share +- `web/src/content/shootPageShared.ts` — shared shoot page content (breadcrumb, process, deposit, shared FAQ items, offer texts); `web/src/content/shootPages/*.ts` — one content module per shoot page, plus `shootPages.test.ts` (content consistency) +- `web/src/test/renderApp.tsx` — `renderApp(path)` and `expectShell()` for the route tests - `web/src/routes/portfolio.tsx` — the portfolio (indexed; `?shoot=` filter; `ImageGallery` JSON-LD); `web/src/components/portfolio/PortfolioGallery/`, `web/src/content/portfolioContent.ts`, `web/src/lib/portfolioFilters.ts`, `web/src/assets/portfolio/*` (10 photos × 2 sizes), `web/public/og-portfolio.jpg` - `web/src/routes/{contact,privacyverklaring}.tsx` — placeholders with `PageIntro` - `web/src/components/AppShell.tsx` — shell diff --git a/aidlc-docs/active-features.md b/aidlc-docs/active-features.md index a6596aa..a06b918 100644 --- a/aidlc-docs/active-features.md +++ b/aidlc-docs/active-features.md @@ -9,3 +9,4 @@ | Feature | soorten-fotoshoots-page | ✅ Complete | feature/soorten-fotoshoots-page | web/src/routes/soorten-fotoshoots.tsx, new web/src/content/shootTypes.ts, new web/src/assets/shoots/, new shared CallToAction, MediaText (reverse prop), Pricing (id="prijzen" only), siteContent (service area), own entries in sitePages.ts / lighthouserc.cjs, JSON-LD via the shared webPage() helper in seo.ts | 2026-10-24 | | Feature | contact-page | ✅ Complete | feature/contact-page | web/src/routes/contact.tsx, web/src/content, possibly ContactForm/ContactSection, PageIntro, MediaText/FramedImage, web/src/seo.ts, sitePages/sitemap | 2026-10-24 | | Feature | portfolio-page | ✅ Complete | feature/portfolio-page (based on master after over-mij merge; worktree ../AndreaSlopFotografie-portfolio) | web/src/routes/portfolio.tsx, web/src/content, new PortfolioGrid + Lightbox, InstagramGrid (moved to shared), own entries in sitePages.ts / lighthouserc.cjs, ImageGallery JSON-LD via the shared webPage() helper | 2026-10-24 | +| Feature | shoot-type-pages | 🟢 Construction | feature/shoot-type-pages (worktree ../AndreaSlopFotografie-shoot-type-pages) | new route(s) per shoot type under web/src/routes, web/src/content (shootTypes.ts extension, timeline content), shared Timeline component, links from soorten-fotoshoots, seo.ts (webPage helper), sitePages.ts / sitemap, lighthouserc.cjs | 2026-10-29 | diff --git a/aidlc-docs/features/shoot-type-pages/aidlc-state.md b/aidlc-docs/features/shoot-type-pages/aidlc-state.md new file mode 100644 index 0000000..3926560 --- /dev/null +++ b/aidlc-docs/features/shoot-type-pages/aidlc-state.md @@ -0,0 +1,64 @@ +# AI-DLC State Tracking + +## Project Information +- **Feature Name**: Shoot type pages (one page per shoot type, e.g. `/soorten-fotoshoots/`) +- **Feature Slug**: shoot-type-pages +- **Project Type**: Brownfield +- **Start Date**: 2026-10-29T17:19:19Z +- **Current Stage**: CONSTRUCTION - Code Generation Part 2 (unit 2 Shoot page UI ∥ unit 3 Navigation submenu) +- **Branch**: feature/shoot-type-pages (from master 18e81d0) +- **Worktree**: K:\Development\SlpSoftware\Projects\AndreaSlopFotografie-shoot-type-pages + +## Workspace State +- **Existing Code**: Yes +- **Programming Languages**: TypeScript (React/TSX) +- **Build System**: pnpm + Vite (`tsc && vite build`), Gitea Actions CI +- **Project Structure**: Single front-end SPA in `web/`; static HTML design reference in `design/andreaslop-static/`; `api/` (.NET back-end) +- **Reverse Engineering Needed**: No (team agreement: no full RE refresh per feature; only this feature's own route/component lines are updated in `_shared/reverse-engineering/`) +- **Workspace Root**: K:\Development\SlpSoftware\Projects\AndreaSlopFotografie-shoot-type-pages + +## Code Location Rules +- **Application Code**: Workspace root (NEVER in aidlc-docs/) — front-end lives in `web/` +- **Feature Documentation**: aidlc-docs/features/shoot-type-pages/ only +- **Shared Artifacts**: aidlc-docs/_shared/ +- **Structure patterns**: See code-generation.md Critical Rules + +## Language Configuration +- **Documentation Language**: English +- **Conversation Language**: User Language (Dutch) +- **Source**: inherited from aidlc-docs/language-preference.md (answer A); user may override + +## Orchestration +- The main session orchestrates and is the only Opus (user, 2026-10-30). Sub-agents: Haiku where it can handle the task (registry/config entries, docs, running checks), otherwise Sonnet (code and tests from the plan, content drafts, functional design, diagnosis, reviews). Two Opus sub-agents already running for unit 1 steps 3–7/13 and 8–12/14–15 were kept to finish + +## Extension Configuration +| Extension | Enabled | Decided At | +|---|---|---| +| Security Baseline | Yes | Requirements Analysis | +| Property-Based Testing | Yes (full enforcement) | Requirements Analysis | + +## Operations Configuration +- **Include Operations Phase**: No +- **Decided At**: Requirements Analysis + +## Stage Progress + +### 🔵 INCEPTION PHASE +- [x] Workspace Detection +- [x] Reverse Engineering - SKIP (shared artifacts used; delta lines only) +- [x] Requirements Analysis (approved) — design E chosen (canvas https://claude.ai/artifact/BdXmEgsTPK2567g9AFQCXa) +- [x] User Stories - SKIP (single visitor persona; concrete FRs) +- [x] Workflow Planning (approved) +- [x] Application Design - EXECUTE (standard) — approved (D1–D6 all A) +- [x] Units Generation - SKIP (three units fixed in the plan) + +### 🟢 CONSTRUCTION PHASE +- [x] Functional Design - EXECUTE (units 2, 3) / SKIP (unit 1) — both approved 2026-10-30 +- [ ] NFR Requirements - SKIP +- [ ] NFR Design - SKIP +- [ ] Infrastructure Design - SKIP +- [~] Code Generation - EXECUTE (per unit): 1 Content and SEO foundation ✅ (uncommitted; Step 24 red only on pre-existing master issues) → 2 Shoot page UI ∥ 3 Navigation submenu +- [ ] Build and Test - EXECUTE + +### 🟡 OPERATIONS PHASE +- [ ] Deployment Setup, Monitoring Setup, Production Readiness Validation - SKIP (Operations = No) diff --git a/aidlc-docs/features/shoot-type-pages/audit.md b/aidlc-docs/features/shoot-type-pages/audit.md new file mode 100644 index 0000000..62131e7 --- /dev/null +++ b/aidlc-docs/features/shoot-type-pages/audit.md @@ -0,0 +1,329 @@ +# AI-DLC Audit Log — shoot-type-pages + +## Workspace Detection — Initial Request + +**Timestamp**: 2026-10-29T17:19:19Z + +**User Input**: "Ik wil voor de front-end per shoot type een pagina maken. Dat zou de SEO moeten verbeteren en je kan per shoor dieper ingaan op wat het inhoudt en eventueel een paar higlighted foto's laten zien als impressie. Je zou ook wat mee rgenerieke info kunnen laten zien die je op elke pagina laat zien zoals een tijdlijn om een indruk te krijgen welke stappen worden doorlopen zoals aanvragen, datum & locatie kiezen., aanbetaling. Shoot en de duur voor het opleveren van de foto's (dit zou per shoot kunnen verschillen) en de oplevering om even een idee te geven. Ik wil dit met aidlc doen. Zorg dat je gedurende dit proces sub-agents gebruikt zodat je kleinere taken aan kleinere agents kan geven en complexere taken aan grotere. Jijzelf kan dan de orchstratie doen. Ik zou ook graag eerst een paar suggesties voor een design willen zien" + +**AI Response**: "Classified as Feature (new user-facing pages). Brownfield; shared reverse-engineering artifacts reused (no full refresh, per team agreement). Created worktree ../AndreaSlopFotografie-shoot-type-pages on branch feature/shoot-type-pages from master 18e81d0. Language inherited from language-preference.md (English docs, Dutch chat). Next: Requirements Analysis, starting with design suggestions produced by sub-agents." + +**Context**: Workspace Detection complete. Parallel sessions: one idle interactive peer (andreaslopfotografie-d3, task unknown); no active features in active-features.md, so no component conflicts. + +--- + +## Requirements Analysis — Design Suggestions and Clarifying Questions + +**Timestamp**: 2026-10-29T17:52:00Z + +**User Input**: "(none; continuing from the initial request, which asked for design suggestions first)" + +**AI Response**: "Sub-agent (sonnet) gathered a context brief (brand tokens, shoot content, photos, routing/SEO, LAYOUT.md rules). Sub-agent (opus) produced three layout directions for the newborn page as an example (A Verhaal / B Beeld eerst / C Praktisch) plus a mobile timeline board, published on the Design canvas https://claude.ai/artifact/BdXmEgsTPK2567g9AFQCXa. Created inception/requirements/requirement-verification-questions.md (12 content questions + security, PBT and Operations opt-ins). Findings: only newborn/zwangerschap/gezin have packages; loveshoot and portret have 2 photos each; no deposit or delivery-time content exists anywhere." + +**Context**: Requirements Analysis, Step 6 — awaiting answers (gate). + +--- + +## Requirements Analysis — Design Feedback + +**Timestamp**: 2026-10-29T18:10:00Z + +**User Input**: "We hebben de foto's bekeken. Optie A is het beste, maar met een paar aanpassingen. Het stukje \"Pakket\" mag vervangen worden met de stijl van Pakket van optie B. Ook zou ik graag een wat visuelere tijdlijn zien. Als het past nog gewoon horizontaal met icoontjes in plaats van nummers en de tekst om en om aan de ene kant van de lijn en dan de andere kant. Kan je dat in Ontwerp D verwerken?" + +**AI Response**: "Delegated design D to a sub-agent (opus): direction A as base, B's package section, horizontal icon timeline with step texts alternating above/below the line (vertical on narrow screens), plus a phone board of the timeline. To be published on the same canvas." + +**Context**: Requirements Analysis — design iteration before the questions are answered. + +--- + +## Requirements Analysis — Answers Received + +**Timestamp**: 2026-10-29T18:35:00Z + +**User Input**: "ik heb de vragen beantwoord" — answers in requirement-verification-questions.md: Q1 "D + de FAQ van optie C. Zet dat eventueel als Design E in de design asset zodat ik hem nog kan bekijken voordat het gebouwd wordt."; Q2 A; Q3 A; Q4 A; Q5 "X, De termijn voor nu is voor alles 2-3 weken"; Q6 "A, €50,-"; Q7 A; Q8 A; Q9 "A, dit kan een mix zijn van specifieke vragen voor dat type shoot en algemene vragen."; Q10 "A, Andrea levert later meer foto's aan"; Q11 B; Q12 A; Security A; PBT A; Operations B. + +**AI Response**: "No contradictions. Open point: deposit settlement and refund policy → requirement-clarification-questions.md (2 questions) with my reading of Q1+Q3 and Q2+Q4 stated for correction. Design E (D + FAQ from C, confirmed € 50 and 2–3 weken filled in) delegated to a sub-agent (sonnet)." + +**Context**: Requirements Analysis — clarification round. + +--- + +## Requirements Analysis — Clarifications Received + +**Timestamp**: 2026-10-29T19:05:00Z + +**User Input**: "Ik heb de vragen beantwoord" — requirement-clarification-questions.md: Verduidelijkingsvraag 1 A (deposit settled against the total, remainder paid after the shoot); Verduidelijkingsvraag 2 B (cancellation/rescheduling not mentioned on the site). Stated readings (loveshoot/portret "Prijs op aanvraag" + 2 photos; URLs under /soorten-fotoshoots/, anchors kept) left uncorrected → accepted. + +**AI Response**: "Design E published on the canvas (version 5). requirements.md delegated to a sub-agent (opus) with all answers, design E, and the Security Baseline and PBT rules." + +**Context**: Requirements Analysis — Step 7 (generate requirements document). + +--- + +## Requirements Analysis — Design Confirmed + +**Timestamp**: 2026-10-29T19:08:00Z + +**User Input**: "Ja, design is E de basis" + +**AI Response**: "Recorded design E as the confirmed basis for the requirements." + +**Context**: Requirements Analysis — design decision. + +--- + +## Requirements Analysis — Approval Prompt + +**Timestamp**: 2026-10-29T19:25:00Z + +**User Input**: "(none)" + +**AI Response**: "requirements.md written by a sub-agent (opus) and reviewed by the orchestrator: 13 FR, 5 SEO, 7 NFR, 5 content requirements, Security/PBT compliance tables, traceability. Presented the completion message with options Request Changes / Add User Stories / Continue to Workflow Planning." + +**Context**: Requirements Analysis — awaiting approval. + +--- + +## Requirements Analysis — Change Request + +**Timestamp**: 2026-10-29T19:32:00Z + +**User Input**: "De newbornshoot is ietsje anders dan de rest. Je bent daar afhankelijk van wanneer de baby geboren wqordt. dus die tekst mag blijven staan." + +**AI Response**: "Moved the Newborn 'voorlopige datum … schuiven mee' line from CON-ST-04 (open) to CON-ST-01 (fixed facts) as a Newborn-specific exception to Clarification 2 = B; other shoots get no such line. Re-presented the approval prompt." + +**Context**: Requirements Analysis — requirements.md updated; awaiting approval. + +--- + +## Requirements Analysis — Approval + +**Timestamp**: 2026-10-29T19:40:00Z + +**User Input**: "ga verder" + +**AI Response**: "Requirements approved; User Stories skipped; proceeding to Workflow Planning." + +**Context**: Requirements Analysis complete. + +--- + +## Workflow Planning — Approval Prompt + +**Timestamp**: 2026-10-29T19:55:00Z + +**User Input**: "(none)" + +**AI Response**: "Created inception/plans/execution-plan.md: risk Medium; execute Application Design (standard), Functional Design (units 2, 3), Code Generation (3 units: 1 content+SEO foundation → 2 shoot page UI ∥ 3 navigation submenu), Build and Test; skip RE, User Stories, Units Generation, NFR Requirements/Design, Infrastructure Design, Operations. Content approval gate by Andrea before merge. Presented approval prompt." + +**Context**: Workflow Planning — awaiting approval. + +--- + +## Workflow Planning — Approval + +**Timestamp**: 2026-10-29T20:00:00Z + +**User Input**: "continue to next stage" + +**AI Response**: "Plan approved; proceeding to Application Design (delegated to an opus sub-agent)." + +**Status**: Approved + +**Context**: Workflow plan created with 5 stages to execute (Application Design, Functional Design ×2, Code Generation ×3, Build and Test). + +--- + +## Application Design — Design Written, Questions Created + +**Timestamp**: 2026-10-29T20:20:00Z + +**User Input**: "(none)" + +**AI Response**: "Sub-agent (opus) wrote application-design.md, components.md, component-methods.md, services.md, component-dependency.md and plans/application-design-plan.md. Recommendation: five static route files + overview moved to soorten-fotoshoots/index.tsx; pure shootPageView feeding both the page and the JSON-LD; units 2 and 3 have disjoint file sets. Six user decisions (D1–D6) put in inception/application-design/application-design-questions.md. Risks noted: TanStack prefix-active links → aria-current on parents, no node_modules in the worktree, Lighthouse sync test checks order, MobileNav cannot scroll, main bundle growth vs the / 0.8 budget." + +**Context**: Application Design — awaiting answers. + +--- + +## Application Design — Answers Received + +**Timestamp**: 2026-10-30T08:00:00Z + +**User Input**: "ik heb de vragen beantwoord" — application-design-questions.md: Q1 A, Q2 A, Q3 A, Q4 A, Q5 A, Q6 A. + +**AI Response**: "All answers match the recommendations; design unchanged, confirmation noted in application-design.md. Presented the Application Design completion message." + +**Context**: Application Design — awaiting approval. + +--- + +## Application Design — Approval + +**Timestamp**: 2026-10-30T08:10:00Z + +**User Input**: "continue to next stage" + +**AI Response**: "Application Design approved. Proceeding to CONSTRUCTION, unit 1 (Content and SEO foundation): Functional Design skipped for unit 1 per plan → Code Generation Part 1 (planning)." + +**Context**: Application Design complete. + +--- + +## Code Generation (unit 1) — Plan Approval Prompt + +**Timestamp**: 2026-10-30T08:40:00Z + +**User Input**: "(none)" + +**AI Response**: "Sub-agent (opus) wrote construction/plans/content-and-seo-foundation-code-generation-plan.md: 27 steps tagged [small]/[large]. Deviations from the design surfaced: no typecheck script (use pnpm exec tsc); route tree regenerated via vite build; lighthouserc.d.cts and sitemap.test.ts added to unit 1 scope; old Service @id tests rewritten (D2); Newborn copy drops the package-count sentence and the unconfirmed 'dekens' line; Loveshoot/Portret duration and the gallery step marked DRAFT + OPEN(CON-ST-04); nav/'Lees meer' consistency checks moved to units 3/2. Presented plan approval prompt." + +**Context**: Code Generation unit 1 — Part 1 Planning, awaiting approval. + +--- + +## Code Generation (unit 1) — Plan Approval + +**Timestamp**: 2026-10-30T08:50:00Z + +**User Input**: "approve plan" + +**AI Response**: "Plan approved. Starting Part 2 with sub-agents: sonnet steps 1–2 → parallel opus (content 3–7, 13) and opus (logic/SEO 8–12, 14–15) → opus routes/app tests (16–18, 22) ∥ sonnet registry/config (19–21) → sonnet verification/docs (23–26)." + +**Status**: Approved + +**Context**: Code Generation unit 1 — Part 2 Generation. + +--- + +## Orchestration — Model Choice + +**Timestamp**: 2026-10-30T09:20:00Z + +**User Input**: "Is het echt nodig om beide agents in opis te doen en niet in sonnet of misschien zelfs Haiku?" … "Houd ze aan en pas de verdeling vanaf hier aan. Als het kan wil ik dat jij de enige Opus bent. Verder wil ik het liefst Haiku gebruiken en anders Sonnet. De agent moet natuurlijk wel de taak aankunnen" + +**AI Response**: "Running Opus agents kept. From here: orchestrator is the only Opus; Haiku for mechanical steps (19–21, 25–26), Sonnet for routes/app tests (16–18, 22), verification (23–24), functional designs and reviews. Recorded in aidlc-state.md § Orchestration and in memory." + +**Context**: Code Generation unit 1 — Part 2; orchestration change. + +--- + +## Code Generation (unit 1) — Completion Prompt + +**Timestamp**: 2026-10-30T12:30:00Z + +**User Input**: "(none)" + +**AI Response**: "Unit 1 generated by sub-agents (Steps 1–26; Step 24 not green). Verification: lint/format/tsc clean; 90 files / 595 tests pass; coverage 95.4 % lines; build OK; lockfile unchanged; shoot content only in route chunks. pnpm check stops at audit:deps (seroval@1.6.7 advisories, identical lockfile on master → pre-existing). Lighthouse: desktop all green (shoot pages 100); mobile shoot pages 0.90, '/' 0.76 and '/contact' 0.85 fail — master measured the same way fails too (0.78 / 0.87). Router matches paths case-insensitively (left unchanged). Asked the user to choose the seroval fix (A separate branch from master / B commit on this branch) and presented the unit 1 completion message." + +**Context**: Code Generation unit 1 — awaiting approval. + +--- + +## Code Generation (unit 1) — Seroval Fix and Content Review + +**Timestamp**: 2026-10-30T13:10:00Z + +**User Input**: "kan je toelichten wat het probleem met seroval is?" … "ja, doe maar optie A voor de seroval fix. Kan jij 1 bestand maken met alle conceptteksten en waar ze te vinden zijn zodat ik die aan Andrea kan geven en zij alvast kan kijken wat ze ermee wil of dat ze het goedkeurt? Verder ook nog even aangeven waar je hoeveel foto's nodig hebt om de initiële pagina's neer te zetten zoals het design." + +**AI Response**: "Explained the three seroval advisories (fromJSON/fromCrossJSON DoS and callable invocation; not reachable in this client-only SPA, seroval absent from the bundle, but the audit gate blocks). Option A: worktree ../AndreaSlopFotografie-seroval-fix on branch fix/seroval-advisories from origin/master 18e81d0; fix delegated to a sonnet sub-agent (no commit until the user asks). Review document for Andrea (Word + Markdown copy in construction/content-review/) with all DRAFT texts, open questions and photo needs per shoot delegated to a sonnet sub-agent." + +**Context**: Unit 1 still awaiting approval; side tasks in progress. + +--- + +## Seroval Fix — Merged + +**Timestamp**: 2026-10-30T08:50:00Z + +**User Input**: "ja je mag de seroval fix committen pushen en pr maken en meteen afronden zodat we hier verder kunnen" + +**AI Response**: "Committed ddc3743 on fix/seroval-advisories (pnpm overrides seroval/seroval-plugins ^1.6.8 → 1.7.3), pushed, PR #12. CI run 583: check green; lighthouse job failed in pnpm/action-setup with exit code -1 (runner glitch, same step passed in check) → rerun via API (job 4820) green. Merged PR #12 (merge commit 1416497, branch deleted on the server). Peer session unreachable for the merge announcement. Fast-forwarded feature/shoot-type-pages to 1416497 (unit 1 still uncommitted, no conflicts); pnpm install, audit:deps clean, tsc clean, 90 files / 595 tests green. Fix worktree removed from git; its folder could not be deleted (long paths, removal blocked) — left for the user." + +**Context**: Unit 1 still awaiting approval. + +--- + +## Code Generation (unit 1) — Approval + +**Timestamp**: 2026-10-30T09:00:00Z + +**User Input**: "ga verder naar de volgende stage. Andrea controleert ondertussen de teksten en de foto's" + +**AI Response**: "Unit 1 approved (still uncommitted). active-features.md → 🟢 Construction. Starting Functional Design for unit 2 (Shoot page UI) and unit 3 (Navigation submenu) in parallel with sonnet sub-agents; Andrea reviews the texts and photos meanwhile." + +**Status**: Approved + +**Context**: Code Generation unit 1 complete; CONSTRUCTION - Functional Design units 2 and 3. + +--- + +## Functional Design (units 2 and 3) — Questions Created + +**Timestamp**: 2026-10-30T09:40:00Z + +**User Input**: "(none)" + +**AI Response**: "Sonnet sub-agents wrote provisional functional designs (based on their recommended options) for unit 2 shoot-page-ui (7 questions) and unit 3 navigation-submenu (5 questions). Orchestrator added two deviation questions: unit 3 Q6 (pure navMenuReducer in new lib/navMenuState.ts) and unit 2 Q8 (optional MediaText mediaSize='medium' and CallToAction tone). Noted: test/arbitraries.ts appends from units 2 and 3 must run sequentially; 1024 px nav fit and Lighthouse with real photos are estimates until Code Generation." + +**Context**: Functional Design units 2 and 3 — awaiting answers. + +--- + +## Functional Design (units 2 and 3) — Answers Received in Chat + +**Timestamp**: 2026-10-30T10:00:00Z + +**User Input**: "kan je de vragen hier sturen?" — answers via the chat question dialog: unit 2 — Q1 "In de blokken (Recommended)", Q2 "2 foto's (Recommended)", Q3 "Nee (Recommended)", Q4 "Eigen band (Recommended)", Q5 "Allemaal dicht", Q6 "Tekstlink (Recommended)", Q7 "Uitsnede shootfoto (Recommended)", Q8 "Ja, uitbreiden (Recommended)"; unit 3 — Q1 "Klik/tik/toetsenbord (Recommended)", Q2 "Zoals hoofdmenu (Recommended)", Q3 "Dicht, open op shootpagina (Recommended)", Q4 "Ja, sluiten (Recommended)", Q5 "Korte animatie (Recommended)", Q6 "Ja, reducer (Recommended)". + +**AI Response**: "Questions asked in chat at the user's request (deviation from the file-based question format, answers written back into the question files). Only change from the provisional designs: all FAQ items closed on load. Haiku sub-agent records the answers, finalises the FD artifacts, and adds the approved deviations (MediaText mediaSize, CallToAction tone, lib/navMenuState.ts) to the application design ownership table." + +**Context**: Functional Design units 2 and 3 — finalising before approval. + +--- + +## Functional Design (units 2 and 3) — Approval Prompt + +**Timestamp**: 2026-10-30T10:15:00Z + +**User Input**: "(none)" + +**AI Response**: "Answers recorded in both question files; FD artifacts finalised (unit 2 FAQ all closed on load, faqInitiallyOpen dropped); approved deviations added to application-design.md and services.md. Presented the Functional Design completion messages for shoot-page-ui and navigation-submenu." + +**Context**: Functional Design units 2 and 3 — awaiting approval. + +--- + +## Functional Design (units 2 and 3) — Approval + +**Timestamp**: 2026-10-30T10:25:00Z + +**User Input**: "continue to next stage" + +**AI Response**: "Both functional designs approved. Starting Code Generation Part 1 (plans) for units 2 and 3 in parallel with sonnet sub-agents; unit 3 keeps its test generators out of test/arbitraries.ts to avoid a shared file." + +**Status**: Approved + +**Context**: Functional Design complete for units 2 and 3. + +--- + +## Code Generation (units 2 and 3) — Plan Approval Prompt + +**Timestamp**: 2026-10-30T10:50:00Z + +**User Input**: "(none)" + +**AI Response**: "Sonnet sub-agents wrote shoot-page-ui-code-generation-plan.md (27 steps, incl. a STOP for OG crop approval) and navigation-submenu-code-generation-plan.md (20 steps, incl. the D5 bundle gate, a real-browser 1024 px check via puppeteer-core outside the repo, and a Lighthouse median-of-three comparison against the unit-1 baseline). Orchestrator corrected unit 2 Step 22: the branch already contains the seroval patch (1416497, seroval@1.7.3), so audit:deps is part of the gate. Findings: router `exact` is case-sensitive and includes search by default → plan uses { exact: true, includeSearch: false }; Gezin OG source changed to f41a7138-groot (f41a1579 is already og-portfolio.jpg); no image tool installed → System.Drawing/Pillow in the scratchpad. Presented both plans for approval." + +**Context**: Code Generation units 2 and 3 — Part 1 Planning, awaiting approval. + +--- + +## Code Generation (units 2 and 3) — Plan Approved +**Timestamp**: 2026-10-30T12:27:54Z +**User Input**: "approve plan" +**AI Response**: Both plans approved. Part 2 started: unit 2 (shoot-page-ui) Steps 1–2 by a Sonnet agent, stopping for OG-crop approval; unit 3 (navigation-submenu) Steps 1–16 by a Sonnet agent in parallel, stopping before the port-4173 steps 17–18. Only unit 3 runs builds in the shared worktree. +**Context**: CONSTRUCTION - Code Generation Part 2 + +--- diff --git a/aidlc-docs/features/shoot-type-pages/construction/content-and-seo-foundation/code/code-summary.md b/aidlc-docs/features/shoot-type-pages/construction/content-and-seo-foundation/code/code-summary.md new file mode 100644 index 0000000..5519997 --- /dev/null +++ b/aidlc-docs/features/shoot-type-pages/construction/content-and-seo-foundation/code/code-summary.md @@ -0,0 +1,164 @@ +# Code Summary — Unit 1: Content and SEO foundation + +Plan: [content-and-seo-foundation-code-generation-plan.md](../../plans/content-and-seo-foundation-code-generation-plan.md). Branch `feature/shoot-type-pages` (from master `18e81d0`), worktree `AndreaSlopFotografie-shoot-type-pages`. + +## Status +- Steps 1–23 done (checked in the plan). Step 24 (full gate with Lighthouse) is **not green**: `pnpm check` stops at `audit:deps` and two mobile Lighthouse budgets fail; both also fail on master (see Checks). +- Steps 25–26 done with this summary and the reverse-engineering lines. + +## Commits +None. The unit is uncommitted in the worktree. A commit (and a push) is made only when the user asks. + +## Files + +### Routes +- Moved: `web/src/routes/soorten-fotoshoots.tsx` → `web/src/routes/soorten-fotoshoots/index.tsx` (overview; anchors unchanged; WebPage JSON-LD via `StructuredData`) +- Created: `web/src/routes/soorten-fotoshoots/{newborn,zwangerschap,gezin,loveshoot,portret}.tsx` (`/soorten-fotoshoots/`; `shootPageView` in the component, `NotFound` when it returns `undefined`, one `StructuredData` per object of `shootPageGraph`) +- Created: `web/src/routes/soorten-fotoshoots/-shootPageSources.ts` (`shootPageSources`, shared by the five shoot routes; `portfolioShoots` computed as the overview does) +- Regenerated: `web/src/routeTree.gen.ts` (`pnpm exec vite build`, not hand-edited) + +### Content +- Modified: `web/src/content/types.ts` (added `StoryBlock`, `FaqItem`, `ProcessStepId`, `ProcessStepContent`, `DepositInfo`, `ShootPageShared`, `ShootPageContent`; no existing type changed) +- Created: `web/src/content/shootPageShared.ts` (breadcrumb, process, deposit, photos/FAQ/offer texts, shared FAQ items `deliveryFaq`, `bookingFaq`, `replyFaq`) +- Created: `web/src/content/shootPages/{newborn,zwangerschap,gezin,loveshoot,portret}.ts` (one `ShootPageContent` per shoot) +- Created: `web/src/content/shootPages/shootPages.test.ts` (content consistency over the five pages) +- Modified: `web/src/content/shootTypes.ts` (draft marker replaces the old comment; no data change) + +### Lib +- Created: `web/src/lib/shootPages.ts` (+ `.test.ts`): `SHOOT_TYPES_PATH`, `SHOOT_TYPE_IDS`, `shootPagePath`, `shootIdFromSlug`, `shootIdFromPath`, `EveryShootHasARoute` (compile-time guard) +- Created: `web/src/lib/shootPackage.ts` (+ test): the visible package of a shoot, else `undefined` +- Created: `web/src/lib/fillPlaceholders.ts` (+ test): `fillPlaceholders`, `fillRichText` +- Created: `web/src/lib/richTextToPlain.ts` (+ test) +- Created: `web/src/lib/shootPageView.ts` (+ test): `shootPageView(id, page, sources)`, `MOSAIC_MIN_PHOTOS`, `PROCESS_STEP_ORDER`, view types +- Modified: `web/src/lib/shootLinks.ts` (+ test): `shootContactLink` takes `pakket` from `shootPackage`; existing tests unchanged + +### SEO and page registry +- Modified: `web/src/seo.ts` (+ test): `shootServiceId`, `shootService`, `breadcrumbList`, `faqPage`, `shootPageGraph`; `shootServices` keeps its signature (Service `@id` now `…/soorten-fotoshoots/#service`, D2) +- Modified: `web/src/sitePages.ts`: five entries after `/soorten-fotoshoots` (draft titles and descriptions, `indexed: true`, no `ogImage`) +- Modified: `web/lighthouserc.cjs` (five paths in `indexedPaths` and `photoPagePaths`), `web/lighthouserc.d.cts` (declares `photoPagePaths`) +- Modified: `web/src/sitemap.test.ts` (five URLs in the indexed list) + +### Components +- Created: `web/src/components/StructuredData/StructuredData.tsx` (+ test): the only `dangerouslySetInnerHTML` of the shoot pages (`jsonLdScript`) +- Created: `web/src/components/shoots/ShootPage/ShootPage.tsx` (+ test): shell with `PageIntro` only (the one h1); unit 2 adds the sections + +### Tests +- Modified: `web/src/app.test.tsx` (per-page shell, head, JSON-LD, not-found and registry tests; imports `renderApp`/`expectShell`) +- Created: `web/src/test/renderApp.tsx` (`renderApp(path)`, `expectShell()`) +- Modified: `web/src/test/arbitraries.ts` (appended generators; `image` exported as `contentImage`, definition unchanged) +- Modified: `web/src/seo.test.ts` (old anchor-id tests rewritten for the D2 ids; examples and PBT for the new builders) + +### Documentation +- Created: `aidlc-docs/features/shoot-type-pages/construction/content-and-seo-foundation/code/{draft-list,open-list}.txt` (grep output, Step 23) +- Modified: `aidlc-docs/_shared/reverse-engineering/{api-documentation,code-structure,architecture}.md` (own lines only, Step 26) + +## Requirement coverage +| Requirement | Where | Status | +|---|---|---| +| FR-ST-01 Routes, path helpers, not-found | `routes/soorten-fotoshoots/*`, `lib/shootPages.ts`, app tests | Done | +| FR-ST-02..08 Data and view (intro, stories, timeline, photos, FAQ, package, CTA) | `content/shootPages/*`, `lib/shootPageView.ts` | Done (UI sections are unit 2) | +| FR-ST-09 Overview anchors kept | `routes/soorten-fotoshoots/index.tsx` | Done | +| FR-ST-11 Content model | `content/types.ts`, `content/shootPageShared.ts`, `content/shootPages/*` | Done | +| FR-ST-12 Registry, sitemap, Lighthouse | `sitePages.ts`, `lighthouserc.cjs`, `sitemap.test.ts`, `app.test.tsx` | Done | +| SEO-ST-01, SEO-ST-02 (title/description drafts) | `seo.ts`, `sitePages.ts` | Done (drafts) | +| SEO-ST-03 Service, Offer, BreadcrumbList, FAQPage | `seo.ts`, `StructuredData` | Done | +| NFR-ST-03 Code splitting | Shoot pages in their route chunks (Step 23 check) | Done | +| NFR-ST-04 One source per fact | Placeholders (D8), `shootPackage`, `shootPageView` | Done | +| NFR-ST-05 Security | See the compliance table | Done, one open finding (seroval, pre-existing) | +| NFR-ST-06 Testing | PBT plus example tests, 100 % coverage of `src/lib/**`, `seo.ts`, `sitemap.ts` | Done | +| CON-ST-01..05 Content rules | Drafts and open facts (below), no invented facts | Open items for Andrea | + +## Route tree check (Step 18) +- `web/src/routeTree.gen.ts` regenerated with `pnpm exec vite build`. Keys: `'/soorten-fotoshoots'` (index, trimmed) and `'/soorten-fotoshoots/'` for the five ids, all children of the root route (no layout). +- `pnpm exec tsc` is clean; `EveryShootHasARoute` (every `ShootPagePath` is a `RoutePath`) compiles. + +## Test results (Step 23) +- Baseline (Step 1, before the unit): 82 files, 460 tests, fast-check seed 801597296. +- After the unit: `pnpm test`, 90 files, 595 tests, all passing, fast-check seed 1143769900. Coverage thresholds met (overall 94.92 % statements, 91.48 % branches; 100 % on `src/lib/**`, `seo.ts`, `sitemap.ts`). +- `pnpm lint`, `pnpm format:check`, `pnpm exec tsc`: clean. +- `pnpm build`: ok. + +## Bundle check (Step 23, NFR-ST-03) +- Main chunk `index-D0huvRmx.js`: 528.98 kB / 150.69 kB gzip. Master dist (possibly stale) was about 512.6 KiB, so the increase is about +4 kB for the route tree and `sitePages`. Step 24 measured master fresh at 527.27 kB / 150.31 kB gzip (+1.7 kB raw, +0.38 kB gzip), within single-run noise. +- A Newborn-only string ("Uit eerdere newbornshoots") appears only in `newborn-*.js`, not in `index-*.js`. +- Lockfile, `package.json` and `config/securityHeaders.ts` unchanged (`git diff --exit-code`). + +## Checks and Lighthouse (Step 24, not green) +- `pnpm check` stops at `audit:deps`: `seroval@1.6.7` gives 3 high and 2 moderate advisories (via `@tanstack/react-router` → `router-core`; patched in ≥ 1.6.8). `pnpm-lock.yaml` and `package.json` are identical to master, so master fails the same way. Fix pending the user's choice (separate fix from master, or on this branch). +- Lighthouse, desktop: exit 0; all pages 99–100; the five shoot pages 100 in all four categories. +- Lighthouse, mobile: the five shoot pages 0.90 performance (budget 0.9 met), accessibility, best practices and SEO 1.0 on every indexed page. Failing budgets: `/` 0.76 (budget 0.8) and `/contact` 0.85 (budget 0.9). Master measured the same way: `/` 0.78 and `/contact` 0.87, so these are the known baseline issue. This branch is about 0.01–0.02 lower on the old pages; to re-measure after unit 3 (D5). +- The shell has no photo yet, so the shoot-page scores are not representative of unit 2. + +## Deviations from the plan +- **Case-insensitive path matching (known, not changed):** TanStack Router matches paths case-insensitively by default, so `/soorten-fotoshoots/Newborn` renders the Newborn page instead of a 404. The canonical URL stays lowercase. The router-wide `caseSensitive` option is left unchanged (decision for the orchestrator; setting it would also change the other routes). `app.test.tsx` asserts the current behaviour for this slug; the other two invalid slugs give the 404. +- Step 8: `shootPageContent(id?, reuse = [])` takes the shoot's main and detail images as an optional second argument (the generator cannot know the shoot's `src` otherwise). Stray `{` in generated text is opening only (a stray `{` and `}` around a filled placeholder could form a new one). +- Step 14: `seo.test.ts` example and PBT titles renamed to the D2 ids ("gives every service the id and URL of its own shoot page (invariant)"). +- Step 17: the comment above `StructuredData` says "StructuredData escapes" instead of "jsonLdScript escapes". +- Step 20: the `photoPagePaths` comment grew by two lines instead of one. +- Steps 12, 14 and 18: type errors that existed only until the routes existed (`BreadcrumbItem.to`, `faqPage`/`webPage` paths) resolved in Step 18; no cast was added. + +## For review (content) +- Story 4 of Newborn keeps design E's "1 tot 2 uur" (the same figure as the package feature "1-2 uur fotografie"). It was kept because the plan says design E headings and paragraphs; Andrea may want it removed. +- Design E's "Na afloop krijg je minstens 40 … foto's" and "Ik neem alles mee wat ik nodig heb" were dropped (package figure as free text, CON-ST-04). + +## Draft inventory (CON-ST-03, for Andrea's review) +Every line below is an `// DRAFT(CON-ST-03): awaiting Andrea's approval` marker in `web/src` (98 in total, from the Step 23 grep). The marker sits directly above the drafted field or block. Line numbers are those of the marker. + +- **Newborn** (`content/shootPages/newborn.ts`, 15): lines 27, 34, 51, 67, 87, 109, 111, 117, 144, 147, 155, 163, 171, 180, 185 +- **Zwangerschap** (`content/shootPages/zwangerschap.ts`, 14): lines 30, 37, 54, 66, 78, 91, 94, 100, 108, 111, 119, 127, 139, 144 +- **Gezin** (`content/shootPages/gezin.ts`, 13): lines 31, 38, 55, 67, 79, 92, 95, 101, 109, 112, 120, 132, 137 +- **Loveshoot** (`content/shootPages/loveshoot.ts`, 13): lines 23, 30, 42, 53, 64, 77, 79, 86, 102, 105, 113, 125, 130 +- **Portret** (`content/shootPages/portret.ts`, 13): lines 23, 30, 42, 53, 65, 78, 81, 88, 104, 107, 115, 127, 132 +- **Shared** (`content/shootPageShared.ts`, 19): lines 7, 17, 29, 46, 48, 50, 55, 60, 65, 70, 75, 80, 89, 94, 98, 100, 108, 110, 114 (process eyebrow/title and steps, photos/FAQ/offer texts, shared FAQ items, deposit note, button labels) +- **Overview** (`content/shootTypes.ts`, 1): line 70 (Gezin overview text, Step 7) +- **Registry** (`sitePages.ts`, 10): lines 65, 67, 73, 75, 81, 83, 89, 91, 97, 99 (title and description of the five shoot pages) + +## Open facts (CON-ST-04) +Seven `// OPEN(CON-ST-04)` markers in `web/src` (Step 23 grep). Each one is a question for Andrea; the text is in the code. +1. **Deposit scope and remainder timing:** does the deposit also apply to Loveshoot and Portret, and when exactly is the remainder paid after the shoot (before delivery)? `content/shootPageShared.ts` lines 18 and 90 (the deposit note and the booking FAQ). +2. **Online gallery:** is there an online gallery for Loveshoot and Portret too (confirmed only for the three packages)? `content/shootPageShared.ts` line 81 (process step "oplevering"). +3. **Loveshoot duration:** `content/shootPages/loveshoot.ts` line 80 (`process.duration` has no figure yet). +4. **Portret duration:** `content/shootPages/portret.ts` line 82. +5. **Portret locations (natuur / zakelijk):** `content/shootPages/portret.ts` lines 54 (`process.location`) and 79 (story on the location). + +## Interfaces for units 2 and 3 +- `ShootPageView`, `shootPageView(id, page, sources)`, `ShootPageSources`, `MOSAIC_MIN_PHOTOS` (= 2, confirmed in FD unit 2), `PROCESS_STEP_ORDER` (`lib/shootPageView.ts`). Shape per component-methods.md, unchanged. +- `ShootPage` shell (`components/shoots/ShootPage/ShootPage.tsx`, `{ view }`): unit 2 adds the sections in the order of the page structure. +- `renderApp(path)`, `expectShell()` (`test/renderApp.tsx`). +- Generators (`test/arbitraries.ts`): `placeholderName`, `textWithPlaceholders`, `inlineLink`, `richText`, `storyBlock`, `faqItem`, `shootPageShared`, `shootPageContent(id?, reuse?)`, `slugInput`, `contentImage`. +- `shootPageSources` (route sources), `shootServiceId`, `shootPageGraph`, `shootPagePath`, `EveryShootHasARoute`. +- Not in this unit: OG images, LAYOUT.md and the "Lees meer" links (unit 2); navigation submenu (unit 3). + +## Consistency facets left to units 2 and 3 +- Nav-child facet of the registry consistency (NFR-ST-06): unit 3, `navigation.test.ts`. +- "Lees meer" facet: unit 2, `shootPages.test.tsx`. +- The rest of the registry consistency (route, `sitePages`, sitemap, Lighthouse lists, no other `/soorten-fotoshoots/…` path) is tested in `app.test.tsx` (Step 22). + +## Open decisions for the orchestrator and user +1. Case-sensitive routing (`caseSensitive: true` in `main.tsx` and `renderApp`) or keep the current behaviour. +2. The seroval advisory: separate fix from master, or on this branch. +3. Re-run the Lighthouse gate on `/` and `/contact` (baseline failures on master). +4. Andrea's review of the 98 drafts and 7 open facts. +5. Commit and push, when the user asks. + +## Security and PBT compliance (final) +| Rule | Status | Evidence | +|---|---|---| +| SECURITY-04 HTTP headers | Compliant | `securityHeaders.ts` unchanged (Step 23); JSON-LD only through `StructuredData`/`jsonLdScript` | +| SECURITY-05 Input validation | Compliant | No route parameters; `shootIdFromSlug`/`shootIdFromPath` accept only known ids (Step 9); `?pakket=` only from `shootPackage` (Steps 10, 12) | +| SECURITY-09 Hardening | Compliant | No `console.` in new code (Step 23 grep); no bracketed design placeholders (Step 13 test); 98 drafts marked and to be gated (D3) | +| SECURITY-10 Supply chain | Compliant for this unit | `--frozen-lockfile`; lockfile and `package.json` unchanged. Open: `audit:deps` fails on `seroval` (pre-existing on master, Step 24) | +| SECURITY-11 Secure design | Compliant | Text and typed links only; `dangerouslySetInnerHTML` only in `StructuredData`; no e-mail address in structured data (Step 14 PBT) or content (Step 13) | +| SECURITY-13 Integrity | Compliant | Only bundled photos; no CDN | +| SECURITY-15 Fail-safe | Compliant | Unknown slug → 404 (Step 22); missing shoot or id mismatch → `NotFound` (Steps 12, 18); invalid package → "Prijs op aanvraag" data (Steps 10, 12); too few photos → no mosaic (Step 12). `/soorten-fotoshoots/Newborn` renders the page (case deviation above) | +| SECURITY-01, -02, -03, -06, -07, -08, -12, -14 | N/A | No data stores, intermediaries, server code, IAM, network, auth or alerting | +| PBT-01 Identification | Compliant | Properties from services.md mapped to steps 9–14 | +| PBT-02 Round trip | Compliant | Slug/path ↔ id (Step 9); `JSON.parse ∘ jsonLdScript` for every new builder (Step 14) | +| PBT-03 Invariants | Compliant | `shootIdFromSlug/Path`, `shootPackage`, `shootContactLink`, `fillPlaceholders`, `richTextToPlain`, `shootPageView`, `breadcrumbList`, `faqPage`, `shootService(s)` (Steps 9–14) | +| PBT-04 Idempotency | Compliant | `fillPlaceholders`/`fillRichText` (Step 11) | +| PBT-05 Oracle | N/A | No reference implementation (oracle-style per-piece check for `fillRichText` only) | +| PBT-06 Stateful | N/A | No state in unit 1 | +| PBT-07 Generators | Compliant | Domain generators in `src/test/arbitraries.ts` (Step 8), reused by units 2 and 3 | +| PBT-08 Shrinking/reproducibility | Compliant | fast-check shrinking untouched; global seed from `config/testSeed.ts`, logged every run | +| PBT-09 Framework | Compliant | fast-check already a dependency | +| PBT-10 Complementary | Compliant | Example tests per helper, content tests (Step 13), route and registry tests (Step 22) alongside the PBT; tests labelled "(invariant)", "(round trip)", "(idempotency)" | diff --git a/aidlc-docs/features/shoot-type-pages/construction/content-and-seo-foundation/code/draft-list.txt b/aidlc-docs/features/shoot-type-pages/construction/content-and-seo-foundation/code/draft-list.txt new file mode 100644 index 0000000..0bc2506 --- /dev/null +++ b/aidlc-docs/features/shoot-type-pages/construction/content-and-seo-foundation/code/draft-list.txt @@ -0,0 +1,98 @@ +src\sitePages.ts:65: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\sitePages.ts:67: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\sitePages.ts:73: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\sitePages.ts:75: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\sitePages.ts:81: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\sitePages.ts:83: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\sitePages.ts:89: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\sitePages.ts:91: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\sitePages.ts:97: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\sitePages.ts:99: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\newborn.ts:27: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\newborn.ts:34: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\newborn.ts:51: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\newborn.ts:67: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\newborn.ts:87: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\newborn.ts:109: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\newborn.ts:111: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\newborn.ts:117: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\newborn.ts:144: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\newborn.ts:147: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\newborn.ts:155: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\newborn.ts:163: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\newborn.ts:171: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\newborn.ts:180: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\newborn.ts:185: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\loveshoot.ts:23: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\loveshoot.ts:30: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\loveshoot.ts:42: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\loveshoot.ts:53: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\loveshoot.ts:64: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\loveshoot.ts:77: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\loveshoot.ts:79: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\loveshoot.ts:86: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\loveshoot.ts:102: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\loveshoot.ts:105: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\loveshoot.ts:113: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\loveshoot.ts:125: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\loveshoot.ts:130: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\portret.ts:23: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\portret.ts:30: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\portret.ts:42: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\portret.ts:53: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\portret.ts:65: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\portret.ts:78: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\portret.ts:81: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\portret.ts:88: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\portret.ts:104: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\portret.ts:107: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\portret.ts:115: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\portret.ts:127: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\portret.ts:132: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootTypes.ts:70: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\zwangerschap.ts:30: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\zwangerschap.ts:37: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\zwangerschap.ts:54: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\zwangerschap.ts:66: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\zwangerschap.ts:78: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\zwangerschap.ts:91: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\zwangerschap.ts:94: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\zwangerschap.ts:100: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\zwangerschap.ts:108: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\zwangerschap.ts:111: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\zwangerschap.ts:119: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\zwangerschap.ts:127: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\zwangerschap.ts:139: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\zwangerschap.ts:144: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPageShared.ts:7:// DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPageShared.ts:17:// DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPageShared.ts:29:// DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPageShared.ts:46: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPageShared.ts:48: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPageShared.ts:50: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPageShared.ts:55: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPageShared.ts:60: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPageShared.ts:65: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPageShared.ts:70: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPageShared.ts:75: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPageShared.ts:80: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPageShared.ts:89: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPageShared.ts:94: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPageShared.ts:98: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPageShared.ts:100: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPageShared.ts:108: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPageShared.ts:110: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPageShared.ts:114: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\gezin.ts:31: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\gezin.ts:38: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\gezin.ts:55: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\gezin.ts:67: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\gezin.ts:79: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\gezin.ts:92: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\gezin.ts:95: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\gezin.ts:101: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\gezin.ts:109: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\gezin.ts:112: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\gezin.ts:120: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\gezin.ts:132: // DRAFT(CON-ST-03): awaiting Andrea's approval +src\content\shootPages\gezin.ts:137: // DRAFT(CON-ST-03): awaiting Andrea's approval diff --git a/aidlc-docs/features/shoot-type-pages/construction/content-and-seo-foundation/code/open-list.txt b/aidlc-docs/features/shoot-type-pages/construction/content-and-seo-foundation/code/open-list.txt new file mode 100644 index 0000000..5713d1c --- /dev/null +++ b/aidlc-docs/features/shoot-type-pages/construction/content-and-seo-foundation/code/open-list.txt @@ -0,0 +1,7 @@ +src\content\shootPages\portret.ts:54: // OPEN(CON-ST-04): locations for the portrait shoot (natuur / zakelijk) +src\content\shootPages\portret.ts:79: // OPEN(CON-ST-04): locations for the portrait shoot (natuur / zakelijk) +src\content\shootPages\portret.ts:82: // OPEN(CON-ST-04): shoot duration for the portrait shoot +src\content\shootPages\loveshoot.ts:80: // OPEN(CON-ST-04): shoot duration for the loveshoot +src\content\shootPageShared.ts:18:// OPEN(CON-ST-04): does the deposit also apply to Loveshoot and Portret, and when exactly is the remainder paid after the shoot (before delivery)? +src\content\shootPageShared.ts:81: // OPEN(CON-ST-04): is there an online gallery for Loveshoot and Portret too (confirmed only for the three packages)? +src\content\shootPageShared.ts:90: // OPEN(CON-ST-04): does the deposit also apply to Loveshoot and Portret, and when exactly is the remainder paid after the shoot (before delivery)? diff --git a/aidlc-docs/features/shoot-type-pages/construction/content-review/andrea-review.md b/aidlc-docs/features/shoot-type-pages/construction/content-review/andrea-review.md new file mode 100644 index 0000000..60e0dc9 --- /dev/null +++ b/aidlc-docs/features/shoot-type-pages/construction/content-review/andrea-review.md @@ -0,0 +1,376 @@ +# Teksten en foto's voor de nieuwe shootpagina's + +*Voor Andrea Slop Fotografie – om door te nemen en goed te keuren* + +## 1. Waar gaat dit over? + +Hoi Andrea, + +Er komen vijf nieuwe pagina's op je website: één voor elke soort fotoshoot (Newborn, Zwangerschap, Gezin, Loveshoot en Portret). Op elke pagina vertel je wat bezoekers kunnen verwachten, hoe een shoot verloopt, wat de veelgestelde vragen zijn en hoe ze kunnen boeken. + +Alle teksten op deze pagina's zijn concepten. Ze zijn geschreven in jouw toon en gebaseerd op de teksten die al op je website staan. Er is niets verzonnen dat je zelf nog niet hebt gezegd: waar we iets niet weten (bijvoorbeeld hoe lang een loveshoot duurt), staat er een vraag voor jou in hoofdstuk 2. Voordat de pagina's live gaan, wil ik dat jij elke tekst hebt gezien. + +#### Zo kun je het doornemen + +- Hoofdstuk 2 bevat de vragen waar ik jouw antwoord op nodig heb. +- Hoofdstuk 3 en 4 bevatten alle teksten. Bij elke tekst staat een tabelrij. Zet bij "Akkoord?" een kruisje bij Akkoord als de tekst goed is, of bij Aanpassen als je iets anders wilt. +- Wil je iets aanpassen? Schrijf dan in de laatste kolom jouw eigen woorden, of een opmerking (bijvoorbeeld "te lang" of "zo zeg ik dat niet"). Jouw eigen formulering gebruik ik dan zoals je hem schrijft. +- Hoofdstuk 5 laat zien welke foto's er op elke pagina komen en hoeveel foto's er nog nodig zijn. +- Het ontwerp van een shootpagina kun je hier bekijken (de voorbeeldpagina is Newborn; de andere vier pagina's hebben dezelfde indeling): https://claude.ai/artifact/BdXmEgsTPK2567g9AFQCXa + +#### Wat je in de teksten tegenkomt + +- Bedragen en termijnen vul ik niet per pagina in, maar worden automatisch ingevuld. Zo staat overal hetzelfde: de aanbetaling is € 50, je reageert binnen 1-2 werkdagen en de opleverduur is 2–3 weken. In de tabellen staan die waarden al ingevuld. Verandert er ooit iets, dan hoeft het maar op één plek aangepast te worden. +- In hoofdstuk 3 staan twee woorden tussen accolades: {locatie} en {duur}. Die worden automatisch vervangen door de zin over de locatie en de duur van de betreffende shoot, die je in hoofdstuk 4 bij elke shoot vindt. Wijzig de zin daar, dan verandert hij ook in de tijdlijn. +- Onderstreepte woorden zijn een link naar je contactpagina. +- Sommige teksten staan op alle pagina's (hoofdstuk 3). Een wijziging daar geldt dus voor alle vijf de shoots. +- Teksten die hangen aan een openstaande vraag hebben onder de tekst een korte verwijzing, bijvoorbeeld "Zie vraag 3". + +In totaal gaat het om 98 teksten of tekstgroepen. De laatste kolom ("Ref.") is alleen voor mij, zodat ik de tekst terugvind; die kun je negeren. + +## 2. Vragen voor jou + +Dit zijn de dingen die ik niet zelf kan of wil invullen. Zonder jouw antwoord laat ik de tekst zoals hij nu is staan of vermeld ik de feiten niet. + +| Nr. | Vraag | Jouw antwoord | +|---|---|---| +| **1** | **Hoe lang duurt een loveshoot?**
Op de pagina staat nu alleen "We stemmen de duur samen af." Bij Gezin en Zwangerschap staat bijvoorbeeld "1 uur fotografie, zonder haast." Welke duur wil je bij de loveshoot noemen? | | +| **2** | **Hoe lang duurt een portretshoot?**
Ook hier staat nu "We stemmen de duur samen af." Welke duur wil je noemen (eventueel verschillend voor natuur en zakelijk)? | | +| **3** | **Welke locaties bied je aan voor portretshoots?**
Nu staat er alleen "We kiezen samen een plek die past bij jou of bij je bedrijf." Zijn er vaste plekken of soorten plekken die je wilt noemen, voor portretten in de natuur en voor zakelijke portretten? | | +| **4** | **Geldt de aanbetaling van € 50 ook voor de loveshoot en de portretshoot?**
Voor Newborn, Zwangerschap en Gezin staat de aanbetaling van € 50 vast. Op de pagina's van Loveshoot en Portret staat die nu ook, maar dat weten we niet zeker. | | +| **5** | **Wanneer betaal je het restbedrag precies?**
Nu staat er "het restbedrag betaal je na de shoot". Is dat direct na de shoot, of voordat je de foto's oplevert? Staat er liever een andere formulering? | | +| **6** | **Krijgen klanten van de loveshoot en de portretshoot ook een persoonlijke online fotogalerij?**
Voor de drie pakketten (Newborn, Zwangerschap, Gezin) is dat bevestigd. Bij stap 6 "Oplevering" staat nu op alle pagina's: "Je foto's staan klaar in je persoonlijke online fotogalerij." | | +| **7** | **Newborn, blok 4: wil je het getal "1 tot 2 uur" in de titel houden?**
De titel van blok 4 is nu "1 tot 2 uur, op het ritme van je baby". Dat is hetzelfde getal als in het pakket ("1-2 uur fotografie"), en het stond zo in het ontwerp. Laat je dit staan, of liever zonder getal? | | + +#### Twee extra vragen (niet verplicht) + +Deze staan niet in de teksten, maar je kunt ze meteen beantwoorden als je ze wilt noemen. + +| Nr. | Vraag | Jouw antwoord | +|---|---|---| +| **8** | **Extra (niet verplicht): hoeveel foto's krijgen klanten bij de loveshoot en de portretshoot?**
Bij de drie pakketten staat "Minstens 30 of 40 zorgvuldig nabewerkte foto's". Voor Loveshoot en Portret noemen de teksten nu geen aantal. | | +| **9** | **Extra (niet verplicht): wat is de beste periode voor een loveshoot of portretshoot?**
Bij Newborn en Zwangerschap noemen we een periode (12 weken, 30 tot 34 weken). Voor Loveshoot en Portret staat er nu niets over. | | + +## 3. Teksten die op elke shootpagina staan + +Deze teksten zijn voor alle shoots hetzelfde. De namen van de zes stappen (Aanvragen, Datum & locatie kiezen, Aanbetaling, De shoot, Bewerking, Oplevering) staan al vast en zijn hier niet opnieuw voorgelegd. + +Waar je "{locatie}" en "{duur}" ziet, komt de zin uit hoofdstuk 4 van de betreffende shoot te staan. Bij de pakketten zelf (inhoud en prijs: Newborn € 185, Zwangerschap € 175, Gezin € 175) staan de teksten al vast. Loveshoot en Portret hebben nog geen pakket en tonen "Prijs op aanvraag". + +| Onderdeel | Concepttekst | Akkoord? | Aanpassing / opmerking | Ref. | +|---|---|---|---|---| +| **Vraag "Wanneer krijg ik de foto's?" (staat op alle vijf de pagina's)** | **Vraag:** Wanneer krijg ik de foto's?
**Antwoord:** Reken op 2–3 weken na de shoot. In die tijd selecteer en bewerk ik de mooiste foto's. | ☐ Akkoord
☐ Aanpassen | | shootPageShared.ts:7 | +| **Vraag "Hoe leg ik de datum vast?" (staat op Zwangerschap, Gezin, Loveshoot en Portret)** | **Vraag:** Hoe leg ik de datum vast?
**Antwoord:** [Stuur een berichtje](/contact), dan kiezen we samen een moment. Met een aanbetaling van € 50 staat je datum vast. De aanbetaling wordt verrekend met het totaalbedrag; het restbedrag betaal je na de shoot.
*Zie vraag 4 en 5 in hoofdstuk 2.* | ☐ Akkoord
☐ Aanpassen | | shootPageShared.ts:17 | +| **Vraag "Hoe snel hoor ik iets van je?" (staat nu op geen enkele pagina, ligt klaar voor later)** | **Vraag:** Hoe snel hoor ik iets van je?
**Antwoord:** Ik reageer binnen 1-2 werkdagen op je berichtje. | ☐ Akkoord
☐ Aanpassen | | shootPageShared.ts:29 | +| **Zo werkt het – klein kopje** | Zo werkt het | ☐ Akkoord
☐ Aanpassen | | shootPageShared.ts:46 | +| **Zo werkt het – titel** | Van aanvraag tot online galerij | ☐ Akkoord
☐ Aanpassen | | shootPageShared.ts:48 | +| **Zo werkt het – inleiding boven de stappen** | Elke shoot volgt dezelfde zes stappen, zodat je precies weet waar je aan toe bent. | ☐ Akkoord
☐ Aanpassen | | shootPageShared.ts:50 | +| **Stap 1 "Aanvragen" – tekst** | Stuur een berichtje. Ik reageer binnen 1-2 werkdagen. | ☐ Akkoord
☐ Aanpassen | | shootPageShared.ts:55 | +| **Stap 2 "Datum & locatie kiezen" – tekst** | We kiezen samen een moment. {locatie} | ☐ Akkoord
☐ Aanpassen | | shootPageShared.ts:60 | +| **Stap 3 "Aanbetaling" – tekst** | Met een aanbetaling van € 50 staat je datum vast. | ☐ Akkoord
☐ Aanpassen | | shootPageShared.ts:65 | +| **Stap 4 "De shoot" – tekst** | {duur} | ☐ Akkoord
☐ Aanpassen | | shootPageShared.ts:70 | +| **Stap 5 "Bewerking" – tekst** | Ik selecteer en bewerk de mooiste foto's. Opleverduur: 2–3 weken. | ☐ Akkoord
☐ Aanpassen | | shootPageShared.ts:75 | +| **Stap 6 "Oplevering" – tekst** | Je foto's staan klaar in je persoonlijke online fotogalerij.
*Zie vraag 6 in hoofdstuk 2.* | ☐ Akkoord
☐ Aanpassen | | shootPageShared.ts:80 | +| **Regel over de aanbetaling in het pakketblok** | Aanbetaling € 50, restbedrag na de shoot.
*Zie vraag 4 en 5 in hoofdstuk 2.* | ☐ Akkoord
☐ Aanpassen | | shootPageShared.ts:89 | +| **Fotomozaïek – klein kopje** | Impressie | ☐ Akkoord
☐ Aanpassen | | shootPageShared.ts:94 | +| **Veelgestelde vragen – klein kopje** | Veelgestelde vragen | ☐ Akkoord
☐ Aanpassen | | shootPageShared.ts:98 | +| **Veelgestelde vragen – tekst onder de vragen** | Staat je vraag er niet tussen? [Stuur gerust een berichtje](/contact). | ☐ Akkoord
☐ Aanpassen | | shootPageShared.ts:100 | +| **Knop "Boek dit pakket" (pakketblok)** | Boek dit pakket | ☐ Akkoord
☐ Aanpassen | | shootPageShared.ts:108 | +| **Knop "Eerst een vraag stellen" (pakketblok)** | Eerst een vraag stellen | ☐ Akkoord
☐ Aanpassen | | shootPageShared.ts:110 | +| **Blok "Prijs op aanvraag" (Loveshoot en Portret)** | **Prijs:** Prijs op aanvraag
**Tekst:** Stuur me een berichtje met wat je in gedachten hebt, dan vertel ik je graag meer over de mogelijkheden en de prijs.
**Linktekst:** Vraag naar de mogelijkheden | ☐ Akkoord
☐ Aanpassen | | shootPageShared.ts:114 | + +Aantal teksten in dit hoofdstuk: 19. + +## 4. De teksten per shoot + +Per shoot staan de teksten in de volgorde waarin ze op de pagina komen: introductie, vier blokken, de twee zinnen in de tijdlijn, de titel boven de foto's, de veelgestelde vragen, het pakketblok en de afsluiting. Daarna volgen de titel en beschrijving die Google toont. + +### 4.1 Newborn (/soorten-fotoshoots/newborn) + +Teksten in dit onderdeel: 17. Pakket (staat al vast): € 185 – 1-2 uur fotografie, minstens 40 zorgvuldig nabewerkte foto's, persoonlijke online fotogalerij. + +| Onderdeel | Concepttekst | Akkoord? | Aanpassing / opmerking | Ref. | +|---|---|---|---|---| +| **Introductie bovenaan de pagina** | **Klein kopje:** Newbornfotograaf in Huizen
**Titel:** Newbornshoot bij jou thuis
**Tekst:** Ben je in verwachting? Boek een newbornshoot om de 'kleinste' momenten voor altijd te bewaren. Ik fotografeer bij jou thuis in Huizen, Bussum, Hilversum en omgeving, in het rustige ritme van jullie baby. | ☐ Akkoord
☐ Aanpassen | | newborn.ts:27 | +| **Blok 1 – label, titel en tekst** | **Klein kopje:** Wat kun je verwachten
**Titel:** De kleinste momenten, voor altijd bewaard
**Tekst:** Een newbornshoot is rustig en ontspannen. Ik fotografeer jullie baby in de eerste weken, slapend en wakker, alleen en in jullie armen. Geen haast en geen ingewikkelde opstellingen: de kleine details en de warmte van jullie eerste weken staan centraal. | ☐ Akkoord
☐ Aanpassen | | newborn.ts:34 | +| **Blok 2 – label, titel en tekst** | **Klein kopje:** De beste periode
**Titel:** Tot 12 weken na de geboorte
**Tekst:** De ideale periode voor een newbornshoot is tot 12 weken na de geboorte van je baby. In die eerste weken slapen baby's veel en zijn ze nog heerlijk klein.
Boek je shoot het liefst al tijdens je zwangerschap. Dan zetten we een voorlopige datum rond je uitgerekende datum en schuiven we mee als jullie baby eerder of later komt. | ☐ Akkoord
☐ Aanpassen | | newborn.ts:51 | +| **Blok 3 – label, titel en tekst** | **Klein kopje:** Bij jou thuis
**Titel:** In jullie eigen vertrouwde omgeving
**Tekst:** De fotoshoot vindt bij jou thuis plaats. Je hoeft nergens heen met een baby van een paar weken oud, en jullie huis maakt de foto's persoonlijk.
Je kunt tussendoor gewoon je baby voeden en verschonen als dat nodig is. | ☐ Akkoord
☐ Aanpassen | | newborn.ts:67 | +| **Blok 4 – label, titel en tekst** | **Klein kopje:** Hoe lang duurt het
**Titel:** 1 tot 2 uur, op het ritme van je baby
**Tekst:** We nemen alle tijd en volgen het ritme van jullie baby. Reken op 1 tot 2 uur fotografie, inclusief pauzes om te voeden, te troosten of even te knuffelen.
Wil je broertjes, zusjes of jezelf ook op de foto? Dat plannen we gewoon in.
*Zie vraag 7 in hoofdstuk 2.* | ☐ Akkoord
☐ Aanpassen | | newborn.ts:87 | +| **Tijdlijn, stap 2 – zin over de locatie** | Een newbornshoot is bij jou thuis. | ☐ Akkoord
☐ Aanpassen | | newborn.ts:109 | +| **Tijdlijn, stap 4 – zin over de duur** | 1-2 uur fotografie, in het tempo van jullie baby.
*Zie vraag 7 in hoofdstuk 2.* | ☐ Akkoord
☐ Aanpassen | | newborn.ts:111 | +| **Fotomozaïek – titel** | Uit eerdere newbornshoots | ☐ Akkoord
☐ Aanpassen | | newborn.ts:117 | +| **Veelgestelde vragen – titel** | Vragen over de newbornshoot | ☐ Akkoord
☐ Aanpassen | | newborn.ts:144 | +| **Veelgestelde vraag 1 – vraag en antwoord** | **Vraag:** Wanneer boek ik de newbornshoot het beste?
**Antwoord:** Het liefst al tijdens je zwangerschap. We zetten een voorlopige datum rond je uitgerekende datum en schuiven mee als jullie baby eerder of later komt. De shoot vindt plaats binnen 12 weken na de geboorte. | ☐ Akkoord
☐ Aanpassen | | newborn.ts:147 | +| **Veelgestelde vraag 2 – vraag en antwoord** | **Vraag:** Wat als mijn baby niet wil slapen?
**Antwoord:** Geen probleem. We volgen het ritme van jullie baby en nemen pauzes om te voeden, te verschonen of te troosten. Wakkere momenten leveren ook prachtige foto's op. | ☐ Akkoord
☐ Aanpassen | | newborn.ts:155 | +| **Veelgestelde vraag 3 – vraag en antwoord** | **Vraag:** Mogen wij en broertjes of zusjes ook op de foto?
**Antwoord:** Ja, heel graag. Foto's met papa, mama en broertjes of zusjes horen er wat mij betreft gewoon bij. | ☐ Akkoord
☐ Aanpassen | | newborn.ts:163 | +| **Veelgestelde vraag 4 – vraag en antwoord** | **Vraag:** Wat moet ik thuis voorbereiden?
**Antwoord:** Weinig. Een warme kamer met wat daglicht is fijn. | ☐ Akkoord
☐ Aanpassen | | newborn.ts:171 | +| **Pakketblok – klein kopje en titel** | **Klein kopje:** Pakket newborn
**Titel:** Wat zit er in een newbornshoot | ☐ Akkoord
☐ Aanpassen | | newborn.ts:180 | +| **Afsluiting met knop – titel, tekst en knoptekst** | **Titel:** Op zoek naar een newbornfotograaf in Huizen?
**Tekst:** Stuur gerust een berichtje voor de mogelijkheden. Ik denk graag mee over een datum rond je uitgerekende datum.
**Knoptekst:** Boek je newbornshoot | ☐ Akkoord
☐ Aanpassen | | newborn.ts:185 | + +Na de eigen vragen volgt automatisch de vraag "Wanneer krijg ik de foto's?" (hoofdstuk 3). + +#### Voor Google (Newborn) + +Dit is de titel en beschrijving die in de zoekresultaten van Google verschijnen. + +| Onderdeel | Concepttekst | Akkoord? | Aanpassing / opmerking | Ref. | +|---|---|---|---|---| +| **Titel in Google** | Newbornshoot in Huizen | ☐ Akkoord
☐ Aanpassen | | sitePages.ts:65 | +| **Beschrijving in Google** | Newbornshoot in Huizen en omgeving, bij jou thuis in het rustige ritme van je baby. Warme, spontane foto's van Andrea Slop Fotografie. | ☐ Akkoord
☐ Aanpassen | | sitePages.ts:67 | + +### 4.2 Zwangerschap (/soorten-fotoshoots/zwangerschap) + +Teksten in dit onderdeel: 16. Pakket (staat al vast): € 175 – 1 uur fotografie, minstens 30 zorgvuldig nabewerkte foto's, persoonlijke online fotogalerij. + +| Onderdeel | Concepttekst | Akkoord? | Aanpassing / opmerking | Ref. | +|---|---|---|---|---| +| **Introductie bovenaan de pagina** | **Klein kopje:** Zwangerschapsfotograaf in Huizen
**Titel:** Je zwangerschap, voor altijd vastgelegd
**Tekst:** Met een zwangerschapsshoot leg je deze bijzondere periode vast voor altijd. Ik fotografeer in Huizen, Bussum, Hilversum en omgeving, op een plek die bij jullie past. | ☐ Akkoord
☐ Aanpassen | | zwangerschap.ts:30 | +| **Blok 1 – label, titel en tekst** | **Klein kopje:** Wat kun je verwachten
**Titel:** Deze bijzondere periode, voor altijd bewaard
**Tekst:** Een zwangerschapsshoot is ontspannen en ongedwongen. Ik leg jullie vast zoals jullie zijn: geen ongemakkelijke poses, maar spontane momenten van jou, je buik en, als je wilt, je partner. | ☐ Akkoord
☐ Aanpassen | | zwangerschap.ts:37 | +| **Blok 2 – label, titel en tekst** | **Klein kopje:** De beste periode
**Titel:** Tussen 30 en 34 weken
**Tekst:** De mooiste periode voor een zwangerschapsshoot is tussen de 30 en 34 weken. Stuur gerust op tijd een berichtje, dan plannen we de shoot samen in die weken. | ☐ Akkoord
☐ Aanpassen | | zwangerschap.ts:54 | +| **Blok 3 – label, titel en tekst** | **Klein kopje:** De locatie
**Titel:** Op een plek die bij jullie past
**Tekst:** We kiezen samen een locatie uit die bij jullie past, denk aan de Soesterduinen of de heide. | ☐ Akkoord
☐ Aanpassen | | zwangerschap.ts:66 | +| **Blok 4 – label, titel en tekst** | **Klein kopje:** Hoe lang duurt het
**Titel:** Rustig de tijd
**Tekst:** We nemen de tijd, zodat jullie je op je gemak voelen. Zo ontstaan de mooiste, spontane momenten. | ☐ Akkoord
☐ Aanpassen | | zwangerschap.ts:78 | +| **Tijdlijn, stap 2 – zin over de locatie** | En een plek die bij jullie past, zoals de Soesterduinen of de heide. | ☐ Akkoord
☐ Aanpassen | | zwangerschap.ts:91 | +| **Tijdlijn, stap 4 – zin over de duur** | 1 uur fotografie, zonder haast. | ☐ Akkoord
☐ Aanpassen | | zwangerschap.ts:94 | +| **Fotomozaïek – titel** | Uit eerdere zwangerschapsshoots | ☐ Akkoord
☐ Aanpassen | | zwangerschap.ts:100 | +| **Veelgestelde vragen – titel** | Vragen over de zwangerschapsshoot | ☐ Akkoord
☐ Aanpassen | | zwangerschap.ts:108 | +| **Veelgestelde vraag 1 – vraag en antwoord** | **Vraag:** Wanneer plan ik de zwangerschapsshoot?
**Antwoord:** De mooiste periode is tussen de 30 en 34 weken. Stuur gerust al eerder een berichtje, dan zoeken we samen een moment in die weken. | ☐ Akkoord
☐ Aanpassen | | zwangerschap.ts:111 | +| **Veelgestelde vraag 2 – vraag en antwoord** | **Vraag:** Mag mijn partner ook op de foto?
**Antwoord:** Ja, heel graag. Samen op de foto of alleen jij: we doen wat bij jullie past. | ☐ Akkoord
☐ Aanpassen | | zwangerschap.ts:119 | +| **Veelgestelde vraag 3 – vraag en antwoord** | **Vraag:** Waar vindt de zwangerschapsshoot plaats?
**Antwoord:** We kiezen samen een locatie uit die bij jullie past, denk aan de Soesterduinen of de heide. | ☐ Akkoord
☐ Aanpassen | | zwangerschap.ts:127 | +| **Pakketblok – klein kopje en titel** | **Klein kopje:** Pakket zwangerschap
**Titel:** Wat zit er in een zwangerschapsshoot | ☐ Akkoord
☐ Aanpassen | | zwangerschap.ts:139 | +| **Afsluiting met knop – titel, tekst en knoptekst** | **Titel:** Op zoek naar een zwangerschapsfotograaf in Huizen?
**Tekst:** Stuur gerust een berichtje voor de mogelijkheden. Ik denk graag mee over een plek die bij jullie past.
**Knoptekst:** Boek je zwangerschapsshoot | ☐ Akkoord
☐ Aanpassen | | zwangerschap.ts:144 | + +Na de eigen vragen volgen automatisch "Hoe leg ik de datum vast?" en "Wanneer krijg ik de foto's?" (hoofdstuk 3). + +#### Voor Google (Zwangerschap) + +Dit is de titel en beschrijving die in de zoekresultaten van Google verschijnen. + +| Onderdeel | Concepttekst | Akkoord? | Aanpassing / opmerking | Ref. | +|---|---|---|---|---| +| **Titel in Google** | Zwangerschapsshoot in Huizen | ☐ Akkoord
☐ Aanpassen | | sitePages.ts:73 | +| **Beschrijving in Google** | Zwangerschapsshoot in Huizen en omgeving: leg deze bijzondere periode vast in spontane foto's. Ontdek de mogelijkheden van Andrea Slop Fotografie. | ☐ Akkoord
☐ Aanpassen | | sitePages.ts:75 | + +### 4.3 Gezin (/soorten-fotoshoots/gezin) + +Teksten in dit onderdeel: 16. Pakket (staat al vast): € 175 – 1 uur fotografie, minstens 30 zorgvuldig nabewerkte foto's, persoonlijke online fotogalerij. + +| Onderdeel | Concepttekst | Akkoord? | Aanpassing / opmerking | Ref. | +|---|---|---|---|---| +| **Introductie bovenaan de pagina** | **Klein kopje:** Gezinsfotograaf in Huizen
**Titel:** Gezinsshoot vol echte momenten
**Tekst:** Met een gezinsshoot leggen we vast hoe jullie nu samen zijn. Ik fotografeer in Huizen, Bussum, Hilversum en omgeving, bij jullie thuis of buiten in de natuur. | ☐ Akkoord
☐ Aanpassen | | gezin.ts:31 | +| **Blok 1 – label, titel en tekst** | **Klein kopje:** Wat kun je verwachten
**Titel:** Spelen, knuffelen en lachen
**Tekst:** Met een gezinsshoot leggen we vast hoe jullie nu samen zijn: spelen, knuffelen en lachen. Geen stijve poses, maar echte momenten die je later met plezier terugkijkt. | ☐ Akkoord
☐ Aanpassen | | gezin.ts:38 | +| **Blok 2 – label, titel en tekst** | **Klein kopje:** Het hele gezin
**Titel:** Iedereen hoort erbij
**Tekst:** Papa, mama, broertjes en zusjes: op een gezinsshoot hoort iedereen erbij. Ook als jullie gezin net een kleintje rijker is. | ☐ Akkoord
☐ Aanpassen | | gezin.ts:55 | +| **Blok 3 – label, titel en tekst** | **Klein kopje:** Thuis of buiten
**Titel:** Een plek die bij jullie past
**Tekst:** We kiezen samen een plek die bij jullie past, bij jullie thuis of buiten in de natuur. | ☐ Akkoord
☐ Aanpassen | | gezin.ts:67 | +| **Blok 4 – label, titel en tekst** | **Klein kopje:** Hoe lang duurt het
**Titel:** Rustig de tijd
**Tekst:** We nemen de tijd, zodat iedereen zich op zijn gemak voelt. Ook de kleinsten: is er even een pauze nodig, dan is daar gewoon ruimte voor. | ☐ Akkoord
☐ Aanpassen | | gezin.ts:79 | +| **Tijdlijn, stap 2 – zin over de locatie** | En een plek die bij jullie past: bij jullie thuis of buiten in de natuur. | ☐ Akkoord
☐ Aanpassen | | gezin.ts:92 | +| **Tijdlijn, stap 4 – zin over de duur** | 1 uur fotografie, zonder haast. | ☐ Akkoord
☐ Aanpassen | | gezin.ts:95 | +| **Fotomozaïek – titel** | Uit eerdere gezinsshoots | ☐ Akkoord
☐ Aanpassen | | gezin.ts:101 | +| **Veelgestelde vragen – titel** | Vragen over de gezinsshoot | ☐ Akkoord
☐ Aanpassen | | gezin.ts:109 | +| **Veelgestelde vraag 1 – vraag en antwoord** | **Vraag:** Wie mogen er op de foto?
**Antwoord:** Het hele gezin: papa, mama, broertjes en zusjes. Geen stijve poses, maar echte momenten met elkaar. | ☐ Akkoord
☐ Aanpassen | | gezin.ts:112 | +| **Veelgestelde vraag 2 – vraag en antwoord** | **Vraag:** Fotograferen we bij ons thuis of buiten?
**Antwoord:** Allebei kan. We kiezen samen een plek die bij jullie past, bij jullie thuis of buiten in de natuur. | ☐ Akkoord
☐ Aanpassen | | gezin.ts:120 | +| **Pakketblok – klein kopje en titel** | **Klein kopje:** Pakket gezin
**Titel:** Wat zit er in een gezinsshoot | ☐ Akkoord
☐ Aanpassen | | gezin.ts:132 | +| **Afsluiting met knop – titel, tekst en knoptekst** | **Titel:** Op zoek naar een gezinsfotograaf in Huizen?
**Tekst:** Stuur gerust een berichtje voor de mogelijkheden. Ik denk graag mee over een plek die bij jullie past.
**Knoptekst:** Boek je gezinsshoot | ☐ Akkoord
☐ Aanpassen | | gezin.ts:137 | + +Na de eigen vragen volgen automatisch "Hoe leg ik de datum vast?" en "Wanneer krijg ik de foto's?" (hoofdstuk 3). + +#### Voor Google (Gezin) + +Dit is de titel en beschrijving die in de zoekresultaten van Google verschijnen. + +| Onderdeel | Concepttekst | Akkoord? | Aanpassing / opmerking | Ref. | +|---|---|---|---|---| +| **Titel in Google** | Gezinsshoot in Huizen | ☐ Akkoord
☐ Aanpassen | | sitePages.ts:81 | +| **Beschrijving in Google** | Gezinsshoot in Huizen en omgeving: echte momenten die laten zien hoe jullie nu samen zijn. Ontdek de mogelijkheden van Andrea Slop Fotografie. | ☐ Akkoord
☐ Aanpassen | | sitePages.ts:83 | + +#### Overzichtspagina "Soorten fotoshoots": tekst over Gezin + +Deze tekst staat al op de bestaande overzichtspagina en was ook nog een concept. + +| Onderdeel | Concepttekst | Akkoord? | Aanpassing / opmerking | Ref. | +|---|---|---|---|---| +| **Tekst over Gezin op de overzichtspagina "Soorten fotoshoots"** | Met een gezinsshoot leggen we vast hoe jullie nu samen zijn: spelen, knuffelen en lachen. Geen stijve poses, maar echte momenten die je later met plezier terugkijkt. We kiezen samen een plek die bij jullie past, bij jullie thuis of buiten in de natuur. | ☐ Akkoord
☐ Aanpassen | | shootTypes.ts:70 | + +### 4.4 Loveshoot (/soorten-fotoshoots/loveshoot) + +Teksten in dit onderdeel: 15. Geen vast pakket: de pagina toont "Prijs op aanvraag" met de teksten uit hoofdstuk 3. + +| Onderdeel | Concepttekst | Akkoord? | Aanpassing / opmerking | Ref. | +|---|---|---|---|---| +| **Introductie bovenaan de pagina** | **Klein kopje:** Loveshoot in Huizen
**Titel:** Loveshoot voor jullie twee
**Tekst:** Een loveshoot is een prachtige manier om jullie liefde vast te leggen. Ik fotografeer in Huizen, Bussum, Hilversum en omgeving. | ☐ Akkoord
☐ Aanpassen | | loveshoot.ts:23 | +| **Blok 1 – label, titel en tekst** | **Klein kopje:** Wat kun je verwachten
**Titel:** Jullie liefde, vastgelegd
**Tekst:** Een loveshoot is een prachtige manier om jullie liefde vast te leggen. Mijn stijl is natuurlijk en ongedwongen: geen ongemakkelijke poses, maar spontane momenten van jullie samen. | ☐ Akkoord
☐ Aanpassen | | loveshoot.ts:30 | +| **Blok 2 – label, titel en tekst** | **Klein kopje:** Verloofd?
**Titel:** Voor jullie trouwkaart
**Tekst:** Zijn jullie verloofd? Dan kan je de foto's gebruiken voor de trouwkaart. Vertel het me gerust bij je aanvraag, dan houden we daar rekening mee. | ☐ Akkoord
☐ Aanpassen | | loveshoot.ts:42 | +| **Blok 3 – label, titel en tekst** | **Klein kopje:** De locatie
**Titel:** Samen een plek kiezen
**Tekst:** We kiezen samen een plek die bij jullie past. Vertel me gerust wat jullie mooi vinden of waar jullie graag samen komen. | ☐ Akkoord
☐ Aanpassen | | loveshoot.ts:53 | +| **Blok 4 – label, titel en tekst** | **Klein kopje:** Gewoon jullie zelf
**Titel:** Ontspannen voor de camera
**Tekst:** Spannend om samen voor de camera te staan? Dat hoeft niet. We nemen de tijd, zodat jullie je op je gemak voelen en ik jullie kan vastleggen zoals jullie zijn. | ☐ Akkoord
☐ Aanpassen | | loveshoot.ts:64 | +| **Tijdlijn, stap 2 – zin over de locatie** | En een plek die bij jullie past. | ☐ Akkoord
☐ Aanpassen | | loveshoot.ts:77 | +| **Tijdlijn, stap 4 – zin over de duur** | We stemmen de duur samen af.
*Zie vraag 1 in hoofdstuk 2.* | ☐ Akkoord
☐ Aanpassen | | loveshoot.ts:79 | +| **Fotomozaïek – titel** | Uit eerdere loveshoots | ☐ Akkoord
☐ Aanpassen | | loveshoot.ts:86 | +| **Veelgestelde vragen – titel** | Vragen over de loveshoot | ☐ Akkoord
☐ Aanpassen | | loveshoot.ts:102 | +| **Veelgestelde vraag 1 – vraag en antwoord** | **Vraag:** Kunnen we de foto's gebruiken voor onze trouwkaart?
**Antwoord:** Ja, zeker. Zijn jullie verloofd? Dan kan je de foto's van jullie loveshoot gebruiken voor de trouwkaart. | ☐ Akkoord
☐ Aanpassen | | loveshoot.ts:105 | +| **Veelgestelde vraag 2 – vraag en antwoord** | **Vraag:** We staan niet graag op de foto. Is dat erg?
**Antwoord:** Helemaal niet. We nemen de tijd, zodat jullie je op je gemak voelen. Geen ongemakkelijke poses, maar spontane momenten van jullie samen. | ☐ Akkoord
☐ Aanpassen | | loveshoot.ts:113 | +| **Pakketblok – klein kopje en titel** | **Klein kopje:** Loveshoot boeken
**Titel:** Benieuwd naar de mogelijkheden? | ☐ Akkoord
☐ Aanpassen | | loveshoot.ts:125 | +| **Afsluiting met knop – titel, tekst en knoptekst** | **Titel:** Op zoek naar een fotograaf voor jullie loveshoot?
**Tekst:** Stuur gerust een berichtje voor de mogelijkheden. Ik denk graag mee over een plek die bij jullie past.
**Knoptekst:** Boek je loveshoot | ☐ Akkoord
☐ Aanpassen | | loveshoot.ts:130 | + +Na de eigen vragen volgen automatisch "Hoe leg ik de datum vast?" en "Wanneer krijg ik de foto's?" (hoofdstuk 3). + +#### Voor Google (Loveshoot) + +Dit is de titel en beschrijving die in de zoekresultaten van Google verschijnen. + +| Onderdeel | Concepttekst | Akkoord? | Aanpassing / opmerking | Ref. | +|---|---|---|---|---| +| **Titel in Google** | Loveshoot in Huizen | ☐ Akkoord
☐ Aanpassen | | sitePages.ts:89 | +| **Beschrijving in Google** | Loveshoot in Huizen en omgeving: leg jullie liefde vast in spontane, kleurrijke foto's. Ontdek de mogelijkheden van Andrea Slop Fotografie. | ☐ Akkoord
☐ Aanpassen | | sitePages.ts:91 | + +### 4.5 Portret (/soorten-fotoshoots/portret) + +Teksten in dit onderdeel: 15. Geen vast pakket: de pagina toont "Prijs op aanvraag" met de teksten uit hoofdstuk 3. + +| Onderdeel | Concepttekst | Akkoord? | Aanpassing / opmerking | Ref. | +|---|---|---|---|---| +| **Introductie bovenaan de pagina** | **Klein kopje:** Portretfotograaf in Huizen
**Titel:** Portretshoot in de natuur of zakelijk
**Tekst:** Van portretshoots in de natuur tot zakelijke shoots voor de branding van je bedrijf. Ik fotografeer in Huizen, Bussum, Hilversum en omgeving. | ☐ Akkoord
☐ Aanpassen | | portret.ts:23 | +| **Blok 1 – label, titel en tekst** | **Klein kopje:** Wat kun je verwachten
**Titel:** Jij, zoals je bent
**Tekst:** Mijn stijl is natuurlijk en ongedwongen. Geen ongemakkelijke poses, maar foto's waarop je jezelf herkent. | ☐ Akkoord
☐ Aanpassen | | portret.ts:30 | +| **Blok 2 – label, titel en tekst** | **Klein kopje:** Natuur of zakelijk
**Titel:** Persoonlijk of voor je bedrijf
**Tekst:** Van portretshoots in de natuur tot zakelijke shoots voor de branding van je bedrijf. Vertel me waarvoor je de foto's wilt gebruiken, dan stemmen we de shoot daarop af. | ☐ Akkoord
☐ Aanpassen | | portret.ts:42 | +| **Blok 3 – label, titel en tekst** | **Klein kopje:** De locatie
**Titel:** Samen een plek kiezen
**Tekst:** We kiezen samen een plek die past bij jou of bij je bedrijf.
*Zie vraag 3 in hoofdstuk 2.* | ☐ Akkoord
☐ Aanpassen | | portret.ts:53 | +| **Blok 4 – label, titel en tekst** | **Klein kopje:** Gewoon jezelf
**Titel:** Op je gemak voor de camera
**Tekst:** Niet gewend om op de foto te gaan? Geen zorgen. We nemen de tijd, zodat je je op je gemak voelt. | ☐ Akkoord
☐ Aanpassen | | portret.ts:65 | +| **Tijdlijn, stap 2 – zin over de locatie** | En een plek die bij jou past.
*Zie vraag 3 in hoofdstuk 2.* | ☐ Akkoord
☐ Aanpassen | | portret.ts:78 | +| **Tijdlijn, stap 4 – zin over de duur** | We stemmen de duur samen af.
*Zie vraag 2 in hoofdstuk 2.* | ☐ Akkoord
☐ Aanpassen | | portret.ts:81 | +| **Fotomozaïek – titel** | Uit eerdere portretshoots | ☐ Akkoord
☐ Aanpassen | | portret.ts:88 | +| **Veelgestelde vragen – titel** | Vragen over de portretshoot | ☐ Akkoord
☐ Aanpassen | | portret.ts:104 | +| **Veelgestelde vraag 1 – vraag en antwoord** | **Vraag:** Kan ik ook zakelijke foto's laten maken?
**Antwoord:** Ja. Naast portretshoots in de natuur doe ik ook zakelijke shoots voor de branding van je bedrijf. | ☐ Akkoord
☐ Aanpassen | | portret.ts:107 | +| **Veelgestelde vraag 2 – vraag en antwoord** | **Vraag:** Ik sta niet graag op de foto. Is dat erg?
**Antwoord:** Helemaal niet. We nemen de tijd, zodat je je op je gemak voelt. Geen ongemakkelijke poses, maar foto's waarop je jezelf herkent. | ☐ Akkoord
☐ Aanpassen | | portret.ts:115 | +| **Pakketblok – klein kopje en titel** | **Klein kopje:** Portretshoot boeken
**Titel:** Benieuwd naar de mogelijkheden? | ☐ Akkoord
☐ Aanpassen | | portret.ts:127 | +| **Afsluiting met knop – titel, tekst en knoptekst** | **Titel:** Op zoek naar een portretfotograaf in Huizen?
**Tekst:** Stuur gerust een berichtje voor de mogelijkheden. Vertel me waarvoor je de foto's wilt gebruiken.
**Knoptekst:** Boek je portretshoot | ☐ Akkoord
☐ Aanpassen | | portret.ts:132 | + +Na de eigen vragen volgen automatisch "Hoe leg ik de datum vast?" en "Wanneer krijg ik de foto's?" (hoofdstuk 3). + +#### Voor Google (Portret) + +Dit is de titel en beschrijving die in de zoekresultaten van Google verschijnen. + +| Onderdeel | Concepttekst | Akkoord? | Aanpassing / opmerking | Ref. | +|---|---|---|---|---| +| **Titel in Google** | Portretshoot in Huizen | ☐ Akkoord
☐ Aanpassen | | sitePages.ts:97 | +| **Beschrijving in Google** | Portretshoot in Huizen en omgeving, in de natuur of zakelijk. Spontane portretfoto's van Andrea Slop Fotografie. | ☐ Akkoord
☐ Aanpassen | | sitePages.ts:99 | + +## 5. Foto's + +Elke shootpagina is opgebouwd uit een vaste indeling met plekken voor foto's (het ontwerp zie je via de link in hoofdstuk 1). Een foto mag maar één keer op dezelfde pagina staan. Dezelfde foto op twee plekken van één pagina wordt dus niet gebruikt. De voorbeeldpagina in het ontwerp is Newborn. Voor de andere vier gebruik ik dezelfde indeling. + +#### De plekken voor foto's op een pagina + +| Plek | Vorm | Opmerking | +|---|---|---| +| Introductie | Geen foto | Alleen tekst bovenaan. | +| Blok 1 (wat kun je verwachten) | Staand, 4:5 | De hoofdfoto van de shoot. | +| Blok 2 (de beste periode) | Liggend, 3:2 | | +| Blok 3 (locatie) | Staand, 4:5 | | +| Blok 4 (duur) | Staand, 4:5 | | +| Fotomozaïek: 4 foto's | 1 grote staande (links, twee kolommen breed en twee rijen hoog), 1 brede liggende (rechtsboven), 2 kleine bijna vierkante (rechtsonder) | De foto's worden bijgesneden zodat ze de plek vullen. De mozaïek verschijnt vanaf 2 foto's die niet al elders op de pagina staan. | +| Pakketblok | Vierkant, 1:1 | Een detailfoto naast het pakket (of naast "Prijs op aanvraag"). | + +Een volledige pagina heeft zo 9 foto's nodig: 4 bij de blokken, 4 in de mozaïek en 1 bij het pakket. + +### Overzicht per shoot + +| Shoot | Nodig | Nu beschikbaar | Nog nodig | Welke foto's | +|---|---|---|---|---| +| **Newborn** | 9 | 8 | **1** | staand of liggend (kleine mozaïektegel) | +| **Zwangerschap** | 9 | 4 | **5** | 1 staand (blok 4), 1 staand + 1 liggend + 2 vrij (mozaïek) | +| **Gezin** | 9 | 4 | **5** | 1 staand (blok 4), 1 staand + 1 liggend + 2 vrij (mozaïek) | +| **Loveshoot** | 9 | 2 | **7** | 1 liggend (blok 2), 2 staand (blok 3 en 4), 1 staand + 1 liggend + 2 vrij (mozaïek) | +| **Portret** | 9 | 2 | **7** | 1 liggend (blok 2), 2 staand (blok 3 en 4), 1 staand + 1 liggend + 2 vrij (mozaïek) | + +In totaal ontbreken er 25 foto's om alle vijf de pagina's zo te vullen als in het ontwerp. Je hoeft niet alles in één keer te leveren: de pagina's werken ook met minder foto's, ze zien er alleen minder vol uit. Het meeste effect heb je bij Loveshoot en Portret (nu maar 2 foto's per pagina). + +#### Wat er nu gebeurt zonder de extra foto's + +- **Newborn:** De mozaïek toont nu 3 foto's (de vierde plek blijft leeg). Alle vier de blokken en het pakketblok zijn gevuld. +- **Zwangerschap:** Blok 4 toont alleen tekst. De fotomozaïek is verborgen: de twee foto's die er zouden komen staan al in blok 2 en 3. Een of twee nieuwe foto's zijn al genoeg om hem weer te tonen (minimaal 2). +- **Gezin:** Blok 4 toont alleen tekst. De fotomozaïek is verborgen: de twee foto's die er zouden komen staan al in blok 2 en 3. Met minimaal 2 nieuwe foto's verschijnt hij weer. Let op: de huidige foto's bij Gezin tonen gezinnen met een pasgeboren baby. +- **Loveshoot:** Er zijn maar 2 foto's (hoofdfoto en detailfoto). Blok 2, 3 en 4 tonen alleen tekst en de fotomozaïek is verborgen. +- **Portret:** Er zijn maar 2 foto's (hoofdfoto en detailfoto). Blok 2, 3 en 4 tonen alleen tekst en de fotomozaïek is verborgen. + +#### Wat voor foto's en in welk formaat? + +- Lever bij voorkeur de originele (of licht bewerkte) foto's zonder bijsnijden. Ik snijd ze op de pagina bij naar de vorm van de plek. De bestaande foto's op de site zijn 800 pixels breed (staand 800 x 1200, liggend 800 x 534) met een grote versie van 1067 x 1600 (staand) of 1600 x 1067 (liggend). Haal je foto's ten minste op die grootte; groter mag. +- Staande plekken (blok 1, 3, 4) hebben de vorm 4:5, de liggende plek (blok 2) 3:2. Een gewone staande foto (2:3) past: er gaat wat van boven en onderkant af, dus laat het onderwerp niet te dicht tegen de rand staan. +- De detailfoto's in de pakketblokken zijn nu vierkant en klein (480 x 480 pixels). Voor een scherpe weergave is een vierkante uitsnede van minstens 960 x 960 pixels beter. +- Geef bij elke foto aan bij welke shoot hij hoort. Als je een foto bij een andere shoot wilt gebruiken dan nu, hoor ik dat graag. +- Foto's met herkenbare mensen: ik ga ervan uit dat daar toestemming voor is om ze op de site te tonen, zoals bij je bestaande portfolio. + +### Per shoot: de plekken en welke foto nu gebruikt wordt + +#### Newborn + +| Plek | Vorm | Foto nu | Status | +|---|---|---|---| +| Blok 1 | Staand 4:5 | Pasgeboren baby in gestreept pakje slaapt met het hoofdje opzij | Aanwezig | +| Blok 2 | Liggend 3:2 | Slapende baby in bruin-wit gestreept pakje | Aanwezig | +| Blok 3 | Staand 4:5 | Moeder drukt haar gezicht tegen het hoofdje van haar baby | Aanwezig | +| Blok 4 | Staand 4:5 | Baby in wit pakje op de onderarm van een ouder, kijkt in de camera | Aanwezig | +| Mozaïek groot | Staand | Vader kust zijn baby op het hoofd | Aanwezig | +| Mozaïek breed | Liggend | Babyvuistje tussen gebreide deken en geruite doek | Aanwezig | +| Mozaïek klein 1 | Bijna vierkant | Blote babyvoetjes in gestreept gebreid broekje | Aanwezig | +| Mozaïek klein 2 | Bijna vierkant | Geen (in het ontwerp staat hier de slapende baby, die al in blok 2 staat) | **Ontbreekt – 1 foto, staand of liggend** | +| Pakketblok | Vierkant 1:1 | Babyvoetjes die onder een gestreept gebreid pakje uitsteken | Aanwezig | + +#### Zwangerschap + +| Plek | Vorm | Foto nu | Status | +|---|---|---|---| +| Blok 1 | Staand 4:5 | Zwangere vrouw en partner kijken elkaar lachend aan op een zandvlakte | Aanwezig | +| Blok 2 | Liggend 3:2 | Zwangere buik in zwarte jurk, omarmd door twee handen | Aanwezig | +| Blok 3 | Staand 4:5 | Aanstaande vader omarmt zijn zwangere partner op een zandvlakte in de avondzon | Aanwezig | +| Blok 4 | Staand 4:5 | Geen: dit blok toont nu alleen tekst | **Ontbreekt – 1 staande foto** | +| Mozaïek groot | Staand | Geen | **Ontbreekt – 1 staande foto** | +| Mozaïek breed | Liggend | Geen | **Ontbreekt – 1 liggende foto** | +| Mozaïek klein 1 en 2 | Bijna vierkant | Geen | **Ontbreekt – 2 foto's, staand of liggend** | +| Pakketblok | Vierkant 1:1 | Zwangere vrouw in lichte jurk houdt haar buik vast op een zandvlakte | Aanwezig | + +#### Gezin + +| Plek | Vorm | Foto nu | Status | +|---|---|---|---| +| Blok 1 | Staand 4:5 | Vader en moeder kijken samen naar hun pasgeboren baby in de armen van de vader | Aanwezig | +| Blok 2 | Liggend 3:2 | Grote broer kust zijn pasgeboren broertje of zusje op een wit bed | Aanwezig | +| Blok 3 | Staand 4:5 | Jonge ouders kijken samen naar hun slapende pasgeboren baby | Aanwezig | +| Blok 4 | Staand 4:5 | Geen: dit blok toont nu alleen tekst | **Ontbreekt – 1 staande foto** | +| Mozaïek groot | Staand | Geen | **Ontbreekt – 1 staande foto** | +| Mozaïek breed | Liggend | Geen | **Ontbreekt – 1 liggende foto** | +| Mozaïek klein 1 en 2 | Bijna vierkant | Geen | **Ontbreekt – 2 foto's, staand of liggend** | +| Pakketblok | Vierkant 1:1 | Een jongetje geeft de pasgeboren baby een kus op het bed | Aanwezig | + +#### Loveshoot + +| Plek | Vorm | Foto nu | Status | +|---|---|---|---| +| Blok 1 | Staand 4:5 | Stel ligt in de zon op een plaid in het gras, hoofden tegen elkaar | Aanwezig | +| Blok 2 | Liggend 3:2 | Geen: dit blok toont nu alleen tekst | **Ontbreekt – 1 liggende foto** | +| Blok 3 | Staand 4:5 | Geen: dit blok toont nu alleen tekst | **Ontbreekt – 1 staande foto** | +| Blok 4 | Staand 4:5 | Geen: dit blok toont nu alleen tekst | **Ontbreekt – 1 staande foto** | +| Mozaïek groot | Staand | Geen | **Ontbreekt – 1 staande foto** | +| Mozaïek breed | Liggend | Geen | **Ontbreekt – 1 liggende foto** | +| Mozaïek klein 1 en 2 | Bijna vierkant | Geen | **Ontbreekt – 2 foto's, staand of liggend** | +| Pakketblok | Vierkant 1:1 | Man schuift een ring om de vinger van zijn partner, met paarse heide | Aanwezig | + +#### Portret + +| Plek | Vorm | Foto nu | Status | +|---|---|---|---| +| Blok 1 | Staand 4:5 | Vrouw met lang bruin haar in witte blouse kijkt glimlachend omlaag, bomen op de achtergrond | Aanwezig | +| Blok 2 | Liggend 3:2 | Geen: dit blok toont nu alleen tekst | **Ontbreekt – 1 liggende foto** | +| Blok 3 | Staand 4:5 | Geen: dit blok toont nu alleen tekst | **Ontbreekt – 1 staande foto** | +| Blok 4 | Staand 4:5 | Geen: dit blok toont nu alleen tekst | **Ontbreekt – 1 staande foto** | +| Mozaïek groot | Staand | Geen | **Ontbreekt – 1 staande foto** | +| Mozaïek breed | Liggend | Geen | **Ontbreekt – 1 liggende foto** | +| Mozaïek klein 1 en 2 | Bijna vierkant | Geen | **Ontbreekt – 2 foto's, staand of liggend** | +| Pakketblok | Vierkant 1:1 | Vrouw met lang blond haar in jurk met bloemenprint houdt een takje heide vast | Aanwezig | + +## 6. Hoe gaat het verder? + +- Je stuurt je ingevulde document (of je opmerkingen) terug. Alleen de teksten waar je Aanpassen hebt gekozen, hoef je van een opmerking te voorzien. +- Ik verwerk je antwoorden op de vragen in hoofdstuk 2 en je aanpassingen in de teksten, en laat je de pagina's zien zoals ze er in het echt uitzien. +- Teksten waar je Akkoord bij hebt gezet, worden definitief. Teksten waarover een vraag openstaat, blijven staan tot je antwoordt. +- Zodra jij alles goedkeurt gaan de pagina's live. Foto's kun je altijd later nog aanleveren; ze komen dan op de pagina's zonder dat de teksten opnieuw nagekeken hoeven te worden. + +Voor de ontwikkelaar: dit document bevat alle 98 teksten met een DRAFT(CON-ST-03)-markering in de code (zie draft-list.txt) en de 7 OPEN(CON-ST-04)-markeringen (open-list.txt). + diff --git a/aidlc-docs/features/shoot-type-pages/construction/navigation-submenu/functional-design/business-logic-model.md b/aidlc-docs/features/shoot-type-pages/construction/navigation-submenu/functional-design/business-logic-model.md new file mode 100644 index 0000000..5681807 --- /dev/null +++ b/aidlc-docs/features/shoot-type-pages/construction/navigation-submenu/functional-design/business-logic-model.md @@ -0,0 +1,160 @@ +# Business Logic Model — navigation-submenu (unit 3) + +> Final — answers recorded in ../../plans/navigation-submenu-fd-questions.md (2026-10-30). + +## Findings in the existing code that shape the design + +| Finding | Consequence | +|---|---| +| `NavigationBar` keeps `open` in `useState` and derives `menuOpen = open && !isDesktop`; the hamburger sets `!menuOpen`. `MobileNav` closes only on a link click and on Escape, and locks `body` overflow in an effect | Open state moves into one reducer in `NavigationBar` (see below). The body lock and the Escape listener stay where they are; Escape now also returns focus to the hamburger | +| Nothing closes the mobile menu on a route change that did not come from clicking a menu link (browser back button) | New `routeChanged` event from the router pathname closes every menu | +| `MobileNav` is a fixed box with `justifyContent="center"` and no overflow; five extra rows are cut off on short phones (risk 6) | Box gets `overflow-y: auto`, content centred with auto margins so it scrolls from the top when taller | +| `MobileNav` closes via `visibility` + `clip-path` and has no reduced-motion rule | Add `_motionReduce` transition none | +| No focus trap or focus return exists; the hamburger stays above the overlay and the overlay starts below the header | Not a dialog, no trap added (BR-NAV-35); only Escape focus return is added | +| TanStack `Link` uses prefix matching for `aria-current` (risk 1) | `activeOptions={{ exact: true }}` on the parent, the submenu links and the footer links; the visual parent mark comes from `isSectionCurrent` | +| The header is transparent with white text on `/` from `lg` until scrolled 150 px (`overlay`) | The toggle takes `currentColor`; the panel sets its own solid colours so it is never white-on-photo | +| Desktop header `lg` height 92 px, 68 px after scroll; `NavLink` has `mx=4`, eyebrow text 0.72rem, tracking 0.22em, weight 300 | Fit calculation in frontend-components.md | + +## Pure units (PBT targets) + +| Function | Signature | Rule | +|---|---|---| +| `shootNavItems` (`lib/shootNavItems.ts`) | `(shoots: readonly ShootType[]) => NavItem[]` | One item per shoot in input order, `label = name`, `to = shootPagePath(id)` | +| `isItemCurrent` (`lib/navCurrent.ts`) | `(item: NavItem, pathname: string) => boolean` | Normalised equality (BR-NAV-04) | +| `isSectionCurrent` (`lib/navCurrent.ts`) | `(item: NavItem, pathname: string) => boolean` | Exact for the item, or for any child | +| `navMenuReducer` (`lib/navMenuState.ts`, new file owned by unit 3) | `(state: NavMenuState, event: NavMenuEvent) => NavMenuState` | Transition table below | +| `initialNavMenuState` | `NavMenuState` | All closed | + +The reducer is the one addition to the application design's file list: `src/lib/navMenuState.ts` + `navMenuState.test.ts`. No other unit touches `lib/` names starting with `nav`. + +## Transition table of `navMenuReducer` + +| Event | Condition | Result | +|---|---|---| +| `viewport(d)` | always | `isDesktop = d`; if `d`: `menuOpen = groupOpen = false`; if `!d`: `submenuOpen = false`; `focusRequest` cleared if it no longer fits (I4) | +| `toggleMenu(inSection)` | `!isDesktop` | flip `menuOpen`; when it becomes open `groupOpen = inSection`; when it becomes closed `groupOpen = false` | +| `toggleGroup` | `menuOpen` | flip `groupOpen` | +| `toggleSubmenu` | `isDesktop` | flip `submenuOpen` | +| `escape(focusInside)` | `menuOpen` | close menu and group; `focusRequest = focusInside ? 'menuToggle' : null` | +| `escape(focusInside)` | `submenuOpen` | close submenu; `focusRequest = focusInside ? 'submenuToggle' : null` | +| `outside`, `focusLeave` | `submenuOpen` | close submenu, no focus request | +| `linkChosen`, `routeChanged` | always | `menuOpen = groupOpen = submenuOpen = false`, no focus request | +| `focusHandled` | always | `focusRequest = null` | +| any event | condition not met | state unchanged (same object returned) | + +## State diagram: desktop submenu + +```mermaid +stateDiagram-v2 + [*] --> SubClosed + SubClosed --> SubOpen : toggle click, Enter or Space + SubOpen --> SubClosed : toggle click, focus stays + SubOpen --> SubClosed : Escape, focus to toggle if inside + SubOpen --> SubClosed : pointer down outside + SubOpen --> SubClosed : focus leaves the group + SubOpen --> SubClosed : link chosen + SubOpen --> SubClosed : route changed + SubOpen --> SubClosed : viewport below lg + classDef closed fill:#9ae6b4,stroke:#2f855a,stroke-width:1px,color:#000 + classDef open fill:#63b3ed,stroke:#2b6cb0,stroke-width:1px,color:#000 + class SubClosed closed + class SubOpen open +``` + +Text alternative: the desktop dropdown is closed or open; a toggle activation opens it, and the toggle, Escape, an outside click, focus leaving, a link choice, a route change or a narrower viewport close it. + +## State diagram: mobile menu and group + +```mermaid +stateDiagram-v2 + [*] --> MenuClosed + MenuClosed --> GroupCollapsed : hamburger, page not in section + MenuClosed --> GroupExpanded : hamburger, page in section + GroupCollapsed --> GroupExpanded : group chevron + GroupExpanded --> GroupCollapsed : group chevron + GroupCollapsed --> MenuClosed : hamburger, Escape, link, route change, viewport lg + GroupExpanded --> MenuClosed : hamburger, Escape, link, route change, viewport lg + classDef closed fill:#9ae6b4,stroke:#2f855a,stroke-width:1px,color:#000 + classDef open fill:#63b3ed,stroke:#2b6cb0,stroke-width:1px,color:#000 + class MenuClosed closed + class GroupCollapsed,GroupExpanded open +``` + +Text alternative: the mobile menu opens with its shoot list collapsed or, on a page of that section, expanded; the chevron flips the list; the hamburger, Escape, a link, a route change or a wider viewport closes the whole menu. + +## Flow: opening the desktop submenu from the keyboard + +```mermaid +graph TD + Start["Tab reaches the toggle"] --> Press["Enter or Space"] + Press --> Open["submenuOpen is true, panel visible"] + Open --> Tab["Tab moves into the panel links"] + Tab --> Choice{"what next"} + Choice -->|"Enter on a link"| Nav["navigate, menus close, focus to main"] + Choice -->|"Escape"| Back["panel closes, focus on toggle"] + Choice -->|"Tab past last link"| Leave["focus leaves group, panel closes"] + classDef step fill:#63b3ed,stroke:#2b6cb0,stroke-width:1px,color:#000; + classDef decision fill:#f6e05e,stroke:#c05621,stroke-width:1px,color:#000; + classDef result fill:#9ae6b4,stroke:#2f855a,stroke-width:1px,color:#000; + class Start,Press,Open,Tab step; + class Choice decision; + class Nav,Back,Leave result; +``` + +Text alternative: Enter or Space on the toggle opens the panel, Tab enters its links, and then Enter navigates, Escape returns to the toggle, or tabbing past the last link closes the panel. + +## Sequence: component interplay on a click and a route change + +```mermaid +sequenceDiagram + box rgba(246,224,94,0.4) Visitor + participant V as Visitor + end + box rgba(99,179,237,0.4) Components + participant Sub as NavSubmenu + participant Bar as NavigationBar + participant Dis as useDismiss + end + box rgba(154,230,180,0.4) Logic + participant Red as navMenuReducer + participant Rt as Router + end + V->>Sub: click toggle + Sub->>Bar: dispatch toggleSubmenu + Bar->>Red: reduce state with toggleSubmenu + Red-->>Bar: submenuOpen true + Bar->>Dis: active is true + V->>Sub: click a shoot link + Sub->>Bar: dispatch linkChosen + Sub->>Rt: navigate to the shoot page + Rt-->>Bar: pathname changed + Bar->>Red: reduce state with routeChanged + Red-->>Bar: everything closed + Bar->>Dis: active is false +``` + +Text alternative: the visitor's click on the toggle is reduced to an open state that activates useDismiss; choosing a link dispatches linkChosen, the router navigates, and the pathname change dispatches routeChanged, closing everything. + +## Where the pieces live + +- `NavigationBar` owns the reducer (`useReducer`) because the hamburger, the submenu, the mobile group and the route listener must agree (I1-I3). It passes `open`, `onToggle`, `onClose` style props down; there is no context. +- Effects in `NavigationBar`: `viewport` on `isDesktop` change; `routeChanged` when `useRouterState` pathname changes (skipped on first render); focus effect that reads `focusRequest`, focuses the matching toggle by ref and dispatches `focusHandled`. +- `useDismiss(ref, active, onDismiss)` only listens (document `keydown` Escape, `pointerdown` outside `ref`); it adds the listeners while `active`. The reducer decides what dismissal means. `focusLeave` comes from an `onBlur` handler on the group wrapper checking `relatedTarget`. + +## PBT properties (PBT-01, PBT-03, PBT-04, PBT-06) + +| Subject | Property | Kind | +|---|---|---| +| `shootNavItems` | length = input length; order preserved; label = name; `shootIdFromPath(to) = id`; every `to` is a known route | invariant, round trip | +| `isItemCurrent` | true iff normalised paths equal; unchanged by one added trailing slash or by letter case; false for any path outside the item | invariant | +| `isSectionCurrent` | implied by `isItemCurrent`; implied by any child exact; false for paths unrelated to the item and its children (including prefix look-alikes such as `/soorten-fotoshoots-extra`) | invariant | +| `mainNav` (all pathnames) | at most one item or child is exact at a time | invariant | +| `navMenuReducer` | after every event of a random sequence I1-I4 hold | stateful (model-based) | +| `navMenuReducer` | `routeChanged` and `linkChosen` end in the all-closed state from any state; twice equals once | invariant, idempotency | +| `navMenuReducer` | `outside` and `focusLeave` never change `menuOpen`, and never set `focusRequest` | invariant | +| `navMenuReducer` | `escape` twice equals once (apart from `focusRequest` already set) | idempotency | +| `navMenuReducer` | `toggleSubmenu` twice on desktop returns the original state | invariant | +| `navMenuReducer` | `viewport(true)` after any sequence leaves no mobile state open; `viewport(false)` leaves no submenu open | invariant | +| `navMenuReducer` | `toggleMenu(inSection)` from closed opens with `groupOpen = inSection` | example-backed property | + +Example-based (PBT-10): keyboard and focus behaviour, outside click, route change in the real router (`navSubmenu.test.tsx`), axe, aria-current on the shoot pages for nav and footer. diff --git a/aidlc-docs/features/shoot-type-pages/construction/navigation-submenu/functional-design/business-rules.md b/aidlc-docs/features/shoot-type-pages/construction/navigation-submenu/functional-design/business-rules.md new file mode 100644 index 0000000..c4f82a9 --- /dev/null +++ b/aidlc-docs/features/shoot-type-pages/construction/navigation-submenu/functional-design/business-rules.md @@ -0,0 +1,132 @@ +# Business Rules — navigation-submenu (unit 3) + +> Final — answers recorded in ../../plans/navigation-submenu-fd-questions.md (2026-10-30) (Q1 A, Q2 A, Q3 A, Q4 A, Q5 A, Q6 A; the reducer of Q6 is approved). Rules that depend on an answer are marked `[Qn]`. + +Rule IDs: `BR-NAV-xx`. Sources: FR-ST-10, NFR-ST-01, NFR-ST-03, D4, D5, D12. + +## Current state (D4) + +| ID | Rule | +|---|---| +| BR-NAV-01 | `aria-current="page"` is set only on a link whose target equals the current page. TanStack's default (prefix match) is switched off for every nav link that has children (`activeOptions={{ exact: true }}`), for the submenu links, and for all footer links. | +| BR-NAV-02 | While a shoot page is open, the parent "Soorten fotoshoots" has no `aria-current` but shows the same underline through `sectionCurrent` (`isSectionCurrent`). On the overview itself it has both. | +| BR-NAV-03 | The shoot link in the submenu (desktop panel and mobile sub-list) that matches the current page has `aria-current="page"` and the current styling (accent colour). | +| BR-NAV-04 | Path comparison ignores one trailing slash and letter case (router parity). Query and hash are ignored. | +| BR-NAV-05 | The breadcrumb (unit 2) also uses exact matching; this unit only guarantees nav and footer. | + +## Content of the menu + +| ID | Rule | +|---|---| +| BR-NAV-10 | The five children come from `shootNavItems(shootTypes)`: same order, label = shoot `name`, `to = shootPagePath(id)`. Nothing is typed twice, so a sixth shoot type appears automatically. | +| BR-NAV-11 | Only one nesting level. The submenu is a plain list of links (disclosure navigation), never `role="menu"`. | +| BR-NAV-12 | No "overview" duplicate inside the panel: the parent link already goes there. | + +## Desktop submenu (from `lg`) + +| ID | Rule | +|---|---| +| BR-NAV-20 | The parent stays a link. A separate toggle button follows it: `aria-expanded`, `aria-controls`, name "Submenu Soorten fotoshoots". | +| BR-NAV-21 | `[Q1]` Opens only by click/tap, Enter or Space on the toggle. No hover opening. | +| BR-NAV-22 | Clicking the toggle while open closes it; focus stays on the toggle. | +| BR-NAV-23 | Escape closes. If focus is inside the group (toggle or a panel link) it returns to the toggle; otherwise focus is not moved. | +| BR-NAV-24 | A pointer down outside the group closes it, without moving focus. | +| BR-NAV-25 | `[Q4]` Focus moving to an element outside the group (Tab, Shift+Tab) closes it. A focusout without a related target (window blur, click on a non-focusable area) is ignored; the outside pointer rule covers clicks. | +| BR-NAV-26 | Choosing a link, any route change (also back/forward) and a viewport change below `lg` close it. After a link choice focus is not restored to the toggle: `useRouteFocus` moves it to `main`. | +| BR-NAV-27 | Keys: Enter/Space (native button behaviour), Escape, Tab. Arrow keys are **not** bound: this is disclosure navigation, not a menu (NFR-ST-01); Tab walks the links in DOM order. | +| BR-NAV-28 | Closed panel links are not focusable and not read (`visibility: hidden`), while the panel stays in the DOM so `aria-controls` is always valid. | +| BR-NAV-29 | The panel is solid (`bg`, `fg`) at all times, also over the transparent header of the home hero. | + +## Mobile menu (below `lg`) + +| ID | Rule | +|---|---| +| BR-NAV-30 | The parent row is the link to the overview plus a chevron toggle (same name and `aria-expanded` pattern). Tapping the label navigates and closes the whole menu. | +| BR-NAV-31 | `[Q3]` When the menu opens, the sub-list starts expanded iff `isSectionCurrent(parent, pathname)`, otherwise collapsed. Toggling afterwards is free. | +| BR-NAV-32 | Choosing any link closes the whole menu. Route changes (including the browser back button, which today leaves the menu open) close it too. | +| BR-NAV-33 | Escape closes the menu and returns focus to the hamburger button when focus is inside the menu or on the hamburger. | +| BR-NAV-34 | The menu scrolls when its content is taller than the visible height; content is centred when shorter. The page behind stays locked (`body` overflow) as today. | +| BR-NAV-35 | No focus trap is added: the mobile menu is a disclosure, not a modal dialog, and the existing behaviour (Tab can leave the menu) is unchanged. Recorded as a follow-up in the risks, not a regression. | +| BR-NAV-36 | A collapsed sub-list is not focusable and not read. | + +## Layout, touch and motion + +| ID | Rule | +|---|---| +| BR-NAV-40 | Toggle buttons are at least 44 x 44 px; each panel link and each mobile sub-list link is at least 44 px high. | +| BR-NAV-41 | At 1024 px the five items plus the toggle must fit on one line without wrapping or overlapping the logo (see frontend-components.md for the calculation and the check). | +| BR-NAV-42 | `[Q5]` Motion: panel fade and 6 px slide in 0.3 s, mobile expand over 0.3 s, chevron rotation. With `prefers-reduced-motion: reduce` there is no transition and no rotation (state changes instantly). The mobile menu's existing clip-path reveal gets the same reduced-motion rule. | +| BR-NAV-43 | Visible focus ring everywhere. On the transparent header the toggle's ring is white (`--focus-ring-color`), as `iconControl` does on photos. | + +## Performance + +| ID | Rule | +|---|---| +| BR-NAV-50 | D5 gate: the main bundle's gzip size is measured on `/` before and after; the increase is expected at about 1.7 KB (`shootTypes.ts` gzips to 1.76 KB) and must stay at or below 2.5 KB. Mobile Lighthouse performance on `/` must not fall below its current 0.8. If either is exceeded, Code Generation stops and reports (the D5 alternative needs a user decision). | + +## Decision flowchart: what happens on an event + +```mermaid +graph TD + Ev["Event arrives"] --> IsView{"viewport event"} + IsView -->|"yes"| ViewAct["close what does not exist at this width"] + IsView -->|"no"| IsLink{"linkChosen or routeChanged"} + IsLink -->|"yes"| CloseAll["close menu, group and submenu, no focus move"] + IsLink -->|"no"| IsEsc{"escape"} + IsEsc -->|"yes"| WhichOpen{"which is open"} + WhichOpen -->|"mobile menu"| MenuEsc["close menu, focus hamburger if focus inside"] + WhichOpen -->|"submenu"| SubEsc["close submenu, focus toggle if focus inside"] + WhichOpen -->|"none"| Noop["no change"] + IsEsc -->|"no"| IsOut{"outside or focusLeave"} + IsOut -->|"yes"| SubClose["close submenu only, no focus move"] + IsOut -->|"no"| IsToggle{"toggle event"} + IsToggle -->|"toggleSubmenu"| DeskOnly{"desktop"} + DeskOnly -->|"yes"| FlipSub["flip submenuOpen"] + DeskOnly -->|"no"| Noop + IsToggle -->|"toggleMenu"| MobOnly{"mobile"} + MobOnly -->|"yes"| FlipMenu["flip menuOpen, on open groupOpen = inSection"] + MobOnly -->|"no"| Noop + IsToggle -->|"toggleGroup"| GroupOk{"menu open"} + GroupOk -->|"yes"| FlipGroup["flip groupOpen"] + GroupOk -->|"no"| Noop + classDef decision fill:#f6e05e,stroke:#c05621,stroke-width:1px,color:#000; + classDef action fill:#9ae6b4,stroke:#2f855a,stroke-width:1px,color:#000; + classDef start fill:#63b3ed,stroke:#2b6cb0,stroke-width:1px,color:#000; + classDef none fill:#e9d5ff,stroke:#6b21a8,stroke-width:1px,color:#000; + class Ev start; + class IsView,IsLink,IsEsc,WhichOpen,IsOut,IsToggle,DeskOnly,MobOnly,GroupOk decision; + class ViewAct,CloseAll,MenuEsc,SubEsc,SubClose,FlipSub,FlipMenu,FlipGroup action; + class Noop none; +``` + +Text alternative: a decision flowchart that routes each menu event to closing everything (link or route change), closing the active menu on Escape, closing only the submenu on outside or focus leave, or flipping the matching toggle if it exists at the current width. + +## Security Baseline compliance summary (extension enabled) + +| Rule | Status | Rationale | +|---|---|---| +| SECURITY-01, 02, 03, 06, 07, 08, 12, 14 | N/A | Front-end navigation only: no data store, intermediary, server code, IAM, network, access control, authentication or alerting | +| SECURITY-04 HTTP headers | Compliant | No header or CSP change; no inline script or handler; Chakra/emotion styles as on every other component | +| SECURITY-05 Input validation | Compliant | No user input. The pathname is only compared, never rendered; link targets are typed `RoutePath`s from code, labels are rendered as React text | +| SECURITY-09 Hardening | Compliant | No debug output or placeholder content; the nav shows only the shoot names | +| SECURITY-10 Supply chain | Compliant | No new dependency; chevron as inline SVG; no Chakra `Menu`/`Popover` added | +| SECURITY-11 Secure design | Compliant | Menu logic is a pure reducer with invariants; no `dangerouslySetInnerHTML`; no new `target="_blank"` links | +| SECURITY-13 Integrity | Compliant | No CDN, no external resource | +| SECURITY-15 Fail-safe | Compliant | An impossible event for the current width is ignored; an empty `children` list renders a plain link; the reducer never opens a menu that cannot exist at the current width | + +No blocking findings. + +## Property-Based Testing compliance summary (extension enabled, full) + +| Rule | Status | Rationale | +|---|---|---| +| PBT-01 Identification | Compliant | Properties are listed per function in [business-logic-model.md](business-logic-model.md) (`shootNavItems`, `isItemCurrent`, `isSectionCurrent`, `navMenuReducer`) | +| PBT-02 Round trip | Compliant | `shootNavItems` children map back to shoot ids via `shootIdFromPath` | +| PBT-03 Invariants | Compliant | Order, labels, known routes; exactness; section implication; no unrelated paths; normalisation | +| PBT-04 Idempotency | Compliant | `routeChanged`, `linkChosen`, `escape` and `outside` applied twice equal once; a trailing slash does not change `isItemCurrent` | +| PBT-05 Oracle | N/A | No reference implementation | +| PBT-06 Stateful | Compliant (was N/A in the application design) | A reducer was introduced, so model-based sequence tests apply: random event sequences with invariants I1-I4 checked after every step | +| PBT-07 Generators | Planned | `navEvent` and `pathname` generators (shoot paths, trailing slash, case variants, hostile strings) appended to `src/test/arbitraries.ts` (append only; unit 2 also appends, kept sequential by the orchestrator) | +| PBT-08 Shrinking | Compliant | fast-check shrinks event sequences; seed logged by `config/testSeed.ts` | +| PBT-09 Framework | Compliant | fast-check already configured | +| PBT-10 Complementary | Compliant | Example tests for keyboard, focus, outside click, route change in the real app, and axe | diff --git a/aidlc-docs/features/shoot-type-pages/construction/navigation-submenu/functional-design/domain-entities.md b/aidlc-docs/features/shoot-type-pages/construction/navigation-submenu/functional-design/domain-entities.md new file mode 100644 index 0000000..e3517d8 --- /dev/null +++ b/aidlc-docs/features/shoot-type-pages/construction/navigation-submenu/functional-design/domain-entities.md @@ -0,0 +1,94 @@ +# Domain Entities — navigation-submenu (unit 3) + +> Final — answers recorded in ../../plans/navigation-submenu-fd-questions.md (2026-10-30) (Q1 click only, Q2 caps panel, Q3 collapsed unless in section, Q4 close on focus leave, Q5 short animation). + +Inputs: FR-ST-10, NFR-ST-01, application design D4, D5, D12 and the real code (`navigation.ts`, `NavigationBar`, `MobileNav`). + +## Entity relationships + +```mermaid +graph TD + MainNav["mainNav"] -->|"contains"| NavItem["NavItem"] + NavItem -->|"has optional"| Children["children NavItem list"] + ShootTypes["shootTypes"] -->|"mapped by shootNavItems to"| Children + NavItem -->|"to is a"| RoutePath["RoutePath"] + Pathname["current pathname"] -->|"compared with"| NavItem + Pathname -->|"gives"| Current["CurrentState"] + MenuState["NavMenuState"] -->|"changed by"| MenuEvent["NavMenuEvent"] + MenuState -->|"asks for"| FocusRequest["FocusRequest"] + Current -->|"drives"| AriaCurrent["aria-current on exact link"] + Current -->|"drives"| SectionMark["sectionCurrent underline on parent"] + Current -->|"seeds"| GroupDefault["mobile group default"] + classDef source fill:#9ae6b4,stroke:#2f855a,stroke-width:1px,color:#000; + classDef entity fill:#63b3ed,stroke:#2b6cb0,stroke-width:1px,color:#000; + classDef state fill:#f6e05e,stroke:#c05621,stroke-width:1px,color:#000; + classDef output fill:#e9d5ff,stroke:#6b21a8,stroke-width:1px,color:#000; + class ShootTypes,RoutePath source; + class MainNav,NavItem,Children,Pathname entity; + class MenuState,MenuEvent,FocusRequest,Current state; + class AriaCurrent,SectionMark,GroupDefault output; +``` + +Text alternative: mainNav holds NavItems whose optional children come from shootTypes via shootNavItems; the current pathname yields a CurrentState that drives aria-current, the parent underline and the mobile group default, while NavMenuEvents change the NavMenuState, which can ask for focus. + +## NavItem (changed, `navigation.ts`) + +| Field | Type | Required | Description | +|---|---|---|---| +| `to` | `RoutePath` | yes | Route the item links to; a typo is a type error | +| `label` | `string` | yes | Visible text and link name | +| `children` | `readonly NavItem[]` | no | Sub-pages. Only one level is supported: a child never has children (`isNavParent` narrows on `children?.length`). An empty array counts as no children | + +- `mainNav`: the item `/soorten-fotoshoots` gets `children = shootNavItems(shootTypes)` at module load; all other items and all of `footerNav` have no children. +- Child order = `shootTypes` order. Child `label` = shoot `name` (for the fifth shoot that is "Portretten", the name, not the id). Child `to` = `shootPagePath(id)`. +- The parent is both a destination (overview) and a group: the link and the toggle are two controls for one item. + +## CurrentState (derived, never stored) + +| Name | Definition | Used for | +|---|---|---| +| `isItemCurrent(item, pathname)` | normalised pathname equals normalised `item.to` | `aria-current="page"` (via router `exact`) and tests | +| `isSectionCurrent(item, pathname)` | `isItemCurrent(item)` or any child is exact | `sectionCurrent` underline on the parent, mobile group default | + +Normalisation: remove one trailing slash (except for `/`), compare case-insensitively (the router matches case-insensitively, see the code summary of unit 1, so the underline must follow the page the router actually renders). Query and hash are not part of a pathname. + +## NavMenuState (new, `lib/navMenuState.ts`) + +| Field | Type | Description | +|---|---|---| +| `isDesktop` | `boolean` | Viewport is at or above `lg` (1024 px) | +| `menuOpen` | `boolean` | Mobile full-screen menu is open (only possible when `!isDesktop`) | +| `groupOpen` | `boolean` | Mobile "Soorten fotoshoots" sub-list is expanded (only possible when `menuOpen`) | +| `submenuOpen` | `boolean` | Desktop dropdown panel is open (only possible when `isDesktop`) | +| `focusRequest` | `'menuToggle' \| 'submenuToggle' \| null` | Set by the reducer when focus must move; cleared by the `focusHandled` event | + +Invariants (checked by PBT-06 in [business-logic-model.md](business-logic-model.md)): +- **I1** `submenuOpen` implies `isDesktop`. +- **I2** `menuOpen` implies `!isDesktop`. +- **I3** `groupOpen` implies `menuOpen`. +- **I4** `focusRequest === 'menuToggle'` implies `!isDesktop`; `'submenuToggle'` implies `isDesktop`. + +Initial state: everything `false`/`null`, `isDesktop` from the first `viewport` event. + +## NavMenuEvent (new) + +| Event | Payload | Raised by | +|---|---|---| +| `viewport` | `isDesktop` | `useBreakpointValue` effect in `NavigationBar` | +| `toggleMenu` | `inSection: boolean` | Hamburger button (below `lg`) | +| `toggleGroup` | none | Chevron button in `MobileNavGroup` | +| `toggleSubmenu` | none | Chevron button in `NavSubmenu` (from `lg`) | +| `escape` | `focusInside: boolean` | `useDismiss` (document keydown) | +| `outside` | none | `useDismiss` (pointer down outside the submenu) | +| `focusLeave` | none | `NavSubmenu` focusout to an element outside it | +| `linkChosen` | none | Click on any link in a menu | +| `routeChanged` | none | Effect on the router pathname | +| `focusHandled` | none | Effect after moving focus | + +## Constants + +| Name | Value | Where | +|---|---|---| +| Submenu toggle accessible name | `Submenu ${item.label}` ("Submenu Soorten fotoshoots"), constant; the state is carried by `aria-expanded` | `NavSubmenu`, `MobileNavGroup` | +| Panel id / group id | `submenu-${slug}` / `mobile-group-${slug}`, `slug = item.to.slice(1)` | `aria-controls` | +| Touch target minimum | 44 px | NFR-ST-01 | diff --git a/aidlc-docs/features/shoot-type-pages/construction/navigation-submenu/functional-design/frontend-components.md b/aidlc-docs/features/shoot-type-pages/construction/navigation-submenu/functional-design/frontend-components.md new file mode 100644 index 0000000..7ec2a0e --- /dev/null +++ b/aidlc-docs/features/shoot-type-pages/construction/navigation-submenu/functional-design/frontend-components.md @@ -0,0 +1,174 @@ +# Frontend Components — navigation-submenu (unit 3) + +> Final — answers recorded in ../../plans/navigation-submenu-fd-questions.md (2026-10-30) (Q1 click only, Q2 caps panel, Q3 collapsed unless in section, Q4 close on focus leave, Q5 short animation). + +No backend endpoints are used. No forms, so no form validation rules. + +## Component hierarchy + +```mermaid +graph TD + Bar["NavigationBar (owns reducer)"] --> Logo["Logo RouterLink"] + Bar --> DeskNav["nav Hoofdmenu, from lg"] + Bar --> Burger["Hamburger button, below lg"] + Bar --> Mobile["MobileNav"] + DeskNav --> NavLinkPlain["NavLink for items without children"] + DeskNav --> Submenu["NavSubmenu"] + Submenu --> ParentLink["NavLink with sectionCurrent"] + Submenu --> Toggle["Toggle button with ChevronIcon"] + Submenu --> Panel["Panel with list of PanelLink"] + Submenu --> Dismiss["useDismiss"] + Mobile --> MobPlain["RouterLink for items without children"] + Mobile --> Group["MobileNavGroup"] + Group --> GParent["Parent RouterLink"] + Group --> GToggle["Chevron button with ChevronIcon"] + Group --> GList["Sub-list of RouterLinks"] + Bar --> Reducer["navMenuReducer"] + Submenu --> Current["navCurrent"] + Group --> Current + Footer["Footer"] --> FooterLinks["RouterLink exact"] + Nav["navigation.ts mainNav"] --> ShootNav["shootNavItems"] + Bar --> Nav + classDef root fill:#4CAF50,stroke:#2e7d32,stroke-width:2px,color:#000; + classDef ui fill:#2196F3,stroke:#0d47a1,stroke-width:1px,color:#000; + classDef hook fill:#9C27B0,stroke:#4a148c,stroke-width:1px,color:#000; + classDef logic fill:#FF9800,stroke:#e65100,stroke-width:1px,color:#000; + class Bar root; + class Logo,DeskNav,Burger,Mobile,NavLinkPlain,Submenu,ParentLink,Toggle,Panel,MobPlain,Group,GParent,GToggle,GList,Footer,FooterLinks ui; + class Dismiss hook; + class Reducer,Current,Nav,ShootNav logic; +``` + +Text alternative: NavigationBar owns the menu reducer and renders the logo, the desktop nav with plain NavLinks and NavSubmenu (parent link, toggle, panel, useDismiss), the hamburger and MobileNav with plain links and MobileNavGroup; the Footer only gets exact links; mainNav is built from shootNavItems. + +## Components, props and state + +### `navigation.ts` (changed) +`NavItem` gets `children?: readonly NavItem[]`. `mainNav[3].children = shootNavItems(shootTypes)`. Export a type guard `hasChildren(item): item is NavItem & { children: readonly NavItem[] }` (non-empty). + +### `NavigationBar` (changed) +- State: `useReducer(navMenuReducer, initialNavMenuState)`. `isDesktop` from the existing `useBreakpointValue`, pushed with `viewport`. +- `pathname` via `useRouterState` (the existing `isHome` selector is extended to return the pathname; `isHome = pathname === '/'`). +- Passes to `NavSubmenu`: `open`, `onToggle`, `onEscape/onOutside/onFocusLeave` via one `dispatch`, `toggleRef`, `transparent` (= `!isSolid`, for the white focus ring), `pathname`. +- Hamburger: `onClick -> dispatch({ type: 'toggleMenu', inSection })`, `aria-expanded={state.menuOpen}`, ref for focus return. `inSection = isSectionCurrent(parentItem, pathname)`. +- Keeps `data-testid="nav-menu-toggle"` and the accessible names "Menu openen"/"Menu sluiten". +- Desktop list: `chakra.li` per item; `hasChildren(item) ? : `. + +### `NavSubmenu` (new) +```ts +type NavSubmenuProps = { + item: NavItem & { children: readonly NavItem[] }; + id: string; // panel id, 'submenu-soorten-fotoshoots' + open: boolean; + pathname: string; + transparent: boolean; + toggleRef: RefObject; + dispatch: (event: NavMenuEvent) => void; +}; +``` +- Wrapper `li` content: `Box` (`position: relative; display: flex; align-items: center`) with `ref` for `useDismiss` and `onBlur` (focus leave). +- Parent: `NavLink to={item.to} activeOptions={{ exact: true }} sectionCurrent={isSectionCurrent(item, pathname)}`; its right margin is 0 so the toggle sits right next to it. +- Toggle: `chakra.button type="button"`, 44 x 44 px, `aria-expanded`, `aria-controls={id}`, `aria-label="Submenu Soorten fotoshoots"`, `color: currentColor` (white over the hero, ink after), `ChevronIcon` 12 px, rotates 180 degrees when open. Focus ring `--focus-ring-color: white` while `transparent`. +- Panel (`div#id`): `position: absolute; top: calc(100% + 0.75rem); left: 1rem` (aligned with the parent text), `min-width: 15rem`, `bg="bg" color="fg"`, 1 px `line` border, `shadow="panel"`, `zIndex` inside the header's stacking context. It contains `ul` with `li > RouterLink` (`PanelLink`): `textStyle="eyebrow"`, `color="fg"` (explicit, so it never inherits header white), `min-height 44px`, `display flex align-items center`, `px 5`, hover `bg="paper.alt"`, `_currentPage={{ color: 'accent.deep' }}` with a 2 px accent bar on the left, `activeOptions={{ exact: true }}`, `onClick -> dispatch({ type: 'linkChosen' })`. +- Closed: `visibility: hidden; opacity: 0; transform: translateY(-6px); pointer-events: none`. Open: visible, opacity 1, no translate. Transition `opacity, transform, visibility` over 0.3 s `smooth`, `_motionReduce: { transition: 'none' }` `[Q5]`. +- `useDismiss(ref, open, reason => dispatch(reason === 'escape' ? { type: 'escape', focusInside: ref.current.contains(document.activeElement) } : { type: 'outside' }))`. +- `onBlur`: if `event.relatedTarget` is a Node and not inside the wrapper, `dispatch({ type: 'focusLeave' })` `[Q4]`. + +### `MobileNav` (changed) +```ts +type MobileNavProps = { id: string; open: boolean; groupOpen: boolean; pathname: string; dispatch: (e: NavMenuEvent) => void }; +``` +- Outer box: as today plus `overflowY="auto"`, `overscrollBehavior="contain"`; `justifyContent` no longer `center`. An inner `Box` with `marginBlock="auto"` centres short content and lets tall content scroll from the top (a centred flex child would cut off the top). Bottom padding stays so the last link clears the browser bar. +- Existing effect keeps the body scroll lock; the keydown listener now dispatches `{ type: 'escape', focusInside }`; the `onClose` prop is replaced by `dispatch`. +- `_motionReduce: { transition: 'none' }` on the clip-path reveal `[Q5]`. +- Plain items as today (`onClick -> linkChosen`); items with children render `MobileNavGroup`. + +### `MobileNavGroup` (new) +```ts +type MobileNavGroupProps = { + item: NavItem & { children: readonly NavItem[] }; + id: string; // 'mobile-group-soorten-fotoshoots' + open: boolean; + pathname: string; + dispatch: (e: NavMenuEvent) => void; +}; +``` +- Row: `Flex` with the parent `RouterLink` (heading font 1.9rem, `activeOptions exact`, accent colour when `isSectionCurrent`) and a chevron `button` of 44 x 44 px (`aria-expanded`, `aria-controls`, `aria-label="Submenu Soorten fotoshoots"`). +- Sub-list wrapper: grid with `gridTemplateRows: open ? '1fr' : '0fr'` and inner `overflow: hidden`, `visibility: open ? visible : hidden` with the transition delayed on close so it is hidden only after collapsing. `_motionReduce` none. `ul` indented 1.25rem, links heading font 1.4rem, `min-height 44px`, `color="ink"`, `_currentPage={{ color: 'accent.deep' }}` (accent.deep, because 1.4rem is not "large text" and `accent` is below 4.5:1). +- Each sub-link: `activeOptions exact`, `onClick -> linkChosen`. + +### `NavLink` (changed, additive) +`sectionCurrent?: boolean` sets `data-section-current` and the existing underline selector gains `&[data-section-current]::after`. Optional, existing callers unchanged. `aria-current="page"` stays exclusively the router's output. + +### `ChevronIcon` (new) +Inline SVG, 12 x 12, `aria-hidden`, `focusable="false"`, `stroke: currentColor`. Rotates via a `data-open` attribute on its button; `_motionReduce` removes the rotation transition (rotation state itself still shows). + +### `useDismiss` (new, `hooks/useDismiss.ts`) +As specified in the application design (`(ref, active, onDismiss(reason))`). While `active`: `document` `keydown` for `Escape` and `pointerdown` whose target is not inside `ref`. Cleans up on `active` false and unmount. Contains no menu logic. + +### `Footer` (changed, one prop) +In the `footerNav` map, `RouterLink` gets `activeOptions={{ exact: true }}`. No visible change; on a shoot page the footer's "Soorten fotoshoots" has no `aria-current` (BR-NAV-01). + +### `lib/navMenuState.ts`, `lib/navCurrent.ts`, `lib/shootNavItems.ts` +Pure modules as specified in [business-logic-model.md](business-logic-model.md). + +## User interaction flows + +| Flow | Behaviour | +|---|---| +| Desktop mouse | Click chevron: panel opens; click a shoot: page opens and panel closes; click elsewhere: panel closes. Hover does nothing extra `[Q1]` | +| Desktop keyboard | Tab to the parent link, Tab to the toggle, Enter or Space opens, Tab walks the five links, Escape returns to the toggle, tabbing out closes `[Q4]` | +| Touch tablet at 1024 px and up | Same as mouse; toggle and panel links are 44 px | +| Mobile | Hamburger opens the menu (sub-list open only on a shoot page or the overview), chevron flips the list, any link closes the menu, Escape or the hamburger closes it and focus returns to the hamburger | +| Browser back or forward | Route change closes every menu | +| Resize across 1024 px | The menu that no longer exists is closed | + +## Layout at 1024 px (risk 7) + +Estimate (Jost 300 uppercase about 7.1 px + 2.5 px tracking per character, about 9.6 px, eyebrow 0.72rem): + +| Part | Width | +|---|---| +| Labels: HOME, OVER MIJ, PORTFOLIO, SOORTEN FOTOSHOOTS, CONTACT (4, 8, 9, 18, 7 characters) | about 430 px | +| Link margins (`mx=4`, 5 links) | 160 px | +| Toggle (44 px) minus the parent's removed right margin (16 px) | 28 px | +| Gaps (`gap=6`, 4 gaps) | 96 px | +| **Total** | **about 715 px** | +| Available: 1024 minus 2 x 41 px gutter minus logo 46 px minus 2 x 24 px flex gaps | about 848 px | + +About 130 px of slack. This is an estimate: the Code Generation unit measures the real widths in a browser at 1024 and 1100 px (the `run` skill or Lighthouse viewport) and records them in the code summary. If the nav does not fit, the fallback (no user decision needed) is to reduce the link margin from `mx=4` to `mx=3` at `lg` only; wrapping is not allowed (BR-NAV-41). + +## Transparent header (home hero, from `lg`) + +Over the hero the header is transparent with white text. The parent link and the chevron use `currentColor`, so both are white. The panel always has its own solid `bg` and `fg` (and an explicit link colour), so it is readable on the photo. The toggle's focus ring is white while transparent; the parent link keeps today's behaviour. After scrolling 150 px the header becomes solid and the ring returns to the theme colour. The panel is not tied to the header colour state, so crossing the 150 px threshold while it is open does not change it. + +## Bundle size and Lighthouse (D5, NFR-ST-03) + +`navigation.ts` imports `shootTypes` (which imports ten shoot photos as URLs), so the shoot type data moves into the main bundle. Measure in Code Generation: +1. Build before the unit 3 changes: record the gzip size of the main entry chunk (`pnpm build`, file listing). +2. Build after: record again. Expect about +1.7 KB (the file alone gzips to 1.76 KB); limit +2.5 KB (BR-NAV-50). Also check that the ten images are still emitted as files and not inlined (Vite inlines assets below `assetsInlineLimit`; the detail photos are 480 x 480 JPEGs). +3. Run Lighthouse mobile on `/` three times; the median performance score must stay at or above 0.8 (current exception). Record the numbers in the code summary. +4. If a limit is exceeded, stop and report; the D5 alternative (a small `{ id, name }` list) changes the content model and needs the user. + +## Accessibility summary (NFR-ST-01) + +- Disclosure navigation: `button` with `aria-expanded` and `aria-controls`; plain `ul` of links; no `role="menu"`; no Chakra `Menu`. +- Toggle name is constant ("Submenu Soorten fotoshoots"); state is conveyed by `aria-expanded`. +- Focus ring on every control (theme `*:focus-visible`); white on the transparent header. +- Touch targets 44 px for toggles and submenu links. Observation outside this unit's scope: the existing desktop `NavLink` boxes are about 35 px high (py 2 around an 11.5 px line); not changed here, listed in the risks. +- Contrast: `accent.deep` on paper for current sub-items (at least 4.5:1, per the link recipe note); `fg` on `bg` for the panel. +- Reduced motion: panel, mobile expand, chevron and the mobile reveal have no transition. +- Axe in `NavigationBar.test.tsx` runs with the panel closed and open. + +## Test plan (PBT-10 complement) + +| Test file | Content | +|---|---| +| `lib/shootNavItems.test.ts`, `lib/navCurrent.test.ts`, `lib/navMenuState.test.ts` | Properties from the business logic model (fast-check; event-sequence model for the reducer) | +| `navigation.test.ts` | `mainNav` has the five children in shoot order, `footerNav` has none, all `to` are routes | +| `hooks/useDismiss.test.tsx` | Escape and outside pointer down only while active; cleanup | +| `NavigationBar.test.tsx` (extended) | Toggle name and `aria-expanded`; Enter/Space opens; Escape closes and focuses the toggle; outside click closes without moving focus; Tab out closes; closed links not reachable; axe closed and open; no hover opening | +| `MobileNav` tests (new, in `NavigationBar/`) | Group default per path, chevron toggles, link closes menu, Escape returns focus to the hamburger, scroll container present | +| `Footer.test.tsx` (extended) | On `/soorten-fotoshoots/newborn` the footer link has no `aria-current` | +| `navSubmenu.test.tsx` (real app via `renderApp`) | On a shoot page the shoot link in the submenu has `aria-current="page"`, the parent has none but shows the section mark, the footer and (unit 2) breadcrumb are correct; route change closes an open submenu and the mobile menu; back button closes the mobile menu | +| Manual or browser check in Code Generation | 1024 px fit, transparent header panel, short-phone scrolling, bundle and Lighthouse numbers | diff --git a/aidlc-docs/features/shoot-type-pages/construction/plans/content-and-seo-foundation-code-generation-plan.md b/aidlc-docs/features/shoot-type-pages/construction/plans/content-and-seo-foundation-code-generation-plan.md new file mode 100644 index 0000000..66ed548 --- /dev/null +++ b/aidlc-docs/features/shoot-type-pages/construction/plans/content-and-seo-foundation-code-generation-plan.md @@ -0,0 +1,287 @@ +# Code Generation Plan — Unit 1: Content and SEO foundation + +This plan is the **single source of truth** for code generation of unit 1. Steps are run in order (a step may only start when the steps it depends on are checked), each by a sub-agent of the size given in brackets: **[small]** = mechanical (registry entries, moves, docs, running checks) → smaller model; **[large]** = logic, content drafting or tests → larger model. + +- **Workspace root**: `K:\Development\SlpSoftware\Projects\AndreaSlopFotografie-shoot-type-pages` (worktree); application code in `web/` only, never in `aidlc-docs/` +- **Branch**: `feature/shoot-type-pages` (from master `18e81d0`) +- **Commits**: none by this plan. A commit for the unit ("a commit per unit", execution plan) is made only when the user asks; push likewise. +- **Paths** below are relative to the workspace root. + +## Unit Context + +- **Requirements implemented**: FR-ST-01 (routes, path helpers, not-found), FR-ST-04/05/06/07/08 (data and view only; UI is unit 2), FR-ST-11 (content model), FR-ST-12 (registry, sitemap, Lighthouse), SEO-ST-01, SEO-ST-02 (title/description drafts), SEO-ST-03 (Service, Offer, BreadcrumbList, FAQPage), NFR-ST-03 (code splitting), NFR-ST-04, NFR-ST-05 (SECURITY-04/05/09/10/11/13/15), NFR-ST-06 (PBT + example-based), CON-ST-01..05 +- **Not in this unit**: all visible sections beyond the h1 shell (unit 2: Breadcrumb, StoryBlocks, ProcessTimeline, PhotoMosaic, FaqList, PackageBlock, PageIntro slot, "Lees meer" links, OG images, LAYOUT.md); navigation submenu (unit 3) +- **Design**: [application-design.md](../../inception/application-design/application-design.md) (D1–D6 confirmed A; D7–D15 as written), [component-methods.md](../../inception/application-design/component-methods.md) (types and signatures), [services.md](../../inception/application-design/services.md) (view rules and the PBT property list), [components.md](../../inception/application-design/components.md). No Functional Design for this unit (execution plan). +- **Copy source**: design E `E-Definitief.dc.html` (Newborn), `content/shootTypes.ts` and `content/packages.ts` (others) +- **Depends on**: nothing new. Reuses `visiblePackages`, `isShootTypeId` (`lib/portfolioFilters.ts`), `formatPrice`, `shootPortfolioLink`, `isPortfolioLive`, `shootTypesWithPhotos`, `webPage`, `canonicalUrl`, `absoluteUrl`, `areaServed`, `jsonLdScript`, `PageIntro`, `NotFound`. +- **Used by**: unit 2 (sections render `ShootPageView`; edits texts/photos, `MOSAIC_MIN_PHOTOS`, `ogImage`); unit 3 (reads `lib/shootPages.ts`, `content/shootTypes.ts`, `test/arbitraries.ts`). The interfaces in component-methods.md are the contract; unit 1 may not change their shape without telling the orchestrator. +- **Data entities owned**: `ShootPageContent`, `ShootPageShared`, `StoryBlock`, `FaqItem`, `ProcessStepId`, `ProcessStepContent`, `DepositInfo` (flat, CMS-shaped; no database). +- **Behavioural contract for existing pages**: every existing page renders as before. Only invisible changes: the overview's Service `@id`/`url` move to `…/soorten-fotoshoots/#service` / the shoot page (D2), and the overview's JSON-LD is rendered through `StructuredData` (same output). +- **Files** (exactly the unit-1 rows of the file ownership table, plus three test/type files the code requires, marked †): + - `web/src/routes/soorten-fotoshoots/index.tsx` (moved), `newborn.tsx`, `zwangerschap.tsx`, `gezin.tsx`, `loveshoot.tsx`, `portret.tsx`, `-shootPageSources.ts`; `web/src/routeTree.gen.ts` (regenerated) + - `web/src/content/types.ts`, `web/src/content/shootPageShared.ts`, `web/src/content/shootPages/{newborn,zwangerschap,gezin,loveshoot,portret}.ts`, `web/src/content/shootPages/shootPages.test.ts`, `web/src/content/shootTypes.ts` (marker only) + - `web/src/lib/{shootPages,shootPackage,fillPlaceholders,richTextToPlain,shootPageView}.ts` + `.test.ts`, `web/src/lib/shootLinks.ts` + test + - `web/src/seo.ts`, `web/src/seo.test.ts`, `web/src/sitePages.ts`, `web/lighthouserc.cjs`, † `web/lighthouserc.d.cts`, † `web/src/sitemap.test.ts` + - `web/src/app.test.tsx`, `web/src/test/renderApp.tsx` (new), `web/src/test/arbitraries.ts` + - `web/src/components/StructuredData/{StructuredData.tsx,StructuredData.test.tsx}`, `web/src/components/shoots/ShootPage/{ShootPage.tsx,ShootPage.test.tsx}` (shell) + - `aidlc-docs/features/shoot-type-pages/construction/content-and-seo-foundation/code/code-summary.md`, own lines in `aidlc-docs/_shared/reverse-engineering/{api-documentation,code-structure,architecture}.md` + +## Conventions for every step +- Prettier style, 4-space indent as in the repo; code comments in English; visitor-facing text in Dutch. +- Components never import content modules; routes pass content or a view as props. +- **Draft marker** (D3, CON-ST-03): the line `// DRAFT(CON-ST-03): awaiting Andrea's approval` directly above every drafted field or block (content files and `sitePages.ts`). Where a draft also touches an open fact from CON-ST-04, add one more comment line below the marker: `// OPEN(CON-ST-04): `. +- **Never invent facts** (CON-ST-04): no durations, photo counts, periods, locations, checklists or "ik neem … mee" that are not in `shootTypes.ts`, `packages.ts`, `siteContent.ts`, CON-ST-01 or design E's confirmed text. No bracketed design placeholders (`[…]`) in content. No figure that already exists as data (prices, features, photo counts, deposit, reply time, opleverduur) written as free text: use the placeholders (D8) or leave it to the package block. +- New `lib/*` and `seo.ts` code must keep the **100 % coverage threshold** (vite.config.ts). +- PBT: fast-check with the shared generators in `web/src/test/arbitraries.ts`; seed comes from `config/testSeed.ts` via `test/setup.ts` (do not pass seeds or disable shrinking). Name PBT tests with "(invariant)", "(round trip)" or "(idempotency)" as the existing tests do, so they are distinguishable from example-based ones (PBT-10). +- There is **no `pnpm typecheck` script**: type check is `pnpm exec tsc` (what `pnpm build` runs first). + +## Steps + +### Setup + +- [x] **Step 1 — Install and baseline** [small] — *NFR-ST-05 (SECURITY-10), NFR-ST-06* + - Done. `pnpm install --frozen-lockfile` ok (lockfile unchanged); `pnpm exec vite build` ok, `routeTree.gen.ts` no diff; `pnpm lint` clean; `pnpm exec tsc` clean; `pnpm test`: 82 files, 460 tests passed, fast-check seed 801597296. No pre-existing failures. (Tests/tsc ran after the Step 2 type additions, which are type-only.) + - In `web/`: `pnpm install --frozen-lockfile` (the worktree has no `node_modules`; `postinstall` runs `chakra typegen`). The lockfile must stay unchanged. + - Let the router plugin regenerate `web/src/routeTree.gen.ts`: `pnpm exec vite build`. Then `git diff --exit-code web/src/routeTree.gen.ts` must show no change on the untouched tree (proves the generator version matches the committed file). + - Baseline: `pnpm lint`, `pnpm exec tsc`, `pnpm test`. All green; note the number of tests and the logged fast-check seed in the step's hand-back. Delete nothing; `dist/` is git-ignored. + +### Content model and content + +- [x] **Step 2 — Content types** [small] — *FR-ST-11, FR-ST-04, FR-ST-06, FR-ST-07* + - Done, no deviation. Types inserted in `types.ts` after `ShootTypesPageContent`; trailing same-line comments of component-methods.md became comments above the field (repo style); `ProcessStepId` formatted as a leading-`|` union like `FrameColor`. + - `web/src/content/types.ts`: add `StoryBlock`, `FaqItem`, `ProcessStepId`, `ProcessStepContent`, `DepositInfo`, `ShootPageShared`, `ShootPageContent` exactly as in component-methods.md § Content types, each with a one-line English comment (requirement id). Document the five placeholders (`{reactietermijn}`, `{aanbetaling}`, `{locatie}`, `{duur}`, `{opleverduur}`) and where they may appear in a comment above `ShootPageShared`. No existing type changes. + +- [x] **Step 3 — Shared shoot page content** [large] — *FR-ST-04, FR-ST-06, FR-ST-07, FR-ST-11, CON-ST-01, CON-ST-02, CON-ST-04, NFR-ST-04* + - Done. Shared FAQ constants `deliveryFaq` ("Wanneer krijg ik de foto's?", `{opleverduur}`), `bookingFaq` ("Hoe leg ik de datum vast?", `{aanbetaling}`, settled against the total and remainder after the shoot per CON-ST-01; `OPEN(CON-ST-04)` as on the deposit note), `replyFaq` ("Hoe snel hoor ik iets van je?", `{reactietermijn}`). FAQ lead ends in a separate `'.'` piece after the link (design E's full stop). Process eyebrow/title and the button labels are marked as drafts too (the plan's exception list names only step titles, deposit amount and breadcrumb labels). + - New `web/src/content/shootPageShared.ts`, default export `shootPageShared: ShootPageShared`, plus named exports for the shared FAQ items (`FaqItem` constants, D7). + - Texts from design E, generic wording with placeholders (D8): + - breadcrumb `{ label: 'Kruimelpad', home: 'Home', overview: 'Soorten fotoshoots' }`; + - process: eyebrow "Zo werkt het", title "Van aanvraag tot online galerij", lead "Elke shoot volgt dezelfde zes stappen, zodat je precies weet waar je aan toe bent."; steps (record by `ProcessStepId`, titles per FR-ST-04): `aanvragen` "Stuur een berichtje. Ik reageer binnen {reactietermijn}.", `datum` "We kiezen samen een moment. {locatie}", `aanbetaling` "Met een aanbetaling van {aanbetaling} staat je datum vast.", `shoot` "{duur}", `bewerking` "Ik selecteer en bewerk de mooiste foto's. Opleverduur: {opleverduur}.", `oplevering` "Je foto's staan klaar in je persoonlijke online fotogalerij." (marker + `OPEN(CON-ST-04)`: online gallery confirmed only for the three packages); + - deposit `{ amount: 50, note: 'Aanbetaling {aanbetaling}, restbedrag na de shoot.' }` (CON-ST-01; design E's brackets are not copied; `OPEN(CON-ST-04)`: whether the deposit also applies to Loveshoot/Portret, and when the remainder is paid); + - photos eyebrow "Impressie"; faq eyebrow "Veelgestelde vragen", lead `RichText` "Staat je vraag er niet tussen? " + link "Stuur gerust een berichtje" → `{ to: '/contact' }`; + - offer `bookLabel` "Boek dit pakket", `askLabel` "Eerst een vraag stellen", `onRequest` `{ price: 'Prijs op aanvraag', text: , linkLabel: }`. + - Shared FAQ items (2–3, general, drafts), e.g. "Wanneer krijg ik de foto's?" → answer with `{opleverduur}`; "Hoe leg ik de datum vast?" → answer with `{aanbetaling}`. No cancellation/rescheduling content (Clarification 2 = B). + - Every text gets the draft marker except the fixed facts that come straight from the requirements (step titles, deposit amount, breadcrumb labels): those are not drafts. + +- [x] **Step 4 — Newborn page content** [large] — *FR-ST-02..08, FR-ST-11, CON-ST-01, CON-ST-02, CON-ST-04, CON-ST-05, SECURITY-09* + - Done as written. Shared item: `deliveryFaq` (5 items). Story 3's second paragraph is design E's sentence without "Ik neem alles mee …"; "Wat moet ik thuis voorbereiden?" keeps only "Weinig. Een warme kamer met wat daglicht is fijn." Image ContentImages are literal (asset import + the portfolio/shoot alt text and size; Step 13 checks they stay equal). Note for review: story 4's heading/paragraph keep design E's "1 tot 2 uur" (same figure as the package feature "1-2 uur fotografie"; kept because the plan says headings and paragraphs as design E). + - New `web/src/content/shootPages/newborn.ts`, default export `newbornPage: ShootPageContent`, `id: 'newborn'`. + - Copy from design E (Newborn) **without** its bracketed placeholders and without unconfirmed facts: + - intro: eyebrow "Newbornfotograaf in Huizen", title "Newbornshoot bij jou thuis", text as design E. + - stories (4, ids `verwachten`, `periode`, `locatie`, `duur`): headings and paragraphs as design E, except: drop "Na afloop krijg je minstens 40 zorgvuldig nabewerkte foto's …" (a package figure as free text, NFR-ST-04; the package block shows it) and drop "Ik neem alles mee wat ik nodig heb." (CON-ST-04). Keep the Newborn-specific "voorlopige datum … schuiven we mee" line (CON-ST-01 exception). + - process: `location` "Een newbornshoot is bij jou thuis.", `duration` "1-2 uur fotografie, in het tempo van jullie baby.", `deliveryTime` "2–3 weken". + - photos: title "Uit eerdere newbornshoots"; provisional selection (unit 2 finalises in FD): stories 1 `assets/shoots/newborn.jpg` (848×1060, shoot main photo), 2 `assets/portfolio/f41a8700.jpg` (800×534), 3 `f41a7176.jpg` (800×1200), 4 `f41a1916.jpg` (800×1200); mosaic images `f41a1922`, `f41a4650` (800×533), `f41a7284`, and `f41a8700` (kept in the data on purpose, as in design E; D14 drops it in the view). Alt texts: reuse the portfolio/shoot alt texts of the same photo. + - faq: title "Vragen over de newbornshoot"; items: "Wanneer boek ik de newbornshoot het beste?", "Wat als mijn baby niet wil slapen?", "Mogen wij en broertjes of zusjes ook op de foto?", "Wat moet ik thuis voorbereiden?" (answer without "Ik neem zelf dekens en doeken mee" and without the checklist sentence, CON-ST-04), plus one shared item from Step 3. Total 3–5. + - offer: eyebrow "Pakket newborn", title "Wat zit er in een newbornshoot"; closing: title "Op zoek naar een newbornfotograaf in Huizen?", lead as design E, buttonLabel "Boek je newbornshoot". + - Draft marker on every drafted field (all of the above except `id` and the image data). + +- [x] **Step 5 — Zwangerschap and Gezin page content** [large] — *FR-ST-02..08, FR-ST-11, CON-ST-02, CON-ST-04, CON-ST-05* + - Done. Stories: Zwangerschap verwachten/periode/locatie/duur, Gezin verwachten/samen ("Iedereen hoort erbij"; no best period exists for Gezin)/locatie/duur. Photo choice: story 1 main photo, stories 2–3 the two portfolio photos, story 4 text only; `photos.images` lists the two portfolio photos, so with D14 the view leaves the mosaic out until more photos arrive (comment in the file; FD unit 2 may instead move them to the mosaic). Story 4 avoids the duration figure ("Rustig de tijd"); the figure is only in `process.duration` "1 uur fotografie, zonder haast." (D6). FAQ: 3 own + `bookingFaq` + `deliveryFaq` (Zwangerschap 5), 2 own + the same two (Gezin 4). No `OPEN` needed: every fact comes from `shootTypes.ts`/`packages.ts`. + - New `web/src/content/shootPages/zwangerschap.ts` and `gezin.ts`, same shape as Step 4, drafted in Andrea's tone from `shootTypes.ts` (period 30–34 weken, Soesterduinen/heide for Zwangerschap; thuis of buiten for Gezin) and `packages.ts`. + - `process.duration`: "1 uur fotografie, …" (matches the package feature, D6); `deliveryTime` "2–3 weken"; `location` from the shoot type text. + - Photos (provisional): Zwangerschap `shoots/zwangerschap.jpg`, portfolio `f41a7883`, `f41a8206`; Gezin `shoots/gezin.jpg`, portfolio `f41a1579`, `f41a7138` (note in a comment: the `shoots/gezin*` photos show newborn families, CON-ST-05). A story block may have no image (FR-ST-03). The detail photo is used by the package block (view), so do not repeat it in stories. + - 3–5 FAQ items each (own + shared); four stories each with headings that fit the shoot. Only facts that exist in the current texts; everything else left out or marked `OPEN(CON-ST-04)`. + +- [x] **Step 6 — Loveshoot and Portret page content** [large] — *FR-ST-02..08, FR-ST-11, CON-ST-02, CON-ST-04, CON-ST-05* + - Done. Stories: Loveshoot verwachten/trouwkaart/locatie/ontspannen, Portret verwachten/natuur-zakelijk/locatie/ontspannen (4th theme "at ease in front of the camera" instead of duration; stories 2–4 text only). `process.duration` "We stemmen de duur samen af." + `OPEN(CON-ST-04)`; Portret also has `OPEN(CON-ST-04)` on its location story and `process.location` (locations unknown). `process.location` is "En een plek die bij jullie/jou past." (no places named). Offer eyebrow/title "Loveshoot boeken"/"Portretshoot boeken" + "Benieuwd naar de mogelijkheden?" (no "Pakket …", there is no package). FAQ: 2 own + `bookingFaq` + `deliveryFaq` each; no price, duration or photo-count question. + - New `web/src/content/shootPages/loveshoot.ts` and `portret.ts`, same shape. + - Unknown facts (CON-ST-04): duration, photo count, best period, Portret locations. They are **not** invented: story themes are chosen so they need none of them (e.g. "Wat kun je verwachten", "Voor jullie trouwkaart" / "Natuur of zakelijk" from the existing text, "Samen een plek kiezen" without naming places); `process.duration` gets a neutral sentence without a figure (e.g. "We stemmen de duur samen af.") with the draft marker **and** `// OPEN(CON-ST-04): shoot duration for `. + - Photos: only the shoot main photo (stories) and the detail photo (package); `photos.images` lists both so that adding photos later is data-only, and the view leaves the mosaic out (D14/D15). Comment says so. + - No price anywhere (variant "Prijs op aanvraag" is decided by data, FR-ST-07). + +- [x] **Step 7 — Gezin overview draft marker** [small] — *CON-ST-03, D3* + - Done, no deviation (one comment line replaced). + - `web/src/content/shootTypes.ts`: replace the comment `// Draft text, still to be approved by Andrea (FR-SF-02)` with the common marker. No data change. + +### Generators and pure logic + +- [x] **Step 8 — Generators** [large] — *NFR-ST-06, PBT-07* + - Done. Deviations: `shootPageContent(id?, reuse = [])` takes the shoot's main/detail images as an optional second argument (the generator cannot know the shoot's `src` otherwise); stray braces in generated text are opening ones only (a stray `{` and `}` around a filled placeholder could form a new one, which would break "no known placeholder remains"; a lone `}` is covered by examples). Also exported as building blocks: `knownPlaceholders`, `plainText` (hostile, brace-free; used for placeholder values), `knownRoutePath` (keys of `sitePages`), `faqItems` (unique ids). + - `web/src/test/arbitraries.ts` (append only; export the existing private `image` arbitrary as `contentImage` without changing its definition): + - `placeholderName` (the five known names plus unknown ones), `textWithPlaceholders`, `inlineLink` (known `RoutePath`s, optional hash), `richText` (strings and links, including hostile content: ``, `<`, `>`, `&`, U+2028, `{`/`}`), + - `storyBlock` (optional image), `faqItem` (unique ids, `RichText` answers with placeholders and links), + - `shootPageShared` (steps as a full `Record` generated in random key order, deposit amount 1–999), + - `shootPageContent(id?)` (stories 0–6, FAQ 0–6, photos 0–8 with deliberate duplicates of story `src` and of the shoot's detail/main `src`), + - `slugInput` (known ids, case variants, leading/trailing slashes, `..`, `%2F`, whitespace, ``, arbitrary strings and non-strings for `unknown`). + - Reuse `shootType`, `uniqueShootTypes`, `anyPackage`, `anySiteContent`; no duplicated generators. + +- [x] **Step 9 — Path helpers** [large] — *FR-ST-01, SECURITY-05, SECURITY-15, PBT-02, PBT-03* + - Done, no deviation. Path PBT input is built in the test from `slugInput` (prefix + slug + "", "/" or "//"), the overview paths and arbitrary strings. 9 tests, 100 % coverage of `shootPages.ts`. + - New `web/src/lib/shootPages.ts`: `SHOOT_TYPES_PATH`, `SHOOT_TYPE_IDS` (built from a `Record` so a new id is a compile error until listed), `ShootPagePath`, `shootPagePath`, `shootIdFromSlug` (via `isShootTypeId(value, SHOOT_TYPE_IDS)`), `shootIdFromPath` (exact `'/soorten-fotoshoots/'`, one trailing slash tolerated; never throws). The route guard type is added in Step 18, not here (the routes do not exist yet, so `tsc` would fail in between). + - New `web/src/lib/shootPages.test.ts`: examples (all five ids, `/soorten-fotoshoots/onzin`, `/soorten-fotoshoots`, `/soorten-fotoshoots/newborn/`, `/soorten-fotoshoots/Newborn`, `/soorten-fotoshoots/newborn/extra`, `%2F`); PBT per services.md: round trip `shootIdFromSlug(id) === id` and `shootIdFromPath(shootPagePath(id)) === id` (PBT-02); any `slugInput` → known id or `undefined`, never throws, and a defined result `r` satisfies `shootPagePath(r) === input` without its one trailing slash (PBT-03). + +- [x] **Step 10 — Package helper and contact link** [large] — *FR-ST-07, FR-ST-08, SECURITY-05, PBT-03* + - Done, no deviation. `shootContactLink` now takes `pakket` from `shootPackage(...).id` (equal to `shoot.packageId`); existing tests unchanged and green, plus "agrees with shootPackage (invariant)". 100 % coverage of both files. + - New `web/src/lib/shootPackage.ts` + test: `shootPackage(shoot, packages)` = the member of `visiblePackages(packages)` with `id === shoot.packageId`, else `undefined`. Examples: the three real shoots with a package, Loveshoot/Portret, a removed and an invalid package. PBT: result `undefined` or a visible package with the right id (PBT-03). + - `web/src/lib/shootLinks.ts`: `shootContactLink` uses `shootPackage` (same results, same return type). `web/src/lib/shootLinks.test.ts`: existing tests unchanged and green; add PBT "agrees with `shootPackage`": `search?.pakket === shootPackage(...)?.id` (PBT-03). + +- [x] **Step 11 — Placeholders and plain text** [large] — *FR-ST-04, FR-ST-06, SEO-ST-03, NFR-ST-04, PBT-03, PBT-04* + - Done. `Object.hasOwn` own-property check; values inserted literally (replace callback, so `$&` in a value is not special). Idempotency and "no known placeholder remains" are tested with `textWithPlaceholders` and brace-free values (see Step 8); "unchanged" with any brace-containing string that has no `{name}`. Also an oracle-style per-piece property for `fillRichText`. 100 % coverage. + - New `web/src/lib/fillPlaceholders.ts`: `fillPlaceholders(text, values)` replaces every `{name}` whose name is in `values` (own-property check, so `{constructor}` stays), other text unchanged; `fillRichText` maps string pieces and link `text`, keeps `to`/`hash`. `lib/withReplyTime.ts` (contact page) stays as it is. + - New `web/src/lib/richTextToPlain.ts`: string pieces as they are, links by their `text`, joined without separators. + - Tests (`fillPlaceholders.test.ts`, `richTextToPlain.test.ts`): examples (each placeholder, unknown placeholder kept, repeated placeholder, `{`/`}` alone); PBT per services.md: no placeholder → unchanged; fill twice = fill once when values contain no `{…}` (PBT-04); no known placeholder remains; links keep `to`/`hash`; plain text equals joined pieces, length = sum of piece lengths (PBT-03). + +- [x] **Step 12 — The page view** [large] — *FR-ST-01..08, FR-ST-11, NFR-ST-04, SECURITY-05, SECURITY-15, PBT-03* + - Done, types exactly per component-methods.md. Known ordering effect: `BreadcrumbItem.to: RoutePath` cannot hold the shoot page path until the routes exist, so `pnpm exec tsc` reports one error in `shootPageView.ts` (breadcrumb last item) until Step 18 adds the route files (no cast or widened type added). Placeholders are filled in story eyebrow/title/paragraphs, step texts, deposit note and FAQ question + answer (the generators put placeholders in exactly those); intro, closing and FAQ lead are passed through. 13 tests (4 examples on real content, 9 PBT), 100 % coverage. + - New `web/src/lib/shootPageView.ts`: `PROCESS_STEP_ORDER`, `MOSAIC_MIN_PHOTOS = 2` (comment: confirmed in FD unit 2), `BreadcrumbItem`, `ProcessStep`, `ShootPageSources`, `ShootPageView`, `shootPageView(id, page, sources)` exactly per component-methods.md and the rule table in services.md (shoot lookup / id mismatch → `undefined`; breadcrumb Home `/` → overview `/soorten-fotoshoots` → `shoot.name` at `path`; placeholder values `{reactietermijn}` ← `site.contactForm.replyTime`, `{aanbetaling}` ← `formatPrice(shared.deposit.amount)`, `{locatie}`/`{duur}`/`{opleverduur}` ← `page.process`, applied to steps, deposit note, stories and FAQ answers; six steps in fixed order; `offer.image` = detail photo else main photo; `pkg` via `shootPackage`; `bookLink`/closing `link` via `shootContactLink`; `askLink` `{ to: '/contact' }`; photos without any `src` used by a story block or the offer image, first occurrence kept, order kept, absent below `MOSAIC_MIN_PHOTOS`, `portfolioLink` iff `id ∈ portfolioShoots`; FAQ absent when no items). + - New `web/src/lib/shootPageView.test.ts`: examples with the real content for Newborn (package variant with `pkg.price` 185, deposit note filled to "Aanbetaling € 50, restbedrag na de shoot." with a non-breaking space, mosaic drops `f41a8700`) and Loveshoot (no `pkg`, no mosaic, `bookLink` `{ to: '/contact' }`), a missing shoot type and a mismatched `page.id` → `undefined`. PBT with the Step 8 generators, one test per property of services.md § `shootPageView` (PBT-03), including "no known placeholder left in any text" and "`bookLink.search?.pakket` only a visible package id". + +- [x] **Step 13 — Content consistency tests** [large] — *FR-ST-03, FR-ST-05, FR-ST-06, FR-ST-11, CON-ST-03, CON-ST-04, D6, D14, PBT-10* + - Done, no deviation (the two pending tests were added with the real `ShootPageSources`; `portfolioShoots: []`). Earlier part: `shootPages.test.ts` has the page table, ids, four stories, 3–5 FAQ, alt/size, D6, deliveryTime and the text checks (brackets, unknown placeholder or stray brace, `@`, annuler/verzet) over the five pages and `shootPageShared`; plus one extra check that a reused photo keeps the alt text and size it has in `shootTypes`/`portfolioContent`. **Pending** until Step 12 exists: "`shootPageView` returns a view for every shoot" and "no photo `src` twice on the view, stories + offer image + mosaic (D14)". + - New `web/src/content/shootPages/shootPages.test.ts` (example-based, real content; one table of the five page modules keyed by `ShootTypeId`, typed `Record` so a missing file is a type error): + - every page's `id` equals its key; exactly four stories with unique ids; 3–5 FAQ items with unique ids; + - `shootPageView` returns a view for every shoot with the real sources (fail-safe path never taken by real data); + - no photo `src` twice on the rendered view (stories + offer image + mosaic) (D14), every image has a non-blank alt and positive size; + - D6: for a shoot whose `shootPackage` exists, `process.duration` starts with the package feature that ends in "uur fotografie"; + - no text contains `[` or `]` (design placeholders), an unknown `{…}` placeholder, an e-mail address, "annuler" or "verzet" (no cancellation terms); + - `deliveryTime` is "2–3 weken" for all five (CON-ST-01). + +### SEO and structured data + +- [x] **Step 14 — SEO builders** [large] — *SEO-ST-01, SEO-ST-03, SECURITY-11, PBT-02, PBT-03* + - Done as written (builders return inferred types, like the existing ones; `faqPage` also sets `inLanguage: 'nl-NL'` like `webPage`). Ordering effect, not a code issue: `shootPageGraph` passes `view.path` to `webPage`/`faqPage` (`RoutePath`), so `tsc` reports two errors in `seo.ts` until Step 18, and `webPage` reads `sitePages[view.path]`, so the 4 `shootPageGraph` tests in `seo.test.ts` (Newborn/Loveshoot examples, two PBT) fail with "reading 'title'" until Step 19 adds the registry entries. Verified beforehand with a throw-away vitest config (scratchpad, not in the repo) that registers five stub entries: 57/57 green, `seo.ts` 100 % coverage. Renamed test: "gives every service the id and URL of its own shoot page (invariant)". + - `web/src/seo.ts`: add `shootServiceId(id)` (`${siteUrl}/soorten-fotoshoots/#service`, D2), `shootService(shoot, site, pkg?)` (Service: `@id`, `url` = canonical shoot page, `name`/`serviceType` = `shootLabel`, `description` = `paragraphs[0]`, `image` = `absoluteUrl(image.src)`, `provider`, `areaServed`; `offers: { '@type': 'Offer', price, priceCurrency: 'EUR' }` only when `pkg`), `breadcrumbList(items)`, `faqPage(path, items)` (`undefined` for no items; `isPartOf` the WebPage `@id`), `shootPageGraph(view, site)` (`webPage('WebPage', view.path, { mainEntity: shootService(view.shoot, site, view.offer.pkg), breadcrumb: breadcrumbList(view.breadcrumb.items) })` and, with FAQ items, the FAQPage). `shootServices` keeps its signature and builds each item with `shootService(shoot, site)` (no `pkg`, so no offers). Import `BreadcrumbItem`/`ShootPageView` as types only. + - `web/src/seo.test.ts`: + - update the existing `shootServices` tests that assert the old anchor ids (`${page}#${id}`) to the new `shootServiceId` and shoot page `url` (rename "gives every service its own anchor as @id" accordingly); the "no price" invariant stays; + - examples: Newborn graph (WebPage + FAQPage, Offer € 185 EUR, breadcrumb of three absolute URLs), Loveshoot graph (no `offers`); + - PBT per services.md: breadcrumb positions 1..n, absolute URLs under `siteUrl`, names in order; FAQPage one Question per item in order with answer = `richTextToPlain`; overview item and shoot page Service share `@id`, `url` = canonical shoot page, `offers` iff `pkg` (PBT-03); `JSON.parse(jsonLdScript(x))` deep-equals `x` for every new builder with hostile strings, output never contains `<`, `>`, `&`, never the e-mail address (PBT-02, PBT-03). + +- [x] **Step 15 — StructuredData component** [small] — *SEO-ST-03, SECURITY-04, SECURITY-11* + - Done, no deviation. The `` test checks the script text has no `<`, `>` or `&`, parses back to the data, and that the serialised markup parsed again as HTML still has one script and no injected element (a check on the DOM alone would pass even without escaping). Not yet used by the overview route (Step 17). + - New `web/src/components/StructuredData/StructuredData.tsx`: `{ data: unknown }` → `` in the data does not end the element. + +### Page shell and routes + +- [x] **Step 16 — ShootPage shell** [small] — *FR-ST-02 (h1 only), SEO-ST-04, NFR-ST-01* + - Done, no deviation. The test builds the view for Newborn from the real sources. + - New `web/src/components/shoots/ShootPage/ShootPage.tsx`: `{ view: ShootPageView }`; renders `PageIntro` with `view.intro.eyebrow`, `view.intro.title` (the only h1) and `view.intro.text`. Comment: unit 2 adds the sections in the order of the page structure. No content imports. + - New `ShootPage.test.tsx` (with `renderWithProviders`): one h1 with the title, eyebrow and intro text shown, no axe violations. + +- [x] **Step 17 — Move the overview route** [small] — *FR-ST-01, FR-ST-09, SEO-ST-03* + - Done. Only deviation: the comment above `StructuredData` now says "StructuredData escapes" instead of "jsonLdScript escapes". + - `git mv web/src/routes/soorten-fotoshoots.tsx web/src/routes/soorten-fotoshoots/index.tsx`; fix the relative imports (`../` → `../../`); route string `'/soorten-fotoshoots/'` (the generator writes it; check it did); replace the inline ``, `<`, `>`, `&`, very long words, empty-looking whitespace), and `shootPageViewArb` (a `ShootPageView` built by `shootPageView` from `shootPageContent(id, reuse)`, `shootPageShared`, a unique list of shoot types and packages, so stories 0–6, photos present or not and FAQ present or not all occur; it must never return `undefined`). + - Reuse `shootPageContent`, `shootPageShared`, `contentImage`, `storyBlock`, `faqItem`, `richText`, `uniqueShootTypes`, `anyPackage`; no duplicated generators. Smoke-check each new generator inside the tests of Steps 4–7 (no separate test file). + +- [ ] **Step 4 — headingId and readMoreLabel** [sonnet] — *BR-SP-72, BR-SP-64, FR-ST-09, SECURITY-15, PBT-03* + - Depends on: Step 3. + - New `src/lib/headingId.ts`: `headingId(prefix: string, id: string): string` = `${prefix}-${id}` with the whole result lower-cased and every character outside `a-z 0-9 - _` replaced by `-` (BR-SP-72); pure, never throws for any string. The caller adds `-title` where needed. + - New `src/lib/readMoreLabel.ts`: `readMoreLabel(shoot: ShootType): string` = ``Lees meer over de ${shoot.shootLabel.toLowerCase()}`` (domain-entities.md § 6). + - Tests `headingId.test.ts`, `readMoreLabel.test.ts`: examples (the five real ids, spaces, uppercase, ``, empty string, non-ASCII); the five real labels ("Lees meer over de newbornshoot", "… zwangerschapsshoot", "… gezinsshoot", "… loveshoot", "… portretshoot") are unique; PBT per business-rules.md § 3: `headingId` output only `a-z0-9-_`, deterministic, never throws for arbitrary and hostile strings (invariant); `readMoreLabel` starts with "Lees meer over de " and is unique for any `uniqueShootTypes` list with unique `shootLabel` (invariant). 100 % coverage. + +- [ ] **Step 5 — mosaicLayout** [sonnet] — *FR-ST-05, BR-SP-30b, BR-SP-31, BR-SP-35, PBT-03* + - Depends on: Step 3. + - New `src/lib/mosaicLayout.ts`: `MOSAIC_MAX_PHOTOS = 4`, `MosaicTile` (`column`, `row`, `wide`, `phoneRatio`) and `mosaicLayout(count: number): MosaicTile[]` exactly per the table in domain-entities.md § 2 (0 or below none; 1 total-but-unused; 2, 3, 4; 5 or more = the layout for 4). Non-integer or `NaN` input: treat as no tiles (fail safe). + - Test `mosaicLayout.test.ts`: examples for 0, 1, 2, 3, 4, 5, −1; PBT over `mosaicCount` per business-rules.md § 3: `[]` for ≤ 0; exactly `min(count, 4)` tiles; desktop cells pairwise disjoint and, for 2 to 4, covering all eight cells of the 4 × 2 grid (compute cells from the `column`/`row` strings in the test); first tile always `1 / 3` × `1 / 3`; number of non-wide tiles even; pure (same output twice) (invariant). 100 % coverage. + +- [ ] **Step 6 — storyLayout** [sonnet] — *FR-ST-03, BR-SP-11, BR-SP-12, BR-SP-13, BR-SP-14, BR-SP-40, PBT-03* + - Depends on: Step 3. + - New `src/lib/storyLayout.ts`: `StoryLayout` (`tone`, `spacing`, `reverse`, `priority`, `media?: { aspectRatio: '3 / 2' | '4 / 5'; mediaSize: 'half' | 'medium' }`) and `storyLayout(stories: readonly StoryBlock[]): StoryLayout[]` (domain-entities.md § 2): tone `paper` for even index and `alt` for odd, spacing `flushTop` for index 0, `reverse` for odd index, `priority` only for index 0 and only with an image, `media` absent without an image; orientation: `width >= 1.2 * height` → `3 / 2` and `half`, otherwise `4 / 5` and `medium`. Export the threshold as a named constant. + - Test `storyLayout.test.ts`: examples with the real Newborn stories (4/5 + medium for the portrait photos, 3/2 + half for `f41a8700`) and a text-only list (Loveshoot); boundary examples (exactly 1.2, 1.19); empty list; PBT over `storyBlock`/`imageWithOrientation` per business-rules.md § 3: tone and `reverse` alternate with the index; `priority` only at index 0 and only with an image; no image means no `media`; ratio `3 / 2` exactly when width ≥ 1.2 × height and `mediaSize` matches (invariant). 100 % coverage. + +- [ ] **Step 7 — shootPageBands** [sonnet] — *BR-SP-70, BR-SP-71, BR-SP-73, FR-ST-02..08, PBT-03* + - Depends on: Steps 3, 6. + - New `src/lib/shootPageBands.ts`: `SectionBand` (`id`: `` `story-${string}` `` | `'process'` | `'photos'` | `'faq'` | `'offer'` | `'closing'`, `tone`, `position`) and `shootPageBands(view: ShootPageView): SectionBand[]`: stories in index order, then process, `photos` iff `view.photos`, `faq` iff `view.faq`, offer, closing; positions consecutive from 0, tone `paper` at even and `alt` at odd positions (the intro is not a band, it is `paper`). Story tones must equal `storyLayout(...)[i].tone` (the same rule; a test pins it). + - Test `shootPageBands.test.ts`: examples with the real views (Newborn: 4 stories + process + photos + faq + offer + closing = 9 bands; Loveshoot: no photos = 8) and a view without FAQ; PBT over `shootPageViewArb` per business-rules.md § 3: tones alternate strictly starting with `paper`; ids in canonical order; length = stories + 1 + [photos] + [faq] + 2; no id twice; story band tone equals `storyLayout` tone (invariant). 100 % coverage. + +### Shared components + +- [ ] **Step 8 — Additive changes: PageIntro, MediaText, CallToAction** [sonnet] — *BR-SP-05, BR-SP-12, BR-SP-63, FR-ST-02, FR-ST-03, FR-ST-08, NFR-ST-02* + - `src/components/PageIntro/PageIntro.tsx`: new optional `titleId?: string` (id of the h1; the section gets `aria-labelledby={titleId}`) and `breadcrumb?: ReactNode` (rendered above the eyebrow with `mb` 6 on phones and 7 from `md`). Existing callers render byte-identically (no `aria-labelledby`, no wrapper). Test: one test pins the existing markup (`container.innerHTML` equal to the output without the new props, e.g. with a stored expected structure), one for `titleId`/`breadcrumb`. + - `src/components/MediaText/MediaText.tsx`: `mediaSize` accepts `'medium'` in addition to `'half'` and `'small'`: photo column up to 30rem (480 px), text up to 36rem centred in the rest, laid out exactly as `small` does (reuse its branch; add a `MEDIUM_MEDIA = '30rem'` constant next to `SMALL_MEDIA`). Detail-image behaviour unchanged. Add the `medium` test to `MediaText.test.tsx`; existing tests unchanged and green. + - `src/components/CallToAction/CallToAction.tsx`: new optional `tone?: 'paper' | 'alt'`, default `'alt'`, passed to `PageSection`. Add one test; existing tests green. The overview page keeps its current output. + - Update the doc comments of the three components. Touch no other file. + +- [ ] **Step 9 — Breadcrumb** [sonnet] — *FR-ST-02, BR-SP-01..04, NFR-ST-01, SEO-ST-04* + - New `src/components/Breadcrumb/Breadcrumb.tsx` (+ test): props `label: string`, `items: readonly BreadcrumbItem[]` (type import from `@/lib/shootPageView`), optional `data-testid`. Markup per frontend-components.md § 2: `nav[aria-label]` > `ol` > `li` per item; links through the router `Link` (`RouterLink`) with `activeOptions={{ exact: true }}` (so only the page itself can carry `aria-current`), accent.deep text, permanent underline, `minH` 44 px, inline-flex centred; the last item a `span[aria-current="page"]` in `ink`; between items a decorative `li[aria-hidden="true"]` "/"; `fontSize` 0.875rem, `color` `ink.soft`, centred, wrap, gap 2. No items: renders nothing; one item: only the current page. + - Tests: examples (3 items, 1 item, none); PBT for 1 to 5 generated items per business-rules.md § 3: exactly the last item is a non-link with `aria-current="page"`, the others are links in order, separators number items − 1 and are `aria-hidden` (component property, few runs); axe. + +- [ ] **Step 10 — ProcessIcons** [sonnet] — *FR-ST-04, BR-SP-23, BR-SP-74, NFR-ST-01* + - New `src/components/shoots/ProcessIcons/ProcessIcons.tsx` (+ test): `processIcons: Record JSX.Element>` with the six SVGs from domain-entities.md § 4 (envelope, calendar with heart, coin, camera, sliders, picture): `viewBox="0 0 24 24"`, `fill="none"`, `stroke="currentColor"`, `stroke-width="1.5"`, round caps and joins, `aria-hidden="true"`, `focusable="false"`, 24 × 24; shapes verbatim from design E (also in the domain-entities table). The `Record` type makes a missing id a compile error. + - Test: one icon per `PROCESS_STEP_ORDER` id, each `svg` is `aria-hidden`, not focusable, has no ``; axe. + +- [ ] **Step 11 — ProcessTimeline** [sonnet] — *FR-ST-04, BR-SP-20..26, NFR-ST-01, NFR-ST-02* + - Depends on: Step 10 (only for the page test; the component takes icons as props). + - New `src/components/ProcessTimeline/ProcessTimeline.tsx` (+ test): props `steps: readonly { id: string; title: string; text: string; icon?: ReactNode }[]`, `tone?: 'paper' | 'alt'` (default `paper`), `data-testid`. `Reveal` > `ol[role="list"]` > `li` per step (marker `div[aria-hidden]` with the icon, line segments `span[aria-hidden]`, text block with `h3` and `p`), layout exactly as frontend-components.md § 2 (below `lg`: grid `3.5rem | 1fr`, column gap 5, vertical line, list capped at `34rem` centred; from `lg`: grid of `repeat(<n>, minmax(0, 1fr))` by `auto 3.5rem auto` rows with `subgridRows` and fallback, text above for even indexes and below for odd, horizontal line through the markers from the first to the last centre). Markers hide the line with the band colour (`tone`); last marker filled (`accent.deep`, white icon), others outlined; no numbers; DOM order = `steps` order. Zero steps: renders nothing. Breakpoints via responsive props (`lg`), no pixel literals. + - If a CSS feature is not expressible with Chakra style props (subgrid with fallback), use a style prop `gridTemplateRows` with the `@supports`-free fallback in the same value list (`1fr 3.5rem 1fr` as the base, `subgrid` from `lg`); report if impossible. + - Tests: examples (6 steps; 1 step; 0 steps; last marker filled; an alternation check that does not depend on class names, e.g. a `data-text-position="above|below"` attribute set from the index parity); PBT for 1 to 8 `timelineSteps` per business-rules.md § 3: one `li` per step in input order, one h3 per `li`, every icon wrapper `aria-hidden`, no digit-only text added by the component (component property, few runs); axe. + +- [ ] **Step 12 — PhotoMosaic** [sonnet] — *FR-ST-05, BR-SP-30b..35, BR-SP-41, BR-SP-42, NFR-ST-03* + - Depends on: Step 5. + - New `src/components/PhotoMosaic/PhotoMosaic.tsx` (+ test): props `images: readonly ContentImage[]`, `data-testid`. Takes the first `MOSAIC_MAX_PHOTOS`; `ul[role="list"]` as a grid (below `md` two columns; from `md` four columns by two rows of `clamp(12rem, 22vw, 18.75rem)`; gap `gridGap`) with `Reveal as li` (delay `index * 0.08`) per tile with the tile's `column`/`row` (from `md`) or span 2 when `wide` (below `md`), `aspectRatio` = `phoneRatio` below `md` and `auto` from `md`, `position: relative`, `overflow: hidden`, `bg paper.deep`, and a `DeferredImage` absolutely filling the cell (`objectFit: cover`, intrinsic width/height attributes kept by `DeferredImage`). Not interactive (Q3 = A): no link, no button, no hover effect. Empty list: renders nothing. + - Tests: examples with 2, 3, 4, 5 and 0 photos (tile counts 2, 3, 4, 4, none; alt texts present; no `a`/`button` inside); PBT for 2 to 6 generated images per business-rules.md § 3: `min(n, 4)` `img` elements with the given alt texts in order (component property); axe. + +- [ ] **Step 13 — FaqList** [sonnet] — *FR-ST-06, BR-SP-50..53, NFR-ST-01, SECURITY-11* + - New `src/components/FaqList/FaqList.tsx` (+ test): props `items: readonly FaqItem[]`, `data-testid`. `Box` with a top hairline (`sand`) > per item one native `details` (bottom hairline) > `summary` (flex, space-between, `minH` 44 px, `py` 5, heading font 1.25rem, `ink`, `cursor pointer`, `listStyle none`, WebKit marker hidden, visible focus ring from the theme `focusRing` token with offset) holding the question and a decorative `svg[aria-hidden]` plus icon whose vertical stroke is hidden by CSS under `details[open]` (Chakra `css`/`_open`-style selector; no state), followed by `RichParagraph` for the answer with `mb` 6 and `maxW` 680 px. **No item has the `open` attribute** (Q5 = C); no React state, no JavaScript handler. Answers stay in the DOM when closed. Question text is the disclosure label, not a heading. Zero items: renders nothing. + - Tests: examples (3 items all closed at load, answers in the DOM, answer links present as links); keyboard: focus the `summary`, press Enter and Space with `userEvent` and check `open`; if jsdom does not toggle `details` on activation, diagnose the cause first (do not skip the assertion silently) and test the attribute through the documented jsdom behaviour or report; PBT for 0 to 6 `faqItem`s per business-rules.md § 3: one `details` per item, every answer text present in the DOM, no `details` with `open` (component property); axe. + +- [ ] **Step 14 — PackageBlock** [sonnet] — *FR-ST-07, BR-SP-60..62, NFR-ST-01, SECURITY-11* + - Depends on: Step 8 (`MediaText` `small` already exists; no `medium` needed here). + - New `src/components/PackageBlock/PackageBlock.tsx` (+ test): props `titleId`, `eyebrow`, `title`, `image: ContentImage`, `frameColor?`, `pkg?: PricingPackage`, `onRequest: { price: string; text: string }`, `note?: string`, `children` (the actions), `data-testid`. `MediaText mediaSize="small"` (aspect `1 / 1`, deferred image, `frameColor`; **no priority**); text column: `Eyebrow`, `h2#titleId` (`sectionTitle`), price paragraph (heading font, 2.25rem, `accent.deep`, `formatPrice(pkg.price)` or `onRequest.price`), then the features `ul` (rows with a `sand` top border, the last also a bottom border; `role="list"`) when `pkg` exists or the `onRequest.text` paragraph (`ink.soft`) otherwise, the actions row (flex, wrap, gap 3 / 7, centred) with `children`, and the `note` paragraph (0.875rem, `mt` 5) when given. The variant is decided by `pkg` presence only, never by a shoot id. + - Tests: Newborn-style package (price `€ 185` with the non-breaking space from `formatPrice`, all features listed, note shown), on-request variant (price text and text paragraph, no list), no note, extra actions rendered; axe. + +### Shoot page parts + +- [ ] **Step 15 — StoryBlocks** [sonnet] — *FR-ST-03, BR-SP-10..14, BR-SP-40, BR-SP-41, NFR-ST-03* + - Depends on: Steps 4, 6, 8. + - New `src/components/shoots/StoryBlocks/StoryBlocks.tsx` (+ test): props `stories`, `frameColor`, `idPrefix`. One band per story, tone, spacing and media from `storyLayout`. With media: `PageSection` (`labelledBy`) > `MediaText` (`image`, `aspectRatio`, `mediaSize`, `reverse`, `priority`, `frameColor`) whose text column holds `Eyebrow`, `h2` (`sectionTitle`, id `headingId(idPrefix, story.id) + '-title'`) and a stack of `RichParagraph`s (gap 4, `ink.soft`). Without media (Q4 = A): the same `PageSection` (width `narrow`, tone and spacing from the layout) with the same text column inside a `Reveal`, `maxW` 36rem, centred; no `MediaText`, no frame, no empty column. `data-testid="story-<id>"`. Only index 0 may be a priority image; all other photos are deferred (BR-SP-40/41). Empty list: renders nothing. + - Tests: Newborn stories (4 sections, each named by its h2, first image is not lazy and carries `fetchpriority="high"`, the others lazy and deferred, tones alternate), Loveshoot stories (1 photo, 3 text-only bands), hostile story ids (spaces, uppercase) give valid `aria-labelledby` targets that exist in the DOM; axe. + +- [ ] **Step 16 — ShootBlock "Lees meer"** [sonnet] — *FR-ST-09, BR-SP-64, Q6 = A, NFR-ST-01* + - Depends on: Step 4. + - `src/components/shoots/ShootBlock/ShootBlock.tsx`: new first link in the links row: `Link variant="underline" asChild` with `linkStyle` > `RouterLink to={shootPagePath(shoot.id)}` with the visible text `readMoreLabel(shoot)` and `data-testid={`shoot-${shoot.id}-readmore`}`; no `aria-label` (the visible text already differs per shoot). Props unchanged; `article` id, the other two links and their `aria-label`/test ids unchanged. Update the file comment. + - `ShootBlock.test.tsx` and `ShootList.test.tsx`: link text and `href` per shoot (all five), the link comes first, unique accessible names across the list, existing anchors and links still present, axe. Existing assertions stay unchanged and green; check the overview tests in `app.test.tsx` still pass. + +- [ ] **Step 17 — ShootPage assembly** [sonnet] — *FR-ST-02..08, BR-SP-70, BR-SP-71, BR-SP-73, BR-SP-74, NFR-ST-01, NFR-ST-03, SEO-ST-04* + - Depends on: Steps 7, 8, 9, 10, 11, 12, 13, 14, 15. + - `src/components/shoots/ShootPage/ShootPage.tsx`: props `{ view }` unchanged; no content imports; no state. Composition in the order of `shootPageBands(view)` (frontend-components.md § 3): (1) `PageIntro` with `eyebrow`, `title`, `titleId="intro-title"`, `breadcrumb=<Breadcrumb label items/>`, text `view.intro.text`; (2) `StoryBlocks` (`frameColor = view.shoot.frameColor`, `idPrefix="story"`); (3) `PageSection id="zo-werkt-het" labelledBy="process-title" tone` with `SectionHeading` (eyebrow, h2 id `process-title`, lead) and `ProcessTimeline` (steps mapped with `processIcons[step.id]`, `tone` passed; an id without an icon yields none); (4) if `view.photos`: `PageSection id="impressie" labelledBy="photos-title" tone` with a head (eyebrow, h2 `photos-title`, "Bekijk meer {photosLabel}" link when `portfolioLink`, at least 44 px high, wrapping below the heading on narrow screens) and `PhotoMosaic`; (5) if `view.faq`: `PageSection id="vragen" labelledBy="faq-title" tone` in two columns from `lg` (eyebrow, h2 `faq-title`, `RichParagraph` of the lead | `FaqList`), stacked below; (6) `PageSection id="pakket" labelledBy="offer-title" tone` with `PackageBlock` (`titleId="offer-title"`, `view.offer` data, `note = depositNote`, actions: package variant "Boek dit pakket" (`bookLink`, accent `LinkButton`) + "Eerst een vraag stellen" (`askLink`, underline link); on-request variant one primary button `onRequest.linkLabel` to `bookLink`); (7) `CallToAction` (`titleId="closing-title"`, `tone` = next band tone, rich-text lead via `RichParagraph`, accent `LinkButton` to `closing.link`). `data-testid`s: `shoot-page`, `shoot-breadcrumb`, `story-<id>`, `process-timeline`, `photo-mosaic`, `faq-list`, `package-block`, `shoot-closing`. The portfolio link uses the same `shootPortfolioLink` data from the view. + - Update `ShootPage.test.tsx` (the unit-1 test stays valid; extend it): one h1, h2 per section, h3 per step, no level skipped (heading outline for Newborn with mosaic and FAQ, Loveshoot without mosaic, and a view without FAQ built by clearing `faq` in a copy of the content), every `aria-labelledby` target exists, section anchors `zo-werkt-het`, `impressie`, `vragen`, `pakket` exist when the section does, adjacent bands never share a tone (read from the `PageSection` backgrounds or a `data-tone` attribute added for the test), axe. + - Cross-check once with design E (side by side in a browser if one is available via the `run` skill; otherwise compare the structure by reading it): section order, eyebrows, story photo sizes and side alternation. Note differences in the summary; do not copy design E's bracketed placeholders. + +### Route-level tests + +- [ ] **Step 18 — `src/shootPages.test.tsx` (page structure and links)** [sonnet] — *FR-ST-02..09, NFR-ST-01, NFR-ST-06, SEO-ST-04, PBT-10* + - Depends on: Steps 16, 17. + - New `src/shootPages.test.tsx` using `renderApp` and `expectShell` from `src/test/renderApp.tsx` (copy the `vi.mock` and `beforeEach`/`afterEach` stubs that `app.test.tsx` needs for the same pages; mocks are per test file). Per shoot (`it.each` over `shootTypes`): heading outline (one h1; h2 per section; h3 = six steps), sections present or omitted as the data says (Newborn: mosaic with 3 tiles; Zwangerschap, Gezin, Loveshoot, Portret: no `#impressie`, no mosaic heading; FAQ and process always), the breadcrumb ("Kruimelpad", Home, Soorten fotoshoots, current page with `aria-current="page"`, three items), no `aria-current` anywhere in `main` other than the breadcrumb's last item (see the integration note in Step 26), package variant for Newborn/Zwangerschap/Gezin ("Boek dit pakket" `href` `/contact?pakket=<id>`, price from `formatPrice`) and "Prijs op aanvraag" for Loveshoot/Portret (no price, one primary button, `href` `/contact`), deposit note under the actions in both variants, closing band different tone from the package band, the first story photo is not lazy (priority) and no other photo has `loading="eager"`, axe on each of the five pages. + - Overview page: for every shoot a "Lees meer over de … " link to `/soorten-fotoshoots/<id>` that is first in the row and has a unique accessible name; the `article` anchors (`#newborn` … `#portret`) and the old links are still there (FR-ST-09). + - "Lees meer" facet of the registry consistency (NFR-ST-06, left to this unit by unit 1): for every `ShootTypeId` the overview has exactly one link to `shootPagePath(id)` and no link to any other `/soorten-fotoshoots/…` path. + - The OG facet is added in Step 20, not here. + +### OG wiring (only after the user approved the crops in Step 2) + +- [ ] **Step 19 — Wire the OG images into the registry** [haiku] — *SEO-ST-05, BR-SP-80, BR-SP-81, FR-ST-12* + - **Blocked until the orchestrator confirms the user approved the five crops from Step 2.** Do not start without that confirmation in the hand-over text. + - `src/sitePages.ts`: add to each of the five shoot entries, directly after `indexed: true`, `ogImage: { path: '/og-<id>.jpg', width: 1200, height: 630, alt: '<alt of the source photo, Dutch>' }` (alts as listed in Step 2, as approved). Existing entries and the `PageMeta` type unchanged. + - `src/app.test.tsx` (**not in unit 2's ownership table; one assertion**): the shoot-page head test currently expects `${siteUrl}/og-image.jpg` with the comment "The default image until unit 2 gives the pages their own" (around lines 519–522). Change it to `${siteUrl}${sitePages[path].ogImage!.path}` (or the equivalent that does not hardcode five names) and update the comment. Nothing else in the file; unit 3 does not edit this file (its tests live in `navSubmenu.test.tsx`). + - Run `pnpm exec tsc`, `pnpm lint`, `pnpm exec vitest run src/app.test.tsx src/seo.test.ts src/sitemap.test.ts`. + +- [ ] **Step 20 — OG registry consistency test** [sonnet] — *SEO-ST-05, BR-SP-80, FR-ST-12, PBT-10* + - Depends on: Step 19. + - In `src/shootPages.test.tsx`: for every `ShootTypeId` (finite set, example-based): `sitePages[shootPagePath(id)].ogImage` is defined, `path` is `/og-<id>.jpg`, width 1200, height 630, alt non-blank, and `web/public/og-<id>.jpg` exists (read with `node:fs`, resolved from the test file location); no two `ogImage.path` values in `sitePages` are equal across the whole registry; the file is a JPEG of 1200 × 630 (read the SOF0/SOF2 marker from the bytes in a small test helper, no image dependency) and at most 150 KB. Also assert the `og:image` meta of each shoot page in the app equals `siteUrl + ogImage.path` (one `renderApp` per shoot, or reuse the facet of `app.test.tsx` if it is enough; do not duplicate it). + +### Documentation + +- [ ] **Step 21 — LAYOUT.md and layout conventions** [haiku] — *FR-ST-13, BR-SP-90* + - `LAYOUT.md`: new section **"Shoot page"** placed directly after "Types of shoots" (before "Contact"), the `block-beta` diagram from frontend-components.md § 9 (A Intro, B–E Story 1–4, F Process timeline, G Photos, H FAQ, I Package, J Book; style lines A–G as in the template, H `#9b6bb5`/`#745088`, I `#4cc3e0`/`#3992a8`, J `#8cb83f`/`#698a2f`, same `color:#fff,font-size:16px,width:400px,height:125px,stroke-width:2px`). Add a one-line note under the diagram that Photos is left out below the minimum number of photos. "Types of shoots", Shell and the other sections stay unchanged. + - `.ai/layout-conventions.md`: append the three `style` lines H, I, J to the template list and change the sentence "extend with a new letter using the same formula if an 8th block is ever needed" to name the ten letters (A–J) ("if an 11th block is ever needed"). No other change. + - Check the new colours: stroke = fill × 0.75 (H 155,107,181 → 116,80,136; I 76,195,224 → 57,146,168; J 140,184,63 → 105,138,47), all three distinct from A–G. Run `pnpm exec prettier --check` on the two files if prettier covers them (repo root files may be outside `web/`; if not, skip). + +### Verification + +- [ ] **Step 22 — Unit verification** [haiku] — *NFR-ST-01, NFR-ST-03, NFR-ST-05, NFR-ST-06, NFR-ST-07* + - Depends on: Steps 1–21 (Step 20 only if the user approved the crops; otherwise run it without 19/20 and **run Steps 19, 20 and this step's test, build and bundle items again** after the approval). + - In `web/`, each on its own and all green: `pnpm lint`; `pnpm format:check`; `pnpm exec tsc`; `pnpm test` (coverage thresholds 100 % for `src/lib/**`, `src/seo.ts`, `src/sitemap.ts`; note test count, files and the fast-check seed; the unit-1 baseline is 90 files / 595 tests); `pnpm build`; `pnpm audit:deps` and `pnpm audit:dev` (the branch was fast-forwarded to master 1416497, which contains the seroval patch from PR #12 — lockfile resolves `seroval@1.7.3` — so `audit:deps` must pass; a failure is reported). Lighthouse is Step 23, not part of this step. + - `git diff --exit-code web/pnpm-lock.yaml web/package.json web/config/securityHeaders.ts` (no new dependency, headers unchanged; SECURITY-04/10). `git diff --stat web/src/routeTree.gen.ts` must show no change from unit 2's work (`pnpm exec vite build` regenerates it; no route files added). + - **Bundle check (NFR-ST-03)**: from `web/dist/assets`: main `index-*.js` size and gzip against unit 1's 528.98 kB / 150.69 kB (report the delta; unit 2 should add only `ShootBlock`'s link and `PageIntro`/`MediaText`/`CallToAction` props to shared chunks); the strings "Kruimelpad", "Zo werkt het", "Uit eerdere newbornshoots" and the `aria-labelledby` ids `process-title`/`faq-title`/`offer-title` must **not** appear in `index-*.js`; "Uit eerdere newbornshoots" appears in exactly one chunk (`newborn-*.js`); the new components (`Breadcrumb`, `ProcessTimeline`, `PhotoMosaic`, `FaqList`, `PackageBlock`, `StoryBlocks`) are in route or shared non-main chunks (list the chunk names). The OG JPEGs are in `dist/` (copied from `public/`) and each is ≤ about 100 KB. + - Security and quality greps on `web/src` (outside tests): `dangerouslySetInnerHTML` only in `components/StructuredData/` and the existing pre-feature uses; no `console.`; no e-mail address or `mailto:` in new files; no `[`…`]` design placeholders in any new visible text; no hard-coded colour value (`#`-hex, `rgb(`) in the new components; `rg -n "DRAFT\(CON-ST-03\)" web/src` count unchanged from unit 1's 98 (this unit adds no drafts; if it did, list them). + - If any item fails: diagnose the root cause, fix it (or hand a [sonnet] fix step to the orchestrator), re-run. Do not weaken a test or threshold. + +- [ ] **Step 23 — Lighthouse (mobile and desktop)** [haiku] — *NFR-ST-01, NFR-ST-03, FR-ST-12, SEO-ST-04* + - Depends on: Step 22 green. **Needs the orchestrator's claim of port 4173** (`pnpm preview --port 4173 --strictPort`; `--strictPort` fails fast when taken: then wait, never change the port) and a quiet machine (performance is blocking locally). Do not start without the orchestrator's go. + - In `web/`: `pnpm lighthouse` (runs `lhci autorun` for mobile and then `lhci autorun --config=lighthouserc.desktop.cjs`; indexed pages incl. the five shoot pages). Run it **after Step 19** so the OG images and final markup are measured (if the crops are still unapproved, run now and re-run later). + - Expected: accessibility, best practices and SEO **1.0** on every page, mobile and desktop; the five shoot pages performance ≥ **0.85 mobile** (goal 0.9) and ≥ **0.9 desktop**. Unit 1 left the shoot pages at 0.90 mobile / 100 desktop with the shell only and the baseline failures `/` 0.76 (budget 0.8) and `/contact` 0.85 (budget 0.9) that also fail on master; report current numbers for all pages next to those. + - A performance failure is **reported with the numbers, not worked around**. Mitigation order if the largest paint of a shoot page regressed (frontend-components.md § 7), each as a separate suggested fix for the orchestrator: (1) first story without the fade-in (`Reveal` removed for story 0), (2) fewer pixels for the first photo by capping its column, (3) report and keep the known limit. Record scores in the code summary; release the port claim when done. + +- [ ] **Step 24 — Code summary** [haiku] — *traceability, CON-ST-03* + - Depends on: Steps 22, 23. + - New `aidlc-docs/features/shoot-type-pages/construction/shoot-page-ui/code/code-summary.md` (same sections as unit 1's summary): status of each step; files created / changed (one line each, grouped as in "Files" above); requirement and business-rule coverage table (FR-ST-02..09, FR-ST-13, SEO-ST-04/05, NFR-ST-01/02/03/05/06, BR-SP-01..90 → files and tests); test count and seed (Step 22); bundle check numbers (Step 22); Lighthouse scores per page, mobile and desktop (Step 23); the OG images (sources, crops, sizes, approval date and who approved); deviations from this plan with reasons (the `app.test.tsx` assertion, the Gezin OG source, anything else); comparison notes against design E (Step 17); interfaces left for the orchestrator; open items (case-sensitive routing and the seroval advisory remain unit-1 decisions; whole-page `aria-current` integration facet, Step 26); the final Security and PBT compliance table below with evidence. State plainly that nothing is committed. + +- [ ] **Step 25 — Reverse-engineering lines (unit 2's own)** [haiku] — *NFR-ST-07* + - Only this unit's lines in `aidlc-docs/_shared/reverse-engineering/`, added with targeted edits next to unit 1's lines (never rewrite or re-flow a file: unit 3's lines go into the same files, so re-read the file immediately before editing and edit by unique anchor text; if it changed unexpectedly in the last minutes, tell the orchestrator instead of guessing): + - `code-structure.md`: `components/{Breadcrumb,ProcessTimeline,PhotoMosaic,FaqList,PackageBlock}/`, `components/shoots/{StoryBlocks,ProcessIcons}/`, the changed `ShootPage` line (sections instead of the shell), the `ShootBlock` link, the additive `PageIntro`/`MediaText`/`CallToAction` props, `lib/{headingId,readMoreLabel,mosaicLayout,storyLayout,shootPageBands}.ts`, `src/shootPages.test.tsx`, `public/og-<id>.jpg` ×5. + - `api-documentation.md`: lib section bullets for the five new helpers; the five shoot route rows now mention the sections and the `ogImage` per page (one short phrase each). + - `architecture.md`: one line on the shoot page composition (`shootPageBands` → sections) next to unit 1's Outlet line; no diagram restructure. + - No timestamp refresh. **Note**: the application design says the orchestrator writes both units' lines after both are done; this step follows the instruction for this plan (unit 2 writes its own lines). If the orchestrator prefers to write them, hand the lines over instead via the code summary and skip the edit. + +- [ ] **Step 26 — Integration facet after unit 3 (orchestrator, conditional)** [sonnet] — *BR-SP-03, NFR-ST-01, NFR-ST-06* + - **Run only when unit 3 is built in the same worktree.** Currently the header link "Soorten fotoshoots" and the footer link receive TanStack's fuzzy `aria-current="page"` on a shoot page (unit 3 fixes both, application-design D4), so a **whole-page** "exactly one `aria-current="page"`" assertion cannot pass in unit 2 alone; Step 18 therefore checks `main` only. + - Add to `src/shootPages.test.tsx` (unit 2's file) one test per shoot: in the whole document exactly one element has `aria-current="page"` **and** it is the breadcrumb's last item or the nav's exact-page child (decide with unit 3's final markup; the intended rule is "only the exact page", D4), then re-run the unit's tests. If both header submenu child and breadcrumb mark the same page, the rule is "at most one in `main` and at most one in `header`", not one overall; record the decision in the code summary. + +- [ ] **Step 27 — Hand back** [haiku] + - Report to the orchestrator: steps done and still blocked (Step 2 waits for the user's approval of the crops; Steps 19, 20 follow; Step 23 waits for the port claim; Step 26 waits for unit 3), check results, deviations from this plan, the changed shared components list, and the list of files outside unit 2's ownership that were touched (`src/app.test.tsx` one assertion). **No commit or push**; the orchestrator asks the user. A commit for the unit ("a commit per unit") is made only when the user asks. + +## Requirement / business-rule traceability + +| Requirement | Business rules | Steps | +|---|---|---| +| FR-ST-02 Intro with breadcrumb | BR-SP-01..05 | 8, 9, 17, 18 | +| FR-ST-03 Story blocks | BR-SP-10..14, 40, 41 | 6, 8, 15, 17, 18 | +| FR-ST-04 Process timeline | BR-SP-20..26 | 10, 11, 17, 18 | +| FR-ST-05 Photo mosaic | BR-SP-30a..35 | 5, 12, 17, 18 | +| FR-ST-06 FAQ | BR-SP-50..53 | 13, 17, 18 | +| FR-ST-07 Package block | BR-SP-60..62 | 14, 17, 18 | +| FR-ST-08 Closing call to action | BR-SP-63 | 8, 17, 18 | +| FR-ST-09 Overview links | BR-SP-64 | 4, 16, 18 | +| FR-ST-13 LAYOUT.md | BR-SP-90 | 21 | +| SEO-ST-04 Semantic structure | BR-SP-71, 72, 73 | 4, 7, 15, 17, 18 | +| SEO-ST-05 Preview image | BR-SP-80, 81 | 2, 19, 20 | +| NFR-ST-01 Accessibility | BR-SP-03, 20..25, 50..52 | 8–18, 22, 23 | +| NFR-ST-02 Reuse, responsive | all components | 8–17 | +| NFR-ST-03 Performance | BR-SP-40..42 | 15, 17, 22, 23 | +| NFR-ST-05 Security | BR-SP-72, 74 | 4, 9–17, 22 | +| NFR-ST-06 Testing | PBT list (business-rules.md § 3) | 3–7, 9–18, 20, 22 | +| NFR-ST-07 Coordination | file ownership | all, 25 | + +## Extension Compliance (unit 2, planning) + +### Security Baseline +| Rule | Status | Rationale | +|---|---|---| +| SECURITY-04 HTTP headers | Compliant (planned) | `securityHeaders.ts` untouched (Step 22 diff); no inline script or event handler; native `details` needs no JavaScript | +| SECURITY-05 Input validation | Compliant (planned) | No input added; ids in markup go through `headingId` (Step 4); link targets are typed routes or come from `shootContactLink`/`shootPagePath` | +| SECURITY-09 Hardening | Compliant (planned) | No debug output, no sample content, no bracketed placeholders (Step 22 greps); OG crops are real photos from the site's own assets | +| SECURITY-10 Supply chain | Compliant (planned) | No dependency added to `web/`; cropping uses a script outside the repository (Step 2); lockfile and `package.json` unchanged (Step 22) | +| SECURITY-11 Secure design | Compliant (planned) | Content is text and typed router links (`RichParagraph`); no `dangerouslySetInnerHTML`; no e-mail address (Step 22 greps) | +| SECURITY-13 Integrity | Compliant (planned) | Only bundled photos and `public/` OG images; no CDN or embed | +| SECURITY-15 Fail-safe | Compliant (planned) | Every component omits itself on empty input; `headingId` safe for any string; fewer photos than the minimum means no mosaic (Steps 4–17) | +| SECURITY-01, -02, -03, -06, -07, -08, -12, -14 | N/A | No data stores, intermediaries, server code, IAM, network, auth or alerting | + +### Property-Based Testing +| Rule | Status | Rationale | +|---|---|---| +| PBT-01 Identification | Compliant | The properties of business-rules.md § 3 are each mapped to a step (4–7, 9, 11, 12, 13) | +| PBT-02 Round trip | N/A | No parse/serialise or encode/decode pair is added | +| PBT-03 Invariants | Planned | `headingId`, `readMoreLabel`, `mosaicLayout`, `storyLayout`, `shootPageBands` (Steps 4–7) and four component properties (Steps 9, 11, 12, 13) | +| PBT-04 Idempotency | N/A | No operation with an idempotency contract is added | +| PBT-05 Oracle | N/A | No reference implementation | +| PBT-06 Stateful | N/A | No application state: FAQ state belongs to the browser, timeline and mosaic are stateless | +| PBT-07 Generators | Planned | Four generators appended in Step 3; unit 1's generators reused | +| PBT-08 Shrinking and reproducibility | Compliant | fast-check shrinking and seed logging untouched; seed reported in Step 22 | +| PBT-09 Framework | Compliant | fast-check already a dependency | +| PBT-10 Complementary | Planned | Example tests per helper and component, route-level tests (Steps 18, 20), axe everywhere; PBT tests labelled "(invariant)" | diff --git a/aidlc-docs/features/shoot-type-pages/construction/plans/shoot-page-ui-fd-questions.md b/aidlc-docs/features/shoot-type-pages/construction/plans/shoot-page-ui-fd-questions.md new file mode 100644 index 0000000..ea1d79b --- /dev/null +++ b/aidlc-docs/features/shoot-type-pages/construction/plans/shoot-page-ui-fd-questions.md @@ -0,0 +1,84 @@ +# Vragen Functional Design - Unit 2 "Shoot page UI" + +Feature: shoot-type-pages. Hoort bij [shoot-page-ui-functional-design-plan.md](shoot-page-ui-functional-design-plan.md). + +Dit zijn alleen de keuzes over uiterlijk en gedrag van de shootpagina's die echt van jou zijn. Technische details (breakpoints, rastermaten, laadvolgorde van foto's, toegankelijkheid) heb ik zelf besloten en in het ontwerp vastgelegd. Bij elke vraag staat mijn aanbeveling als eerste optie. De ontwerpdocumenten zijn al geschreven op basis van die aanbevelingen en staan als **voorlopig** gemarkeerd; ze worden aangepast als je anders kiest. + +Vul je keuze in na de `[Answer]:`-tag. + +## Vraag 1 +Zwangerschap en Gezin hebben nu elk maar twee portfolio-foto's, en die staan in verhaalblok 2 en 3. Een foto mag maar één keer op een pagina staan, dus er blijven geen foto's over voor de "Impressie"-mozaïek: die wordt weggelaten en blok 4 is alleen tekst. Wat wil je zolang Andrea geen extra foto's levert? + +- A) Laat de twee foto's in blok 2 en 3 staan; geen "Impressie" tot er meer foto's zijn (aanbevolen: de pagina behoudt het ritme van afwisselend foto en tekst, en dit is ook wat Andrea in haar beoordelingsdocument is voorgelegd) +- B) Zet de twee foto's in de "Impressie"-mozaïek; blok 2, 3 en 4 worden dan alleen tekst (alleen blok 1 houdt een foto). De mozaïek toont dan twee grote vierkante foto's naast elkaar. +- X) Anders (beschrijf hieronder na de [Answer]:-tag) + +[Answer]: A + +## Vraag 2 +Vanaf hoeveel foto's (die niet al elders op de pagina staan) tonen we de "Impressie"-sectie? Newborn heeft nu 3 foto's voor de mozaïek, de andere vier pagina's nu 0 of 2 (zie vraag 1). + +- A) Vanaf 2 foto's (aanbevolen: één foto alleen oogt als een verdwaalde afbeelding, maar met twee ziet het er nog als een bewuste compositie uit) +- B) Vanaf 3 foto's (Newborn houdt de mozaïek; een mozaïek van twee foto's verschijnt niet) +- C) Alleen met 4 foto's, de volledige compositie van het ontwerp (Newborn zou de mozaïek dan kwijtraken tot Andrea één extra foto levert) +- X) Anders (beschrijf hieronder na de [Answer]:-tag) + +[Answer]: A + +## Vraag 3 +Wat gebeurt er als een bezoeker op een foto in de "Impressie"-mozaïek tikt of klikt? + +- A) Niets: de mozaïek is een impressie, geen galerij; wie meer wil zien gebruikt de link "Bekijk meer …foto's" naast de titel (aanbevolen: eenvoudig en snel; die link bestaat al voor Newborn en verschijnt bij de andere shoots zodra er portfolio-foto's zijn) +- B) De foto opent vergroot in de bestaande lightbox van het portfolio (extra werk: er is dan per foto ook een grote versie nodig en de pagina laadt meer code) +- X) Anders (beschrijf hieronder na de [Answer]:-tag) + +[Answer]: A + +## Vraag 4 +Loveshoot en Portret hebben nu maar één foto in de verhaalblokken, dus blok 2, 3 en 4 zijn daar alleen tekst (drie tekstblokken onder elkaar). Hoe moeten blokken zonder foto eruitzien? + +- A) Elk blok blijft een eigen horizontale band (afwisselend papier en lichtere achtergrond) met een gecentreerde, smalle tekstkolom en zonder lege fotoplek (aanbevolen: voorspelbaar, dezelfde structuur als blokken met foto, en de pagina wordt vanzelf mooier zodra er foto's bijkomen) +- B) Opeenvolgende blokken zonder foto worden samengevoegd tot één band waarin de teksten naast elkaar in kolommen staan (kortere pagina, maar de rij blokken ziet er anders uit dan de rest en de kolommen worden smal op tablets) +- X) Anders (beschrijf hieronder na de [Answer]:-tag) + +[Answer]: A + +## Vraag 5 +Bij "Veelgestelde vragen" kan elke vraag open- en dichtklappen. Welke staan open als de pagina laadt? (De antwoorden staan altijd in de pagina, ook als ze dicht zijn; dit gaat alleen om wat je direct ziet.) + +- A) De eerste twee staan open, de rest is dicht (aanbevolen: dit is zoals in het gekozen ontwerp E; het laat zien dat je kunt uitklappen en toont meteen de belangrijkste antwoorden) +- B) Alleen de eerste staat open +- C) Alles is dicht (kortste lijst, maar bezoekers zien geen enkel antwoord zonder te klikken) +- D) Alles staat open +- X) Anders (beschrijf hieronder na de [Answer]:-tag) + +[Answer]: C + +## Vraag 6 +Op de overzichtspagina "Soorten fotoshoots" komt per shoot een link naar de nieuwe pagina, bijvoorbeeld "Lees meer over de newbornshoot". Hoe moet die eruitzien? + +- A) Een gewone onderstreepte tekstlink in dezelfde stijl als "Stuur een berichtje" en "Bekijk meer …foto's", als eerste in de rij (aanbevolen: de pagina blijft rustig en de nieuwe pagina's worden toch als eerste vervolgstap aangeboden) +- B) Een knop met rand (zoals de knoppen elders op de site) onder de tekst, met de twee bestaande tekstlinks eronder (valt meer op en levert waarschijnlijk meer bezoek aan de nieuwe pagina's, maar maakt de overzichtspagina drukker) +- X) Anders (beschrijf hieronder na de [Answer]:-tag) + +[Answer]: A + +## Vraag 7 +Elke shootpagina krijgt een eigen voorbeeldafbeelding (1200 x 630) voor als de link wordt gedeeld, bijvoorbeeld in WhatsApp of op Facebook. Hoe moet die eruitzien? Bij A laat ik je de vijf uitsneden zien voordat ze definitief worden. + +- A) Een liggende uitsnede uit een foto van de shoot, zoals de bestaande voorbeeldafbeeldingen van de andere pagina's (aanbevolen: sluit aan bij de rest van de site; bij Loveshoot en Portret is er alleen een staande foto, dus die uitsnede is iets minder scherp) +- B) Een samengestelde afbeelding: de foto links en rechts op een papierkleurig vlak de naam van de shoot (past goed bij staande foto's, maar is een nieuwe stijl die er nog niet is) +- C) Voor alle vijf de pagina's de bestaande standaardafbeelding van de site (geen extra werk, maar alle gedeelde links zien er hetzelfde uit) +- X) Anders (beschrijf hieronder na de [Answer]:-tag) + +[Answer]: A + +## Question 8 +Afwijking van de Application Design: twee gedeelde componenten krijgen een kleine, optionele uitbreiding (bestaande pagina's veranderen niet): +`MediaText` krijgt `mediaSize="medium"` (fotokolom tot 30rem, zoals in design E), en `CallToAction` een optionele `tone`, zodat de afsluitende balk op de lichte achtergrond kan staan naast het pakketblok op de donkerdere band. + +- A) Ja, beide optionele uitbreidingen toevoegen (aanbevolen) +- B) Nee, de componenten ongewijzigd laten; de shootpagina gebruikt de bestaande maten en de afsluitende balk blijft op de donkerdere achtergrond (dan wijkt de pagina iets af van design E) +- X) Anders (beschrijf hieronder na de [Answer]:-tag) + +[Answer]: A diff --git a/aidlc-docs/features/shoot-type-pages/construction/plans/shoot-page-ui-functional-design-plan.md b/aidlc-docs/features/shoot-type-pages/construction/plans/shoot-page-ui-functional-design-plan.md new file mode 100644 index 0000000..bfb1fde --- /dev/null +++ b/aidlc-docs/features/shoot-type-pages/construction/plans/shoot-page-ui-functional-design-plan.md @@ -0,0 +1,23 @@ +# Functional Design Plan - Unit 2: Shoot page UI + +Feature: shoot-type-pages. Unit: 2 "Shoot page UI" (units/files: see [application-design.md](../../inception/application-design/application-design.md) § File ownership per unit). Questions: [shoot-page-ui-fd-questions.md](shoot-page-ui-fd-questions.md). Artifacts: [functional-design/](../shoot-page-ui/functional-design/). + +Status: **final**. Answers collected 2026-10-30 (recorded in the question file); the artifacts are finalised on those answers. + +## Steps + +- [x] Step 1: Analyse unit context (unit 2 rows of the file ownership table, items handed to Functional Design, unit 1 code summary and interfaces, design E and D, photo analysis in andrea-review.md, real code of the shared components and theme) +- [x] Step 2: Create this plan +- [x] Step 3: Generate context-appropriate questions (7 questions on look and behaviour; technical details decided and documented) +- [x] Step 3b: Validate the question file against the question format guide (multiple choice A/B/..., last option X, `[Answer]:` tag per question, options as list items) +- [x] Step 4: Store plan and question file +- [x] Step 5: Notify the user (the orchestrator relays the process notification) +- [x] Step 6: Collect and analyse the answers (check for contradictions, e.g. Q1 = B together with Q2 = C; add clarification questions if needed) +- [x] Step 7a: `business-logic-model.md` (page assembly, story, timeline, mosaic, FAQ, package, link and image-loading flows; pure functions) - provisional +- [x] Step 7b: `business-rules.md` (numbered rules with decision flowcharts, testable properties, Security Baseline and PBT compliance) - provisional +- [x] Step 7c: `domain-entities.md` (entity relationships, UI-level entities, constants, registry and OG data) - provisional +- [x] Step 7d: `frontend-components.md` (component hierarchy, props and state, interaction flows, responsive behaviour, a11y, Lighthouse, LAYOUT.md diagram and letter colours) - provisional +- [x] Step 7e: Revise the four artifacts for the answers and remove the "provisional" marking +- [x] Step 8: Present the completion message (in Dutch, the conversation language) +- [x] Step 9: Wait for explicit approval of the functional design +- [x] Step 10: Record the approval in audit.md and mark Functional Design (unit 2) complete in aidlc-state.md diff --git a/aidlc-docs/features/shoot-type-pages/construction/shoot-page-ui/functional-design/business-logic-model.md b/aidlc-docs/features/shoot-type-pages/construction/shoot-page-ui/functional-design/business-logic-model.md new file mode 100644 index 0000000..651ec1d --- /dev/null +++ b/aidlc-docs/features/shoot-type-pages/construction/shoot-page-ui/functional-design/business-logic-model.md @@ -0,0 +1,244 @@ +# Business Logic Model - Unit 2: Shoot page UI + +> Final — answers recorded in ../../plans/shoot-page-ui-fd-questions.md (2026-10-30). Each decision that depends on an answer carries its question number, e.g. **[Q2]**. + +Inputs: [requirements.md](../../../inception/requirements/requirements.md) (FR-ST-02..09, FR-ST-13, SEO-ST-04/05, NFR-ST-01..03), [application-design.md](../../../inception/application-design/application-design.md), [component-methods.md](../../../inception/application-design/component-methods.md), the unit 1 [code summary](../../content-and-seo-foundation/code/code-summary.md), design E (`E-Definitief.dc.html`) and D (`D-Tijdlijn-Mobiel.dc.html`), [andrea-review.md § Foto's](../../content-review/andrea-review.md), and the real code (`shootPageView.ts`, `MediaText`, `FramedImage`, `PageSection`, `PageIntro`, `CallToAction`, `LinkButton`, `theme.ts`, recipes). + +Scope: unit 2 only. The navigation submenu is unit 3. The page is technology-agnostic here: rules are stated per visitor-visible behaviour and per pure function; the markup is in [frontend-components.md](frontend-components.md). + +## 1. Page assembly + +A shoot page is a function of one `ShootPageView` (unit 1). Unit 2 adds one more pure step, `shootPageBands`, that fixes the order of the sections that exist for this view and the background tone of each, so that adjacent bands always differ whichever optional sections (photos, FAQ) are present. + +```mermaid +graph TD + view["ShootPageView from shootPageView"] --> bands["shootPageBands: ordered sections with tones"] + bands --> intro["Intro: PageIntro with Breadcrumb"] + bands --> stories["Four story blocks via storyLayout"] + bands --> tl["Process timeline: six steps"] + bands --> hasPhotos{"view.photos present?"} + hasPhotos -->|"yes"| mosaic["Photo mosaic via mosaicLayout"] + hasPhotos -->|"no"| skipPhotos["No Impressie section"] + bands --> hasFaq{"view.faq present?"} + hasFaq -->|"yes"| faq["FAQ with details and summary"] + hasFaq -->|"no"| skipFaq["No FAQ section"] + bands --> offer["Package block or Prijs op aanvraag"] + bands --> cta["Closing call to action"] + classDef pure fill:#9C27B0,stroke:#4a148c,stroke-width:1px,color:#000; + classDef ui fill:#2196F3,stroke:#0d47a1,stroke-width:1px,color:#000; + classDef decision fill:#FF9800,stroke:#e65100,stroke-width:1px,color:#000; + classDef omitted fill:#e9d5ff,stroke:#6b21a8,stroke-width:1px,color:#000; + class view,bands pure; + class intro,stories,tl,mosaic,faq,offer,cta ui; + class hasPhotos,hasFaq decision; + class skipPhotos,skipFaq omitted; +``` + +Text alternative: the view feeds shootPageBands, which orders intro, four stories, timeline, then the photo mosaic and the FAQ only when the view has them, then the package block and the closing call to action (purple = pure logic, blue = UI, orange = decision, lilac = omitted section). + +**Band rule.** The rendered sections after the intro are numbered 0, 1, 2, ... in page order; position `p` has tone `paper` when `p` is even and `alt` when odd. The first story block is position 0 (`paper`), directly below the `paper` intro, so it uses `spacing="flushTop"` as the first band of the overview page does. Because positions are consecutive over what is actually rendered, an omitted mosaic or FAQ never produces two equal neighbours. The closing call to action takes the next position like every other section (`CallToAction` gets an optional `tone`, see frontend-components.md). + +| View | Sections after the intro (position: tone) | +|---|---| +| Newborn today (3 mosaic photos, FAQ) | 0 story paper, 1 story alt, 2 story paper, 3 story alt, 4 timeline paper, 5 mosaic alt, 6 FAQ paper, 7 package alt, 8 closing paper | +| Zwangerschap/Gezin today, Loveshoot, Portret (no mosaic) | 0-3 stories paper/alt/paper/alt, 4 timeline paper, 5 FAQ alt, 6 package paper, 7 closing alt | + +## 2. Story block + +```mermaid +graph TD + s["Story block at index i"] --> img{"Has an image?"} + img -->|"no"| textOnly["Text-only band: narrow centred column, no frame"] + img -->|"yes"| orient{"Landscape: width at least 1.2 times height?"} + orient -->|"yes"| land["Aspect 3 / 2, half-width photo column"] + orient -->|"no"| port["Aspect 4 / 5, medium photo column up to 30rem"] + land --> media["MediaText with FramedImage in the shoot frame colour"] + port --> media + media --> side{"i is odd?"} + side -->|"yes"| rev["Photo right from lg"] + side -->|"no"| left["Photo left from lg"] + media --> prio{"i is 0?"} + prio -->|"yes"| hi["Photo loads at once, high priority"] + prio -->|"no"| lazy["Photo deferred until near the viewport"] + classDef decision fill:#FF9800,stroke:#e65100,stroke-width:1px,color:#000; + classDef ui fill:#2196F3,stroke:#0d47a1,stroke-width:1px,color:#000; + classDef pure fill:#9C27B0,stroke:#4a148c,stroke-width:1px,color:#000; + class img,orient,side,prio decision; + class textOnly,land,port,media,rev,left,hi,lazy ui; + class s pure; +``` + +Text alternative: a story block without an image becomes a text-only band; with an image its orientation chooses the aspect ratio and column width, its index chooses the photo side, and only index 0 loads its photo with high priority. + +- The orientation rule is by the photo itself (not by slot), so a photo delivered later in another orientation (Andrea's review document names 3:2 for block 2 and 4:5 for the others, which the current data matches) is still cropped sensibly. +- Text-only variant **[Q4 = A]**: same `PageSection` band and alternation as a block with a photo (the index still decides the tone), eyebrow, h2 and paragraphs in one column of at most 36rem (the line length used next to a photo), centred in the narrow content width. No frame, no empty grid column, no reserved space. Under Q4 = B consecutive text-only blocks would be grouped in one band with columns (see business-rules.md BR-SP-13). +- The photo side and the band tone follow the block index, not "blocks that have a photo", so rhythm is stable when photos are added later (a data-only change). +- Heading ids: `story-<story.id>-title` through `headingId` (BR-SP-72). + +## 3. Process timeline + +```mermaid +graph TD + steps["Six steps from the view, fixed order"] --> wide{"Viewport at least lg, 1024px?"} + wide -->|"yes"| hor["Horizontal: six columns, line through the icons"] + wide -->|"no"| ver["Vertical: icon column and text column, line between icons"] + hor --> parity{"Step index even?"} + parity -->|"yes, steps 1 3 5"| above["Text above the line"] + parity -->|"no, steps 2 4 6"| below["Text below the line"] + steps --> last["Last marker is filled to mark the delivery"] + steps --> dom["DOM: ordered list, the h3 and text of each step in reading order"] + classDef decision fill:#FF9800,stroke:#e65100,stroke-width:1px,color:#000; + classDef ui fill:#2196F3,stroke:#0d47a1,stroke-width:1px,color:#000; + classDef pure fill:#9C27B0,stroke:#4a148c,stroke-width:1px,color:#000; + class wide,parity decision; + class hor,ver,above,below,last,dom ui; + class steps pure; +``` + +Text alternative: from the lg breakpoint the six steps run horizontally with the odd steps' texts above the line and the even steps' texts below it; below lg they run vertically; in both layouts the DOM is one ordered list in step order and the last marker is filled. + +- **Breakpoint: the theme's `lg` (1024 px)**, not design E's 900 px. At `lg` content width (about 940 px after the page gutter) each of six columns is about 155 px, text about 130 px: the longest step titles ("Datum & locatie kiezen") wrap to two lines and the longest drafted step text stays under about 8 lines. At `md` (768 px) a column would be about 110 px, which design E avoided with its 900 px break; using a theme token (not a literal pixel value) is required by FR-ST-04. The cost is that tablets in portrait (768-1023 px) get the vertical layout, which is the one design D drew for mobile and reads well at that width (capped at 34rem, centred). +- **Alternation by index parity** (design E): steps 1, 3, 5 (index 0, 2, 4) above, steps 2, 4, 6 below. The icon row is shared, so the line runs straight through all six markers. +- **Line**: runs from the centre of the first marker to the centre of the last (design E let it overshoot half a cell on both ends). Decorative, `aria-hidden`. +- **Markers**: 56 px squares with a 1 px `accent.deep` border, band-coloured fill, `accent.deep` icon. Square, like the rest of the site (angular shapes). The last marker is filled `accent.deep` with a white icon (design E): "arrived". +- **No numbers** (Q7 of the requirements): order is carried by position and by the ordered list semantics. +- **Per-shoot text** (location, duration, opleverduur) arrives already filled in by `shootPageView`; the component never composes text. +- **Motion**: the list appears with the section's `Reveal` (one fade-up for the whole list, not per step: a `Reveal` wrapper per step would sit between the grid and the subgrid rows). `useReveal` shows it immediately under `prefers-reduced-motion`. No other animation exists, so there is nothing else to switch off. +- **Icons** (inline SVG, `aria-hidden`, 24x24, 1.5 stroke, `currentColor`, from design E): envelope (aanvragen), calendar with heart (datum), coin (aanbetaling), camera (shoot), sliders (bewerking), picture (oplevering). Paths in domain-entities.md. + +## 4. Photo mosaic + +```mermaid +graph TD + imgs["view.photos.images, already without photos used elsewhere"] --> cap["Take the first four"] + cap --> n{"How many?"} + n -->|"2"| two["Two equal tiles, each two columns by two rows"] + n -->|"3"| three["One large tile left, two wide tiles stacked right"] + n -->|"4"| four["One large left, one wide top right, two small bottom right"] + two --> phone + three --> phone + four --> phone + phone["Below md: two columns, wide tiles span both, small tiles side by side"] + classDef decision fill:#FF9800,stroke:#e65100,stroke-width:1px,color:#000; + classDef ui fill:#2196F3,stroke:#0d47a1,stroke-width:1px,color:#000; + classDef pure fill:#9C27B0,stroke:#4a148c,stroke-width:1px,color:#000; + class n decision; + class two,three,four,phone ui; + class imgs,cap pure; +``` + +Text alternative: the first four photos are laid out as two equal tiles, one large plus two stacked wide tiles, or one large plus one wide plus two small tiles depending on the count, and below md every layout becomes a two-column grid. + +Desktop grid (from `md`): **4 columns by 2 rows**, row height `clamp(12rem, 22vw, 18.75rem)` (300 px on wide screens as in design E), gap the theme's `gridGap`. Every layout fills all eight cells, so the mosaic is the same height for 2, 3 and 4 photos and the page does not jump when photos are added. + +| Count | Tile 1 | Tile 2 | Tile 3 | Tile 4 | +|---|---|---|---|---| +| 2 | columns 1-2, rows 1-2 | columns 3-4, rows 1-2 | | | +| 3 | columns 1-2, rows 1-2 (large) | columns 3-4, row 1 (wide) | columns 3-4, row 2 (wide) | | +| 4 (design E) | columns 1-2, rows 1-2 (large) | columns 3-4, row 1 (wide) | column 3, row 2 (small) | column 4, row 2 (small) | + +Phone grid (below `md`, two columns, gap `gridGap`): tiles that are `wide` span both columns. + +| Count | Tile 1 | Tile 2 | Tile 3 | Tile 4 | +|---|---|---|---|---| +| 2 | wide, 4 / 3 | wide, 4 / 3 | | | +| 3 | wide, 4 / 3 | wide, 3 / 2 | wide, 3 / 2 | | +| 4 | wide, 4 / 3 | wide, 3 / 2 | half, 1 / 1 | half, 1 / 1 | + +- Two photos on a phone are stacked, not side by side: at 320 px two side-by-side tiles would be about 145 px wide. +- **Order is content order**: tile 1 is the large slot (a portrait photo suits it), tile 2 the wide slot (a landscape photo suits it). Photos are cropped to their cell (`object-fit: cover`); the image's own ratio never decides a row height. There is no focal-point field in `ContentImage`, so crops are centred. With 3 photos, tile 3 is a wide cell: a portrait photo there shows its middle band (noted as a content tip for Andrea, not a rule). +- **Fewer than the minimum** ([Q2]: 2): the section is not rendered at all (the view already omits it). **More than four**: the first four are shown; the rest stay in the data. The "Bekijk meer ...foto's" link (shown only when the view has `portfolioLink`) is where more photos live. +- **Behaviour** [Q3 = A]: tiles are not interactive: no hover effect, not focusable, not links. They are a list of images (`ul`/`li`), each with its alt text. +- Reveal: each tile fades in with a small stagger (`delay = index * 0.08` s); reduced motion shows them immediately. +- Section head: eyebrow + h2 on the left, "Bekijk meer {photosLabel}" on the right (design E), wrapping under the heading on narrow screens; the link has a 44 px touch target. + +## 5. FAQ + +```mermaid +graph TD + items["view.faq.items, three to five"] --> render["One details and summary per item, in order, all closed"] + render --> dom["Answer is in the DOM also when closed"] + render --> toggle["Visitor toggles with click, tap, Enter or Space: the browser does it"] + classDef ui fill:#2196F3,stroke:#0d47a1,stroke-width:1px,color:#000; + classDef pure fill:#9C27B0,stroke:#4a148c,stroke-width:1px,color:#000; + class render,dom,toggle ui; + class items pure; +``` + +Text alternative: every FAQ item becomes a native details element with its answer always in the DOM; all items start closed and the visitor toggles them with the browser's own behaviour. + +- **Closed by default [Q5 = C]: all items.** No `details` carries the `open` attribute at load (design E's two open items are not used). There is no `FAQ_OPEN_COUNT` constant and no `openCount` prop; after load the browser owns the state (uncontrolled, no React state, no re-render side effects). +- Native `details` also means: find-in-page opens a closed item that contains the match, no JavaScript is needed, and there is nothing to animate, so `prefers-reduced-motion` is respected by construction. The plus/minus icon is switched by CSS on `details[open]`. +- The FAQPage structured data always lists every question, regardless of what is open (unit 1). +- Layout: from `lg` two columns (heading, lead and contact link left, list right, one third / two thirds as in design E); below `lg` stacked, heading first. + +## 6. Package block and "Prijs op aanvraag" + +```mermaid +graph TD + off["view.offer"] --> pkg{"view.offer.pkg present?"} + pkg -->|"yes"| price["Price via formatPrice, features list, button Boek dit pakket, link Eerst een vraag stellen"] + pkg -->|"no"| onreq["Prijs op aanvraag, short text, one button with the on-request label"] + price --> note["Deposit note below the actions"] + onreq --> note + classDef decision fill:#FF9800,stroke:#e65100,stroke-width:1px,color:#000; + classDef ui fill:#2196F3,stroke:#0d47a1,stroke-width:1px,color:#000; + classDef pure fill:#9C27B0,stroke:#4a148c,stroke-width:1px,color:#000; + class pkg decision; + class price,onreq,note ui; + class off pure; +``` + +Text alternative: the offer block shows the price, features and two actions when the view carries a package, otherwise "Prijs op aanvraag" with one action, and the deposit note appears in both variants. + +- The variant is decided only by `view.offer.pkg` (never by a shoot id); an invalid or removed package therefore falls back to "Prijs op aanvraag" without extra code (unit 1). +- Package variant actions: primary `LinkButton variant="accent"` "Boek dit pakket" to `view.offer.bookLink` (`/contact?pakket=<id>`), secondary underlined text link "Eerst een vraag stellen" to `/contact`. +- On-request variant: the price slot shows `onRequest.price` in the same type as a price, then `onRequest.text`; **one** primary button with `onRequest.linkLabel` ("Vraag naar de mogelijkheden") to `bookLink` (which resolves to plain `/contact` when there is no visible package). The secondary link is dropped, since it would lead to the same place. +- The photo is the shoot's detail photo (else its main photo), square, in the shoot's frame colour, in the narrow media column (20rem) so the 480 px source stays sharp. +- The deposit note ("Aanbetaling € 50, restbedrag na de shoot.") appears in both variants (A-ST-03). Whether it should appear for Loveshoot and Portret depends on Andrea's answer to open fact 4 (OPEN(CON-ST-04)); the `note` prop is optional, so removing it for the on-request variant is a one-line change in `ShootPage`. + +## 7. Closing call to action and "Lees meer" link + +- Closing band: `CallToAction` with `view.closing.title`, `view.closing.lead` (rich text through `RichParagraph`) and one `LinkButton variant="accent"` with `closing.buttonLabel` to `closing.link` (same destination as the package button when a package exists; different names, so no accessible-name clash). +- Overview "Lees meer" link **[Q6 = A]**: `ShootBlock` gains a link with the visible text "Lees meer over de {shootLabel lowercased}" (newbornshoot, zwangerschapsshoot, gezinsshoot, loveshoot, portretshoot) to `shootPagePath(shoot.id)`, as the first link of the row, same underline style as the others, same 44 px touch target. The text is unique per shoot, so it needs no `aria-label`. Anchors (`#newborn` ...) and the other links are untouched. Under Q6 = B it becomes an outline `LinkButton` below the text, with the two text links below it. + +## 8. Image loading and Largest Contentful Paint + +```mermaid +sequenceDiagram + box rgba(33,150,243,0.15) Browser + participant V as Visitor + participant B as Browser + end + box rgba(156,39,176,0.15) Page + participant R as RouteChunk + participant P as Story1Photo + participant D as DeferredPhotos + end + V->>B: Open a shoot page + B->>R: Load main bundle and the page chunk + R->>B: Render intro and story blocks + B->>P: Request photo at once with high priority + P->>B: Photo painted, likely the largest paint + B->>D: Wait for the load event + D->>B: Request each photo when it nears the viewport +``` + +Text alternative: after the page chunk renders, only the first story photo is requested immediately with high priority; every other photo waits for the page load event and for the viewport to come near it. + +- Only the photo of story block index 0 is the priority image (BR-SP-40). It is the likely largest paint on both desktop and phones: on a 412x823 phone the intro (breadcrumb, h1, intro text) ends around 550-600 px, so the photo's visible part is larger than any text block. +- If the first story has no photo (a data change), no image is priority: nothing else is likely to be the largest paint. +- All other photos (stories 2-4, mosaic tiles, package photo) use `DeferredImage` with intrinsic `width`/`height` plus a CSS aspect ratio or a fixed grid cell, so there is no layout shift. The mosaic tiles fill their cell by absolute positioning, so image size never changes the row height. +- Known limit: the shoot pages are in the `photoPagePaths` bucket (mobile performance budget 0.85, goal 0.9). The unit 1 shell measured 0.90 without any photo, so scores must be re-measured after the sections exist; any shortfall is reported with numbers, not worked around. A first mitigation to try if the largest paint regresses: render the first story without the `Reveal` fade, since the image is invisible until the fade starts. + +## 9. Pure functions added by this unit + +| Function | Module | Input to output | Notes | +|---|---|---|---| +| `mosaicLayout(count)` | `lib/mosaicLayout.ts` | number to tiles (`column`, `row`, `wide`, `phoneRatio`) | Total for any integer; at most `MOSAIC_MAX_PHOTOS` (4) tiles; `[]` for count 0 or below | +| `storyLayout(stories)` | `lib/storyLayout.ts` | stories to per-block layout (`tone`, `reverse`, `media?`, `priority`, `spacing`) | `media` is `{ aspectRatio, mediaSize }` and absent for text-only blocks | +| `shootPageBands(view)` | `lib/shootPageBands.ts` | view to ordered `{ id, tone }` list | Single source of the band rhythm | +| `readMoreLabel(shoot)` | `lib/readMoreLabel.ts` | shoot type to `Lees meer over de <shootLabel lowercased>` | Unique per shoot | +| `headingId(prefix, id)` | `lib/headingId.ts` | strings to a safe id | Only `a-z 0-9 - _`; used for `aria-labelledby` targets | + +Constants: `MOSAIC_MIN_PHOTOS = 2` **[Q2]** (already in `shootPageView.ts`, unit 2 may change the value only), `MOSAIC_MAX_PHOTOS = 4`, timeline breakpoint `lg`, mosaic breakpoint `md`. diff --git a/aidlc-docs/features/shoot-type-pages/construction/shoot-page-ui/functional-design/business-rules.md b/aidlc-docs/features/shoot-type-pages/construction/shoot-page-ui/functional-design/business-rules.md new file mode 100644 index 0000000..ba8154c --- /dev/null +++ b/aidlc-docs/features/shoot-type-pages/construction/shoot-page-ui/functional-design/business-rules.md @@ -0,0 +1,234 @@ +# Business Rules - Unit 2: Shoot page UI + +> Final — answers recorded in ../../plans/shoot-page-ui-fd-questions.md (2026-10-30). Rules that depend on an answer are tagged **[Q#]** and listed in the decision register at the end. + +Rule ids are `BR-SP-nn` (shoot page). "Source" points at the requirement or design decision the rule makes concrete. Flows: [business-logic-model.md](business-logic-model.md). + +## 1. Decision flowcharts + +### 1.1 Does a section appear, and what is the mosaic made of + +```mermaid +graph TD + start["Build the page from ShootPageView"] --> photoCount{"Photos left after removing the ones used in stories and the package block: at least MOSAIC_MIN_PHOTOS?"} + photoCount -->|"no"| noMosaic["No Impressie section, outline stays valid"] + photoCount -->|"yes"| cap{"More than MOSAIC_MAX_PHOTOS?"} + cap -->|"yes"| first4["Show the first four"] + cap -->|"no"| all["Show all"] + start --> faqCount{"At least one FAQ item?"} + faqCount -->|"no"| noFaq["No FAQ section, no FAQPage"] + faqCount -->|"yes"| faq["FAQ section"] + start --> pkgCheck{"Visible package?"} + pkgCheck -->|"yes"| pkgBlock["Price, features, Boek dit pakket"] + pkgCheck -->|"no"| reqBlock["Prijs op aanvraag"] + classDef decision fill:#FF9800,stroke:#e65100,stroke-width:1px,color:#000; + classDef ui fill:#2196F3,stroke:#0d47a1,stroke-width:1px,color:#000; + classDef pure fill:#9C27B0,stroke:#4a148c,stroke-width:1px,color:#000; + classDef omitted fill:#e9d5ff,stroke:#6b21a8,stroke-width:1px,color:#000; + class photoCount,cap,faqCount,pkgCheck decision; + class first4,all,faq,pkgBlock,reqBlock ui; + class noMosaic,noFaq omitted; + class start pure; +``` + +Text alternative: the mosaic needs at least MOSAIC_MIN_PHOTOS unused photos and shows at most four, the FAQ needs at least one item, and the offer block shows a price only when the view has a visible package. + +### 1.2 Story block media and loading priority + +```mermaid +graph TD + block["Story block at index i"] --> hasImg{"image defined?"} + hasImg -->|"no"| textOnly["Text-only band, no frame, no priority"] + hasImg -->|"yes"| isFirst{"i equals 0?"} + isFirst -->|"yes"| priority["Priority image: no lazy loading, fetchPriority high"] + isFirst -->|"no"| deferred["DeferredImage: loads near the viewport after page load"] + priority --> ratio + deferred --> ratio + ratio{"width at least 1.2 times height?"} -->|"yes"| land["3 / 2 and half-width column"] + ratio -->|"no"| port["4 / 5 and medium column"] + classDef decision fill:#FF9800,stroke:#e65100,stroke-width:1px,color:#000; + classDef ui fill:#2196F3,stroke:#0d47a1,stroke-width:1px,color:#000; + classDef pure fill:#9C27B0,stroke:#4a148c,stroke-width:1px,color:#000; + class hasImg,isFirst,ratio decision; + class textOnly,priority,deferred,land,port ui; + class block pure; +``` + +Text alternative: a story without an image is text only; with an image only index 0 is a priority image, and the photo's orientation picks 3:2 with a half-width column or 4:5 with a medium column. + +### 1.3 Timeline layout + +```mermaid +graph TD + vp{"Viewport at least lg?"} -->|"yes"| h["Horizontal: line through the markers, text alternates above and below by index parity"] + vp -->|"no"| v["Vertical: markers in a column, line between them, text beside"] + h --> same["Same ordered list and reading order"] + v --> same + classDef decision fill:#FF9800,stroke:#e65100,stroke-width:1px,color:#000; + classDef ui fill:#2196F3,stroke:#0d47a1,stroke-width:1px,color:#000; + class vp decision; + class h,v,same ui; +``` + +Text alternative: at lg and above the timeline is horizontal with alternating texts, below lg it is vertical, and the markup and reading order are the same in both. + +## 2. Rules + +### Intro and breadcrumb +| Id | Rule | Source | +|---|---|---| +| BR-SP-01 | The breadcrumb shows `view.breadcrumb.items` in order: every item except the last is a link, the last is plain text with `aria-current="page"`. It is a `nav` named by `view.breadcrumb.label` ("Kruimelpad") containing an `ol`. | FR-ST-02 | +| BR-SP-02 | Separators are a decorative `li` with `aria-hidden="true"` and the text "/" (as in design E), between items only; never after the last item. | FR-ST-02, design E | +| BR-SP-03 | Breadcrumb links use exact active matching, so only the page itself can ever carry `aria-current`. The links are at least 44 px high (touch target) and show an underline at rest (not colour alone). | application-design D4, NFR-ST-01 | +| BR-SP-04 | With no items the breadcrumb renders nothing (fail safe); with one item it shows only the current page. | SECURITY-15 | +| BR-SP-05 | `PageIntro` gets two optional props, `breadcrumb` (above the eyebrow) and `titleId` (h1 id; the section is named by it). Callers that pass neither render byte-identically to today. | application-design D10 | + +### Story blocks +| Id | Rule | Source | +|---|---|---| +| BR-SP-10 | Every story is a `section` named by its h2 (`aria-labelledby`), with eyebrow (decorative `p`), h2 (`sectionTitle`), and its paragraphs through `RichParagraph`, in a stack with the overview page's spacing. | FR-ST-03, SEO-ST-04 | +| BR-SP-11 | Band tone and photo side come from the block index: tone by `shootPageBands`, photo on the right from `lg` when the index is odd. Not from "has a photo". | FR-ST-03 | +| BR-SP-12 | Aspect ratio and column width come from the photo's orientation: width at least 1.2 x height gives `3 / 2` and `mediaSize="half"`, otherwise `4 / 5` and `mediaSize="medium"` (new, photo column up to 30rem, as design E's 480/440 px). The shoot's `frameColor` applies to every story photo. | design E | +| BR-SP-13 | A story without a photo is a text-only band **[Q4 = A]**: same `PageSection`, tone and h2 level, text in a column of at most 36rem centred in the narrow content width, no frame and no empty grid column. **[Q4 = B]** would instead place consecutive text-only stories in one band as columns (each still its own `section` with its own h2). | FR-ST-03 | +| BR-SP-14 | Only the story at index 0 may be a priority image, and only when it has a photo (see BR-SP-40). | NFR-ST-03 | + +### Process timeline +| Id | Rule | Source | +|---|---|---| +| BR-SP-20 | The timeline is an ordered list (`ol` with `role="list"` so that Safari keeps the list semantics when the bullets are removed) with one `li` per step, in the order given. Each `li` holds the decorative marker, an h3 with the title and a paragraph with the text. | FR-ST-04, NFR-ST-01 | +| BR-SP-21 | From `lg` the list is a grid with one column per step and three rows (text above, 56 px marker row, text below); the step at index `i` puts its text above when `i` is even and below when `i` is odd. Below `lg` it is one column: marker (56 px) beside the text, text top-aligned with the marker. | FR-ST-04, design E, D | +| BR-SP-22 | The line is decorative (`aria-hidden`): horizontal from the first to the last marker centre, vertical from each marker down to the next (none after the last). Markers hide the line behind them with the band's own background colour (the `tone` prop). | design E, D | +| BR-SP-23 | The last marker is filled (`accent.deep`, white icon); the others are outlined. Icons and the line carry no information beyond the order and are `aria-hidden`; there are no step numbers. | design E, Q7 requirements | +| BR-SP-24 | The vertical layout is capped at 34rem and centred, so line length stays readable on tablets. | design D | +| BR-SP-25 | The list fades in once, as a whole, via `Reveal`; no per-step or looping motion exists. Under `prefers-reduced-motion` it is visible at once (existing `useReveal` behaviour). | NFR-ST-01 | +| BR-SP-26 | The component is generic: any number of steps (1 or more) lays out correctly; zero steps render nothing. It never builds text or looks up a step by id except through its `icon` prop. | NFR-ST-02 | + +### Photo mosaic +| Id | Rule | Source | +|---|---|---| +| BR-SP-30a | `MOSAIC_MIN_PHOTOS = 2` **[Q2]**. Below it the view carries no `photos` and no section, heading or link is rendered. | FR-ST-05, D15 | +| BR-SP-30b | `MOSAIC_MAX_PHOTOS = 4`: the first four photos are shown; photos beyond four are ignored by the component (they stay in the content). | design E | +| BR-SP-31 | Layouts follow `mosaicLayout(count)`: 2 = two equal 2x2 tiles; 3 = large 2x2 plus two wide 2x1 tiles; 4 = design E (large 2x2, wide 2x1, two small 1x1). Always the full 4x2 grid, so the height is the same for all counts. Phones: two columns, wide tiles span both (BR-SP-35 for ratios). | FR-ST-05 | +| BR-SP-32 | The tiles are an unordered list of images in content order, each with its own alt text; tile 1 is the large slot, tile 2 the wide slot. The image fills its cell (`object-fit: cover`, absolutely positioned inside a relative cell), so its intrinsic size never sets a row height. | NFR-ST-03 | +| BR-SP-33 | Tiles are not interactive **[Q3 = A]**: no link, no focus stop, no hover effect, no lightbox. **[Q3 = B]** would make each tile a button that opens the shared `Lightbox` and needs a large version per photo (a content-model addition). | FR-ST-05 | +| BR-SP-34 | The section head shows the eyebrow and the h2 (`view.photos.title`) and, when `view.photos.portfolioLink` exists, "Bekijk meer {photosLabel}" on the right, wrapping below the heading on narrow screens, at least 44 px high. | FR-ST-05 | +| BR-SP-35 | Phone ratios: first tile 4 / 3 (wide); the second tile 3 / 2 (wide) when there are 3 or 4 photos, 4 / 3 when there are 2; the third tile 3 / 2 (wide) when there are 3 photos; with 4 photos tiles 3 and 4 are 1 / 1 and side by side. | design E | + +### Image loading (Lighthouse) +| Id | Rule | Source | +|---|---|---| +| BR-SP-40 | Exactly one image can be priority: the photo of the story at index 0 (`fetchPriority="high"`, not lazy). | NFR-ST-03 | +| BR-SP-41 | Every other photo is a `DeferredImage` with intrinsic width and height; no photo has `loading="eager"` without being the priority image. | NFR-ST-03 | +| BR-SP-42 | Photos come only from bundled assets (content imports); no remote image, no CDN. | SECURITY-13 | + +### FAQ +| Id | Rule | Source | +|---|---|---| +| BR-SP-50 | One native `details` per item with a `summary` holding the question (the question text is the disclosure label, not a heading), and the answer through `RichParagraph` below it. The answer is in the DOM when closed. | FR-ST-06 | +| BR-SP-51 | No FAQ item has the `open` attribute at load: all items start closed **[Q5 = C]** (the answers are in the DOM). After load the browser owns the state; there is no React state and no `FAQ_OPEN_COUNT` constant. | FR-ST-06, Q5 answer (design E had two open) | +| BR-SP-52 | The `summary` is at least 44 px high, has a visible focus ring (the theme's `focusRing` colour), keeps the plus/minus icon decorative (`aria-hidden`; the vertical stroke is hidden by CSS when `details[open]`), and hides the browser's own marker. | NFR-ST-01 | +| BR-SP-53 | The section is named by its h2; the contact lead ("Staat je vraag er niet tussen? ...") and its link sit under the h2. The list has hairline separators (the `sand` token). | design E | + +### Package block, closing, overview link +| Id | Rule | Source | +|---|---|---| +| BR-SP-60 | The package variant is chosen only by `view.offer.pkg`. With it: price via `formatPrice(pkg.price)`, `pkg.features` as a list, primary "Boek dit pakket" (`bookLink`), secondary "Eerst een vraag stellen" (`askLink`). Without it: `onRequest.price` in the price slot, `onRequest.text`, one primary button `onRequest.linkLabel` to `bookLink`; no features, no secondary link. | FR-ST-07 | +| BR-SP-61 | The deposit note is passed as `note` and shown below the actions in both variants (A-ST-03). Not shown when the view has no note text. | FR-ST-07, CON-ST-04 | +| BR-SP-62 | The package photo is `view.offer.image` (square, shoot frame colour, narrow `small` media column, deferred); the block's h2 id is `offer-title`. | FR-ST-07 | +| BR-SP-63 | The closing band is `CallToAction` (`title`, rich-text `lead`, one accent `LinkButton` to `closing.link`) and gets the next band tone; the component's default (`alt`) is unchanged for existing callers. | FR-ST-08 | +| BR-SP-64 | The overview `ShootBlock` shows `readMoreLabel(shoot)` ("Lees meer over de newbornshoot") as a link to `shootPagePath(shoot.id)`, first in the row **[Q6 = A]**, with a 44 px target; the visible text differs per shoot so no `aria-label` is used. The other links, the `article` id and the anchors do not change. | FR-ST-09 | + +### Structure, ids and fail-safe +| Id | Rule | Source | +|---|---|---| +| BR-SP-70 | Page order and bands are exactly `shootPageBands(view)`: intro, stories (index order), timeline, mosaic if present, FAQ if present, offer, closing. Positions are consecutive and tones alternate starting with `paper`, so two adjacent bands never share a tone. The first story is `flushTop`. | design E, NFR-ST-02 | +| BR-SP-71 | Heading outline: one h1 (intro), one h2 per section, one h3 per timeline step; FAQ questions are `summary` labels, so no level is skipped. Every section has `aria-labelledby` pointing at its h2 id; ids come from `headingId` (BR-SP-72). | SEO-ST-04, NFR-ST-01 | +| BR-SP-72 | `headingId(prefix, id)` maps any string to an id containing only `a-z`, `0-9`, `-` and `_` (everything else becomes `-`, letters lower-cased), so `aria-labelledby` can never break on spaces in content. | SECURITY-15 | +| BR-SP-73 | Section anchors: `zo-werkt-het`, `impressie`, `vragen`, `pakket` (design E has `#vragen`); a link to one lands below the sticky header (`PageSection` `id`). | design E | +| BR-SP-74 | Components receive everything as props and import no content module (existing rule). Fail-safe: no stories, no steps, no photos, no FAQ, an unknown step id for an icon, or an empty alt (content tests forbid it) never throws; the affected part is omitted or shown without its icon. | SECURITY-15 | + +### Preview images and registry +| Id | Rule | Source | +|---|---|---| +| BR-SP-80 | Each of the five `sitePages` entries gets `ogImage { path: '/og-<id>.jpg', width: 1200, height: 630, alt }` and the file exists in `web/public/`, 1200 x 630, JPEG, at most about 100 KB, in the style chosen in **[Q7]** (A: landscape crop of a shoot photo, proposed sources in domain-entities.md § OG images; B: composed card; C: no `ogImage`, the site default applies). | SEO-ST-05, A-ST-04 | +| BR-SP-81 | The `alt` of an OG image describes the photo, like the existing pages. | existing pages | + +### LAYOUT.md +| Id | Rule | Source | +|---|---|---| +| BR-SP-90 | New "Shoot page" section after "Types of shoots": blocks A Intro, B-E Story 1-4, F Process timeline, G Photos, H FAQ, I Package, J Book (diagram in frontend-components.md § 9). H, I, J get new template colours (stroke = fill x 0.75) added to `.ai/layout-conventions.md` too. | FR-ST-13 | + +## 3. Testable properties (PBT-01, unit 2) + +| Function or component | Property | Kind | +|---|---|---| +| `mosaicLayout(count)` | For every integer count (negative to 12): `[]` for count 0 or below; otherwise exactly `min(count, 4)` tiles; the desktop cells of the tiles are pairwise disjoint and, for 2 to 4, cover all eight cells of the 4x2 grid; the first tile is always columns 1-2, rows 1-2; the phone layout never leaves a half-empty row (the number of non-wide tiles is even); pure (same output twice) | Invariant | +| `storyLayout(stories)` | Tone and `reverse` alternate with the index; `priority` is true only at index 0 and only when that story has an image; a story without an image has no `media`; the aspect ratio is `3 / 2` exactly when width >= 1.2 x height, otherwise `4 / 5`, and the column width matches the ratio | Invariant | +| `shootPageBands(view)` | For any view built from generated content (stories 0-6, photos present or not, FAQ present or not): tones alternate strictly starting with `paper`; the section ids are in canonical order; the length equals `stories + timeline + [photos] + [faq] + offer + closing`; no section appears twice | Invariant | +| `readMoreLabel(shoot)` | Starts with "Lees meer over de "; for any set of shoot types with unique `shootLabel` the labels are unique; the five real labels are unique | Invariant / example | +| `headingId` | The output only contains `a-z 0-9 - _`; the same input gives the same output; never throws for any string (hostile strings included) | Invariant | +| `ProcessTimeline` | For any 1 to 8 generated steps: one `li` per step in input order, one h3 per `li`, every icon `aria-hidden`, no digit-only text added by the component | Component property (few runs) | +| `Breadcrumb` | For any 1 to 5 items: exactly the last is a non-link with `aria-current="page"`, the others are links in order, separators number items - 1 and are `aria-hidden` | Component property | +| `FaqList` | For any 0 to 6 items: one `details` per item, every answer text present in the DOM, no `details` has the `open` attribute (Q5 = C) | Component property | +| `PhotoMosaic` | For any 2 to 6 images: `min(n, 4)` `img`s with the given alt texts, in order | Component property | + +Not PBT (example-based, PBT-10): the page structure and heading outline per shoot; the package versus "Prijs op aanvraag" variant for Newborn and Loveshoot; Zwangerschap/Gezin without mosaic (or with it, depending on [Q1]); the overview "Lees meer" links and kept anchors; OG registry consistency; axe on every section component and on each of the five pages. + +Generators (PBT-07): reuse `shootPageContent`, `shootPageShared`, `contentImage`, `storyBlock`, `faqItem`, `richText`; append `imageWithOrientation` (width and height drawn around the 1.2 threshold), `mosaicCount` (integers -3 to 12) and `timelineSteps` (1 to 8 steps with hostile strings) to `src/test/arbitraries.ts` (append only). + +## 4. Extension compliance (functional design level) + +### Security Baseline +| Rule | Status | Rationale | +|---|---|---| +| SECURITY-01 Encryption | N/A | No data stores | +| SECURITY-02 Access logging | N/A | No intermediaries added | +| SECURITY-03 Application logging | N/A | No server-side component; no `console` output in the new code | +| SECURITY-04 HTTP headers | Compliant | `config/securityHeaders.ts` untouched; no inline event handlers or styles beyond Chakra's; no new script; native `details` needs no JavaScript | +| SECURITY-05 Input validation | Compliant | The unit adds no input: no route or search parameter, no form. Ids used in markup are normalised by `headingId` (BR-SP-72); link targets are typed routes or derived by `shootContactLink`/`shootPagePath` | +| SECURITY-06 Least privilege | N/A | No IAM | +| SECURITY-07 Network | N/A | No network configuration | +| SECURITY-08 Access control | N/A | Public content | +| SECURITY-09 Hardening | Compliant | No debug output; no placeholder content (draft markers stay gated by D3, bracketed design placeholders are not used); no sample photos | +| SECURITY-10 Supply chain | Compliant | No new dependency: Chakra primitives, inline SVG icons, native `details`; lockfile unchanged | +| SECURITY-11 Secure design | Compliant | All content is rendered as text or typed router links (`RichParagraph`); no `dangerouslySetInnerHTML`; no e-mail address; no mailto | +| SECURITY-12 Authentication | N/A | No authentication | +| SECURITY-13 Integrity | Compliant | Only bundled photos and `public/` OG images; no CDN or embed (design E's Google Fonts link is not part of the app, fonts are already self-hosted) | +| SECURITY-14 Alerting | N/A | No server-side component | +| SECURITY-15 Fail-safe | Compliant | Omitted sections instead of errors (BR-SP-04, 26, 30a, 74); `headingId` safe for any string; package fallback from unit 1 | + +No blocking findings. + +### Property-Based Testing (full enforcement) +| Rule | Status | Rationale / evidence | +|---|---|---| +| PBT-01 Property identification | Compliant | Section 3 lists the properties for every pure function and component of the unit | +| PBT-02 Round-trip | N/A | No parse/serialise or encode/decode pair is added by this unit (the slug/path and JSON-LD round trips are unit 1) | +| PBT-03 Invariants | Planned | `mosaicLayout`, `storyLayout`, `shootPageBands`, `readMoreLabel`, `headingId` plus four component properties (Section 3) | +| PBT-04 Idempotency | N/A | No operation with an idempotency contract is added (the placeholder idempotency is unit 1) | +| PBT-05 Oracle | N/A | No reference implementation | +| PBT-06 Stateful | N/A | The unit has no application state: FAQ state belongs to the browser (`details`), the timeline and mosaic are stateless, breakpoints are CSS | +| PBT-07 Generators | Planned | Reuse of unit 1's domain generators and three appended ones (Section 3) | +| PBT-08 Shrinking and reproducibility | Compliant | fast-check shrinking and the seed logging of `config/testSeed.ts` stay as they are | +| PBT-09 Framework | Compliant | fast-check is already a dependency | +| PBT-10 Complementary | Planned | Example-based, route-level and axe tests alongside (Section 3, "Not PBT") | + +## 5. Accessibility and Lighthouse acceptance (unit 2) + +- Lighthouse accessibility, best practices and SEO stay 1.0 on all five shoot pages, mobile and desktop; axe finds no violation in any new component or page test (NFR-ST-01). +- Contrast: all text uses existing tokens that pass on `paper` and `paper.alt` (`ink`, `ink.soft`, `accent.deep`); the filled last marker is white on `accent.deep` (about 5.7:1). `ink.muted` is not used for text. +- Touch targets of at least 44 x 44 px: breadcrumb links, FAQ `summary`, "Bekijk meer ...foto's", package and closing buttons, secondary links, "Lees meer". +- Keyboard: tab order equals reading order; the only new stops are links and `summary` elements; no keyboard trap; focus ring visible on every one. +- Performance: shoot pages stay in the photo-page bucket (mobile 0.85, goal 0.9; desktop 0.9). Measured after code generation and reported with numbers. + +## 6. Decision register (what changes with an answer) + +| Question | Provisional (recommended) | If the user chooses otherwise | +|---|---|---| +| Q1 Zwangerschap and Gezin photos | A: photos stay in stories 2 and 3; no mosaic | B: content edit only (`photos.images` order, stories 2 and 3 lose `image`); mosaic of two; no code change | +| Q2 Minimum photos | A: 2 | B: constant 3 (Newborn keeps its mosaic); C: constant 4 (Newborn loses it until one more photo); `mosaicLayout` unchanged | +| Q3 Mosaic click | A: not interactive | B: add `full` image per mosaic photo to the content type (unit 1 types touched), reuse `Lightbox`, tiles become buttons; BR-SP-33 and the `PhotoMosaic` props change | +| Q4 Text-only blocks | A: own band, narrow centred column | B: grouping of consecutive text-only stories; `storyLayout` returns groups and `shootPageBands` counts a group as one band | +| Q5 FAQ open | C: all closed (chosen 2026-10-30; recommended was A, first two) | Not applicable: answered. `FAQ_OPEN_COUNT` and `faqInitiallyOpen` are dropped (BR-SP-51, FaqList, PBT list) | +| Q6 "Lees meer" look | A: text link, first | B: outline `LinkButton` under the text; `ShootBlock` markup and tests change | +| Q7 OG images | A: landscape crop | B: composed card (needs a small generation script outside the repo, same output files); C: no `ogImage` entries, no files, BR-SP-80 and its test dropped | diff --git a/aidlc-docs/features/shoot-type-pages/construction/shoot-page-ui/functional-design/domain-entities.md b/aidlc-docs/features/shoot-type-pages/construction/shoot-page-ui/functional-design/domain-entities.md new file mode 100644 index 0000000..b4bec07 --- /dev/null +++ b/aidlc-docs/features/shoot-type-pages/construction/shoot-page-ui/functional-design/domain-entities.md @@ -0,0 +1,157 @@ +# Domain Entities - Unit 2: Shoot page UI + +> Final — answers recorded in ../../plans/shoot-page-ui-fd-questions.md (2026-10-30); tags **[Q#]** mark values that depend on an answer. + +The data entities of the shoot pages (`ShootPageContent`, `ShootPageShared`, `ShootPageView`, `StoryBlock`, `FaqItem`, `ContentImage`, `PricingPackage`) exist since unit 1 and do not change; see [component-methods.md](../../../inception/application-design/component-methods.md). This document adds the UI-level entities of unit 2 (what the view is turned into before it is drawn) and the registry and image data the unit owns. Entity fields are in the tables below the diagram. + +## 1. Entity relationships + +```mermaid +graph TD + View["ShootPageView"] + Band["SectionBand"] + StoryL["StoryLayout"] + Story["StoryBlock"] + Tile["MosaicTile"] + Photo["ContentImage"] + Step["ProcessStep"] + Marker["TimelineMarker"] + Faq["FaqItem"] + Crumb["BreadcrumbItem"] + Offer["Offer block"] + Pkg["PricingPackage"] + Og["OgImage"] + Page["Registry entry sitePages"] + View -->|"orders into"| Band + View -->|"contains four"| Story + Story -->|"is laid out as"| StoryL + Story -->|"may have one"| Photo + View -->|"has six"| Step + Step -->|"is drawn with one"| Marker + View -->|"has zero or more"| Photo + Photo -->|"is placed in one"| Tile + View -->|"has three to five"| Faq + View -->|"has three"| Crumb + View -->|"has one"| Offer + Offer -->|"holds zero or one"| Pkg + Page -->|"has one per shoot"| Og + classDef entity fill:#2196F3,stroke:#0d47a1,stroke-width:1px,color:#000; + classDef derived fill:#9C27B0,stroke:#4a148c,stroke-width:1px,color:#000; + classDef value fill:#FF9800,stroke:#e65100,stroke-width:1px,color:#000; + classDef registry fill:#4CAF50,stroke:#2e7d32,stroke-width:1px,color:#000; + class View,Story,Step,Faq,Crumb,Offer,Pkg entity; + class Band,StoryL,Tile,Marker derived; + class Photo value; + class Page,Og registry; +``` + +Text alternative: a ShootPageView orders into section bands and holds four story blocks, six process steps, photos, FAQ items, three breadcrumb items and one offer block; unit 2 derives a StoryLayout per story, a MosaicTile per mosaic photo and a TimelineMarker per step, and owns one OgImage per registry entry (blue = view data, purple = derived UI entities, orange = value entity, green = registry). + +## 2. New UI-level entities (all pure data, no identity of their own) + +### SectionBand (`lib/shootPageBands.ts`) +| Field | Type | Description | +|---|---|---| +| `id` | `'intro'`, `` `story-${string}` ``, `'process'`, `'photos'`, `'faq'`, `'offer'`, `'closing'` | Which section. The intro is not a band (it has no tone; it is always `paper`) | +| `tone` | `'paper' \| 'alt'` | Position even = `paper`, odd = `alt` | +| `position` | integer | 0 for the first story | + +Rules: consecutive positions over rendered sections only; optional sections (`photos`, `faq`) appear iff the view has them. + +### StoryLayout (`lib/storyLayout.ts`) +| Field | Type | Description | +|---|---|---| +| `tone` | `'paper' \| 'alt'` | From the story index (equal to its `SectionBand`) | +| `spacing` | `'flushTop' \| 'default'` | `flushTop` for index 0 | +| `reverse` | boolean | True for odd indexes: photo in the right column from `lg` | +| `priority` | boolean | True only for index 0 and only with an image | +| `media` | `{ aspectRatio: '3 / 2' \| '4 / 5'; mediaSize: 'half' \| 'medium' }` or absent | Absent for text-only stories | + +Orientation threshold: `width >= 1.2 * height` is landscape (the current data has 800x534 landscape = 1.50 and 800x1200 / 848x1060 portrait = 0.67 / 0.80, so there is a wide margin on both sides). + +### MosaicTile (`lib/mosaicLayout.ts`, shape fixed here) +| Field | Type | Description | +|---|---|---| +| `column` | string | CSS grid-column from `md`, e.g. `'1 / 3'` | +| `row` | string | CSS grid-row from `md`, e.g. `'1 / 3'` | +| `wide` | boolean | Spans both columns below `md` | +| `phoneRatio` | string | CSS aspect ratio of the tile below `md`: `'4 / 3'`, `'3 / 2'` or `'1 / 1'` | + +`mosaicLayout(count)` returns: + +| Count | Tiles (`column`, `row`, `wide`, `phoneRatio`) | +|---|---| +| 0 or below | none | +| 1 (never shown, kept total) | `'1 / 5'`, `'1 / 3'`, wide, `4 / 3` | +| 2 | (`1 / 3`, `1 / 3`, wide, `4 / 3`), (`3 / 5`, `1 / 3`, wide, `4 / 3`) | +| 3 | (`1 / 3`, `1 / 3`, wide, `4 / 3`), (`3 / 5`, `1 / 2`, wide, `3 / 2`), (`3 / 5`, `2 / 3`, wide, `3 / 2`) | +| 4 | (`1 / 3`, `1 / 3`, wide, `4 / 3`), (`3 / 5`, `1 / 2`, wide, `3 / 2`), (`3 / 4`, `2 / 3`, not wide, `1 / 1`), (`4 / 5`, `2 / 3`, not wide, `1 / 1`) | +| 5 or more | the layout for 4 (the caller shows the first four) | + +### TimelineMarker (inside `ProcessTimeline`) +| Field | Type | Description | +|---|---|---| +| `index` | integer | Position in the list; even = text above the line from `lg` | +| `isLast` | boolean | Filled marker, no vertical line below | +| `icon` | ReactNode | From `processIcons[step.id]`, or none for an unknown id | + +### Constants +| Name | Value | Where | Depends on | +|---|---|---|---| +| `MOSAIC_MIN_PHOTOS` | 2 | `lib/shootPageView.ts` (unit 2 may change the value only) | **[Q2]** (3 or 4 on other answers) | +| `MOSAIC_MAX_PHOTOS` | 4 | `lib/mosaicLayout.ts` | design | +| Timeline breakpoint | theme `lg` (64em, 1024 px) | responsive props, no pixel literal | decided | +| Mosaic breakpoint | theme `md` (48em, 768 px) | responsive props | decided | +| Text-only story column | 36rem | `StoryBlocks` | **[Q4]** | +| Marker size | 56 px (`14` in the spacing scale, 3.5rem) | `ProcessTimeline` | design E | +| Vertical timeline cap | 34rem | `ProcessTimeline` | decided | +| Mosaic row height | `clamp(12rem, 22vw, 18.75rem)` | `PhotoMosaic` | design E (300 px at wide screens) | + +## 3. Photo selection per shoot (from unit 1's data) + +"Page photos" are `ShootPageContent.photos.images`; the view removes any whose `src` is already used by a story or the package block (D14). Alts and sizes are unchanged from the portfolio/shoot data. + +| Shoot | Story 1 | Story 2 | Story 3 | Story 4 | Package photo | Mosaic (in order: large, wide, ...) | Result [Q1 = A] | +|---|---|---|---|---|---|---|---| +| Newborn | `shoots/newborn.jpg` 848x1060, 4 / 5 | `f41a8700` 800x534, 3 / 2 | `f41a7176` 800x1200, 4 / 5 | `f41a1916` 800x1200, 4 / 5 | `shoots/newborn-detail.jpg` | `f41a1922` (portrait), `f41a4650` (landscape), `f41a7284` (portrait) | 3-photo mosaic; the 4-layout appears when Andrea adds one photo | +| Zwangerschap | `shoots/zwangerschap.jpg` | `f41a8206` (3 / 2) | `f41a7883` (4 / 5) | text only | `shoots/zwangerschap-detail.jpg` | none left | no mosaic | +| Gezin | `shoots/gezin.jpg` | `f41a1579` (3 / 2) | `f41a7138` (4 / 5) | text only | `shoots/gezin-detail.jpg` | none left | no mosaic | +| Loveshoot | `shoots/loveshoot.jpg` | text only | text only | text only | `shoots/loveshoot-detail.jpg` | none left | no mosaic, three text-only bands | +| Portret | `shoots/portret.jpg` | text only | text only | text only | `shoots/portret-detail.jpg` | none left | no mosaic, three text-only bands | + +Under **[Q1 = B]** Zwangerschap and Gezin change to: story 2 and 3 text only, mosaic = the two portfolio photos (both listed in `photos.images`; the view then keeps them, since the stories no longer use them), result a 2-tile mosaic. This is a content edit in `content/shootPages/zwangerschap.ts` and `gezin.ts` (unit 2 owns the photo selection), not a code change. Note for Gezin: the `shoots/gezin*` photos show newborn families (CON-ST-05). + +Content tests (unit 1, `shootPages.test.ts`) keep guarding: no `src` twice on the rendered view, every image has an alt and positive size. + +## 4. Process icons (inline SVG, from design E) + +All: `viewBox="0 0 24 24"`, `fill="none"`, `stroke="currentColor"`, `stroke-width="1.5"`, `stroke-linecap="round"`, `stroke-linejoin="round"`, `aria-hidden="true"`, `focusable="false"`, 24 x 24 px. + +| Step id | Motif | Shapes (design E, verbatim) | +|---|---|---| +| `aanvragen` | Envelope | `<rect x="3" y="5.5" width="18" height="13"/>`, `<path d="M3.5 6.5l8.5 6.5 8.5-6.5"/>` | +| `datum` | Calendar with heart | `<rect x="3.5" y="5" width="17" height="15.5"/>`, `<path d="M3.5 9.5h17M8 3v4M16 3v4"/>`, `<path d="M12 18.6s-3-2.6-3-4.7a3 3 0 0 1 6 0c0 2.1-3 4.7-3 4.7z"/>`, `<circle cx="12" cy="13.9" r="0.8"/>` | +| `aanbetaling` | Coin | `<circle cx="12" cy="12" r="9"/>`, `<path d="M15.5 8.6a4.2 4.2 0 1 0 0 6.8"/>`, `<path d="M7.5 10.9h5.5M7.5 13.1h5.5"/>` | +| `shoot` | Camera | `<path d="M3 8h4l1.6-2.5h6.8L17 8h4v11H3z"/>`, `<circle cx="12" cy="13.5" r="3.5"/>` | +| `bewerking` | Sliders | `<path d="M4 7h9M17 7h3M4 12h4M12 12h8M4 17h3M11 17h9"/>`, `<circle cx="15" cy="7" r="2"/>`, `<circle cx="10" cy="12" r="2"/>`, `<circle cx="9" cy="17" r="2"/>` | +| `oplevering` | Picture | `<rect x="3.5" y="4.5" width="17" height="15"/>`, `<circle cx="9" cy="9.5" r="1.6"/>`, `<path d="M3.5 17l5-4.5 3.5 3 3-2.5 5.5 4.5"/>` | + +## 5. Registry and OG images (SEO-ST-05) [Q7] + +`PageMeta.ogImage?: { path; width; height; alt }` exists. Unit 2 adds, per shoot, `ogImage: { path: '/og-<id>.jpg', width: 1200, height: 630, alt }` and the file `web/public/og-<id>.jpg` (JPEG, 1200 x 630, at most about 100 KB; the existing ones are 54-92 KB). + +Proposed sources for **[Q7 = A]** (a landscape 1.91:1 crop; the five crops are shown to the user before they are fixed, as decided in Application Design): + +| Shoot | Proposed source | Source size | Crop | Note | +|---|---|---|---|---| +| Newborn | `assets/portfolio/f41a4650-groot.jpg` (baby fist; alternative `f41a8700-groot`, check it differs from `og-soorten-fotoshoots.jpg`) | landscape ~1600 x 1067 | ~1600 x 840, scaled down | Sharp | +| Zwangerschap | `assets/portfolio/f41a8206-groot.jpg` (belly in black dress) | landscape ~1600 x 1067 | ~1600 x 840, scaled down | Sharp | +| Gezin | `assets/portfolio/f41a1579-groot.jpg` (big brother kisses baby) | landscape ~1600 x 1067 | ~1600 x 840, scaled down | `og-portfolio.jpg` already uses this alt text; if it is the same photo, use `f41a7138-groot` (portrait, softer) instead | +| Loveshoot | `assets/shoots/loveshoot.jpg` | portrait 848 x 1060 | 848 x 445, scaled up about 1.4x | Slightly soft; no landscape photo exists yet | +| Portret | `assets/shoots/portret.jpg` | portrait 848 x 1060 | 848 x 445, scaled up about 1.4x | Same | + +Alt text = the alt of the source photo (Dutch, descriptive), like the existing entries. The files are produced once by a throw-away script outside the repository (no new dependency); only the five JPEGs and the `sitePages.ts` fields are committed. A test (registry consistency) asserts for every shoot: `ogImage` defined, path `/og-<id>.jpg`, 1200 x 630, non-blank alt, and the file exists in `web/public/`. + +## 6. Overview link entity + +`readMoreLabel(shoot: ShootType): string` = `Lees meer over de ${shoot.shootLabel.toLowerCase()}`. Real values: "Lees meer over de newbornshoot", "... zwangerschapsshoot", "... gezinsshoot", "... loveshoot", "... portretshoot". Target: `shootPagePath(shoot.id)`. diff --git a/aidlc-docs/features/shoot-type-pages/construction/shoot-page-ui/functional-design/frontend-components.md b/aidlc-docs/features/shoot-type-pages/construction/shoot-page-ui/functional-design/frontend-components.md new file mode 100644 index 0000000..0d19f3d --- /dev/null +++ b/aidlc-docs/features/shoot-type-pages/construction/shoot-page-ui/functional-design/frontend-components.md @@ -0,0 +1,292 @@ +# Frontend Components - Unit 2: Shoot page UI + +> Final — answers recorded in ../../plans/shoot-page-ui-fd-questions.md (2026-10-30); tags **[Q#]** mark what an answer would change (register in [business-rules.md § 6](business-rules.md)). + +Props follow [component-methods.md](../../../inception/application-design/component-methods.md); this document fixes the details Application Design handed over and records the few additions (marked **new**). Rules: [business-rules.md](business-rules.md). Logic: [business-logic-model.md](business-logic-model.md). + +## 1. Component hierarchy + +```mermaid +graph TD + Route["Route newborn.tsx etc: StructuredData and ShootPage"] --> SP["ShootPage"] + SP --> Bands["lib shootPageBands"] + SP --> Intro["PageIntro with breadcrumb slot"] + Intro --> Crumb["Breadcrumb"] + SP --> Stories["StoryBlocks"] + Stories --> SL["lib storyLayout"] + Stories --> MT["MediaText medium or half"] + MT --> FI["FramedImage"] + Stories --> RP["RichParagraph"] + SP --> Proc["PageSection and SectionHeading"] + Proc --> TL["ProcessTimeline"] + TL --> Icons["ProcessIcons"] + SP --> Photos["PageSection with photo head"] + Photos --> Mosaic["PhotoMosaic"] + Mosaic --> ML["lib mosaicLayout"] + Mosaic --> DI["DeferredImage"] + SP --> Faq["PageSection with FAQ head"] + Faq --> FL["FaqList"] + FL --> RP + SP --> Pkg["PackageBlock"] + Pkg --> MT + Pkg --> LB["LinkButton"] + SP --> Cta["CallToAction with tone"] + Cta --> LB + Overview["Overview route"] --> SBlock["ShootBlock with Lees meer link"] + SBlock --> RL["lib readMoreLabel"] + classDef root fill:#4CAF50,stroke:#2e7d32,stroke-width:1px,color:#000; + classDef page fill:#2196F3,stroke:#0d47a1,stroke-width:1px,color:#000; + classDef pure fill:#9C27B0,stroke:#4a148c,stroke-width:1px,color:#000; + classDef reused fill:#f6e05e,stroke:#c05621,stroke-width:1px,color:#000; + class Route,Overview root; + class SP,Intro,Crumb,Stories,Proc,TL,Icons,Photos,Mosaic,Faq,FL,Pkg,SBlock,Cta page; + class Bands,SL,ML,RL pure; + class MT,FI,RP,DI,LB reused; +``` + +Text alternative: the five shoot routes render ShootPage, which uses shootPageBands to compose the intro with Breadcrumb, StoryBlocks on MediaText, the timeline, the optional mosaic, the FAQ, the package block and the closing call to action; the overview ShootBlock gets a Lees meer link (green = routes, blue = unit 2 components, purple = pure helpers, yellow = reused components). + +## 2. Shared building blocks (`web/src/components/`) + +### Breadcrumb (new) +- **Props**: `label: string` (nav name), `items: readonly BreadcrumbItem[]`, optional `data-testid`. +- **State**: none. +- **Markup**: `nav[aria-label]` > `ol` (flex, wrap, centred, gap 2, `fontSize` 0.875rem, `color ink.soft`) > `li` per item; links are the router `Link` via `RouterLink` with `activeOptions={{ exact: true }}`, accent.deep text, permanent underline, `minH` 44 px, inline-flex centred; the last item is a `span` with `aria-current="page"` and `ink` colour; between items `li[aria-hidden="true"]` with "/". +- **Behaviour**: BR-SP-01..04. No items: renders nothing. +- **Used by**: `ShootPage` through the `PageIntro` slot. Generic (no shoot knowledge). + +### PageIntro (changed, additive) +- **New props**: `titleId?: string` (id of the h1; `aria-labelledby` of the section), `breadcrumb?: ReactNode` (rendered above the eyebrow, `mb` 6 on phones, 7 from `md`). +- Existing callers unchanged (BR-SP-05); one test pins their markup. + +### ProcessTimeline (new) +- **Props**: `steps: readonly { id: string; title: string; text: string; icon?: ReactNode }[]`, `tone?: 'paper' | 'alt'` (**new**, default `paper`, the band colour the markers use to hide the line), `data-testid`. +- **State**: none. +- **Markup**: `Reveal` > `ol[role="list"]` (no list style) > `li` per step > [decorative marker `div[aria-hidden]` containing the icon; decorative line segments `span[aria-hidden]`; text block with `h3` (heading font, `xl`, tight line height) and `p` (0.9375rem, line-height 1.6, `ink.soft`)]. +- **Layout**: below `lg` one column, `li` = grid `3.5rem | 1fr`, column gap 5 (20 px), padding-bottom 8 except the last, list capped at 34rem and centred, vertical line from the marker centre to the bottom of the `li` (hidden on the last), text top-aligned with `pt` 3. From `lg` the `ol` is `repeat(<n>, minmax(0, 1fr))` by `auto 3.5rem auto` rows, each `li` spans the three rows with `gridTemplateRows: subgrid` (fallback `1fr 3.5rem 1fr`), the marker in row 2 with the horizontal line behind it (first `li`: from the centre; last: to the centre), text in row 1 (end-aligned, `pb` 6) for even indexes and row 3 (start-aligned, `pt` 6) for odd, text centred, `px` 3. +- **Behaviour**: BR-SP-20..26. Last marker filled. Reading order = DOM order = `steps` order. +- **Not here**: no step numbering, no per-step motion, no knowledge of shoots, deposits or placeholders. + +### PhotoMosaic (new) +- **Props**: `images: readonly ContentImage[]`, `data-testid`. +- **State**: none. +- **Markup**: `ul[role="list"]` as a grid (below `md` two columns; from `md` four columns by two rows of `clamp(12rem, 22vw, 18.75rem)`; gap `gridGap`) > `Reveal as li` (delay `index * 0.08`) with the tile's `column`/`row` (from `md`) or span 2 when `wide` (below `md`), `aspectRatio` = `phoneRatio` below `md` and `auto` from `md`, `position: relative`, `overflow: hidden`, `bg paper.deep` > `DeferredImage` absolutely filling the cell (`objectFit: cover`, intrinsic width/height attributes kept). +- **Behaviour**: BR-SP-30b..35; takes the first `MOSAIC_MAX_PHOTOS`; renders nothing for an empty list. Not interactive **[Q3 = A]**. +- The section frame (eyebrow, h2, portfolio link) is composed by `ShootPage`; the component itself is only the grid. + +### FaqList (new) +- **Props**: `items: readonly FaqItem[]`, `data-testid`. +- **State**: none (the browser owns open/closed; no item has the `open` attribute at load **[Q5 = C]**). +- **Markup**: `Box` with a top hairline (`sand`) > per item `details` (bottom hairline) > `summary` (`display flex`, space-between, `minH` 44 px, `py` 5, heading font 1.25rem, `ink`, `cursor pointer`, `listStyle none`, WebKit marker hidden, focus ring from the theme `focusRing` token with offset) containing the question and the decorative icon (`svg[aria-hidden]`, plus; vertical stroke hidden by CSS under `details[open]`), followed by `RichParagraph` of the answer with `mb` 6 and `maxW` 680 px. +- **Behaviour**: BR-SP-50..52. No JavaScript, no animation. + +### PackageBlock (new) +- **Props** (as in component-methods.md): `titleId`, `eyebrow`, `title`, `image: ContentImage`, `frameColor?`, `pkg?: PricingPackage`, `onRequest: { price: string; text: string }`, `note?: string`, `children` (the actions), `data-testid`. +- **Markup**: `MediaText mediaSize="small"` with `image` (aspect `1 / 1`, deferred, `frameColor`); text column: `Eyebrow`, `h2#titleId` (`sectionTitle`), price paragraph (heading font, 2.25rem, `accent.deep`, `formatPrice(pkg.price)` or `onRequest.price`), then either the features `ul` (rows with `sand` top border, the last also with a bottom border) or the `onRequest.text` paragraph (`ink.soft`), the actions row (flex, wrap, gap 3 / 7, centred vertically, children), and the note paragraph (0.875rem, `mt` 5). +- **Behaviour**: BR-SP-60..62. Package or on-request is `pkg` presence only; never a shoot id. + +### MediaText (changed, additive) - **new addition to the file ownership table** +- `mediaSize` accepts `'medium'` in addition to `'half'` and `'small'`: photo column up to 30rem (480 px, design E's portrait width) with the text, up to 36rem, centred in the rest, exactly as `small` does. Existing sizes and callers unchanged; a test for `medium` is added to `MediaText.test.tsx`. +- Reason: with `half` the 4:5 photo would be about 580 x 725 px at 1240 px content (taller than design E's 480 x 600); with `small` (320 px) it would be much smaller than design E. Neither is a hard-coded override, and the overview page keeps `small`. + +### CallToAction (changed, additive) - **new addition to the file ownership table** +- New optional `tone?: 'paper' | 'alt'`, default `'alt'` (today's behaviour). `ShootPage` passes the band tone so the closing band never equals the package band (design E has it on paper). Existing callers unchanged; one test added. + +## 3. Shoot page parts (`web/src/components/shoots/`) + +### ShootPage (sections added to unit 1's shell) +- **Props**: `{ view: ShootPageView }`; no state, no content imports. +- **Composition** (order = `shootPageBands(view)`): + 1. `PageIntro` (`eyebrow`, `title`, `titleId="intro-title"`, `breadcrumb=<Breadcrumb/>`), text from `view.intro.text`. + 2. `StoryBlocks` (`stories`, `frameColor = view.shoot.frameColor`, `idPrefix="story"`). + 3. `PageSection id="zo-werkt-het" labelledBy="process-title" tone` with `SectionHeading` (eyebrow, h2, lead from `view.process`) and `ProcessTimeline` (steps with icons from `processIcons`). + 4. If `view.photos`: `PageSection id="impressie" labelledBy="photos-title" tone`: head (eyebrow, h2 `photos-title`, "Bekijk meer {photosLabel}" link when `portfolioLink`) and `PhotoMosaic`. + 5. If `view.faq`: `PageSection id="vragen" labelledBy="faq-title" tone`: two columns from `lg` (eyebrow, h2 `faq-title`, `RichParagraph` of the lead | `FaqList`), stacked below `lg`. + 6. `PageSection id="pakket" labelledBy="offer-title" tone` with `PackageBlock` and its actions (BR-SP-60). + 7. `CallToAction` (`titleId="closing-title"`, `tone`, rich-text lead, accent `LinkButton`). +- `data-testid`s: `shoot-page`, `shoot-breadcrumb`, `story-<id>`, `process-timeline`, `photo-mosaic`, `faq-list`, `package-block`, `shoot-closing`. + +### StoryBlocks (new) +- **Props**: `stories`, `frameColor`, `idPrefix`. +- **Behaviour**: `storyLayout(stories)` gives each block its tone, spacing, side, priority and media. Block with media: `PageSection` (labelled by its h2) > `MediaText` (`image`, `aspectRatio`, `mediaSize`, `reverse`, `priority`, `frameColor`) with the text column: `Eyebrow`, `h2` (`sectionTitle`), a stack of `RichParagraph`s (gap 4, `ink.soft`). Block without media **[Q4 = A]**: the same `PageSection` (width `narrow`) with the same text column inside a `Reveal`, `maxW` 36rem, centred; no `MediaText`, no frame. +- Heading id: `headingId(idPrefix, story.id)` plus `-title`. + +### ProcessIcons (new) +- `processIcons: Record<ProcessStepId, () => JSX.Element>` (six components, paths in domain-entities.md § 4). `ShootPage` maps `view.process.steps` through it; an id without an icon yields no icon (BR-SP-74). + +### ShootBlock (changed) +- New first link in the links row: `Link variant="underline"` > `RouterLink to={shootPagePath(shoot.id)}` with the text `readMoreLabel(shoot)` and the same `py` as the other links (44 px target), `data-testid="shoot-<id>-readmore"` **[Q6 = A]**. Props unchanged; tests: link text and href per shoot, unique accessible names across the list, existing anchors and links still present. + +## 4. Responsive behaviour + +| Width | Story blocks | Timeline | Mosaic | FAQ | Package | +|---|---|---|---|---|---| +| 320 - 767 px (base) | Photo above text, frame hidden by `FramedImage` below `sm` | Vertical | 2 columns, phone ratios | Stacked | Stacked, photo first | +| 768 - 1023 px (`md`) | Photo above text | Vertical, capped at 34rem | 4x2 grid, row 12rem or more | Stacked | Stacked | +| 1024 px and up (`lg`) | Two columns, side alternates | Horizontal, alternating texts | 4x2 grid, row up to 18.75rem | Two columns (1/3 and 2/3) | Two columns | +| Ultrawide | Content capped by `content` token (8xl) | Same | Same | Same | Same | + +- No horizontal scroll from 320 px: grids use `minmax(0, 1fr)`, text wraps, nothing has a fixed width above 100 %. +- 200 % zoom behaves like half the width: a 1280 px window at 200 % is 640 px wide, so the vertical timeline and stacked layouts apply (the vertical layout is also the reflow fallback required by WCAG 1.4.10). + +## 5. Interaction flows + +```mermaid +graph TD + visit["Visitor on a shoot page"] --> crumb["Taps a breadcrumb link: Home or Soorten fotoshoots"] + visit --> faq["Taps or presses Enter or Space on a question: details opens or closes"] + visit --> more["Taps Bekijk meer foto's: portfolio filtered on this shoot"] + visit --> book["Taps Boek dit pakket or the closing button: contact page with the package preselected"] + visit --> ask["Taps Eerst een vraag stellen or Vraag naar de mogelijkheden: contact page"] + overview["Visitor on the overview page"] --> readmore["Taps Lees meer over de newbornshoot: shoot page"] + classDef start fill:#4CAF50,stroke:#2e7d32,stroke-width:1px,color:#000; + classDef action fill:#2196F3,stroke:#0d47a1,stroke-width:1px,color:#000; + class visit,overview start; + class crumb,faq,more,book,ask,readmore action; +``` + +Text alternative: on a shoot page the visitor can follow the breadcrumb, toggle FAQ items, open the portfolio, or go to the contact page from the package or closing buttons; on the overview page the Lees meer link leads to the shoot page. + +- Only links and FAQ toggles are interactive; there is no component state, no form, no modal. Focus handling on route change is the existing `useRouteFocus` behaviour of the shell and is unchanged. +- **Form validation rules**: none (no forms). **Error handling**: unknown shoots and mismatched content are handled in unit 1 (`NotFound`); every component omits itself on empty input (BR-SP-74). +- **API integration points**: none (static, flat content; the CMS API replaces the content modules 1-to-1 later). Link targets: `/`, `/soorten-fotoshoots`, `/portfolio?shoot=<id>` (`shootPortfolioLink`), `/contact?pakket=<id>` (`shootContactLink`), `/contact`, `/soorten-fotoshoots/<id>` (`shootPagePath`). + +## 6. Accessibility checklist (WCAG 2.1 AA, NFR-ST-01) + +| Item | Where | Check | +|---|---|---| +| One h1, h2 per section, h3 per step, no skipped level | `ShootPage` | Heading outline example test per shoot (with and without mosaic and FAQ) | +| Every section named by its heading | all sections | `aria-labelledby` ids via `headingId`; axe | +| Breadcrumb landmark and current page | `Breadcrumb` | `nav` "Kruimelpad", one `aria-current="page"`, nothing else current on the page | +| List semantics survive styling | timeline, mosaic | `role="list"` on the `ol`/`ul` | +| Decorative graphics hidden | icons, markers, line, separators, FAQ icon | `aria-hidden`, no focusable SVG | +| Disclosure operable by keyboard | `FaqList` | Native `summary`; visible focus ring; 44 px high | +| Touch targets | links, buttons, `summary` | At least 44 px high | +| Contrast | all text | Existing tokens only (`ink`, `ink.soft`, `accent.deep`); no `ink.muted` text | +| Motion | `Reveal` only | `prefers-reduced-motion` shows content at once; FAQ and timeline have no motion | +| Images | all | Non-empty alt (content test), intrinsic width and height | +| Reading order | timeline | DOM order = visual order in both layouts (texts above and below the line are separate grid rows, not reordered visually against the DOM) | +| Name clashes | overview and page | Package button and closing button have different names; "Lees meer" names unique per shoot | + +## 7. Lighthouse and performance checklist + +| Item | Decision | +|---|---| +| Largest contentful paint | Photo of story block 0 (priority, `fetchPriority="high"`, no lazy loading); fallback to text when block 0 has no photo | +| All other photos | `DeferredImage` (waits for the page load event and the viewport) | +| Layout shift | Width/height on every image; grid cells or aspect ratios reserve all photo space; `Reveal` only changes opacity and a transform | +| Code splitting | Unchanged from unit 1: each route imports its own content; the new components live in the shared shoot-page chunk, not in the main bundle | +| Bundle | No new dependency; six inline SVGs; native `details` | +| Budgets | Mobile 0.85 (goal 0.9) via `photoPagePaths`, desktop 0.9, accessibility / best practices / SEO 1.0; measured after code generation, reported with numbers, not worked around | +| Mitigation order if the largest paint regresses | (1) first story without the fade-in, (2) fewer pixels for the first photo by capping its column, (3) report and keep the known limit | + +## 8. Files for this unit (additions to the ownership table in application-design.md) + +| Path (under `web/` unless noted) | Action | +|---|---| +| `src/components/Breadcrumb/*`, `ProcessTimeline/*`, `PhotoMosaic/*`, `FaqList/*`, `PackageBlock/*` (component + test each) | create | +| `src/components/PageIntro/*` | change (additive) | +| `src/components/MediaText/*` | change (additive `medium`) | +| `src/components/CallToAction/*` | change (additive `tone`) | +| `src/components/shoots/ShootPage/*`, `StoryBlocks/*`, `ProcessIcons/*`, `ShootBlock/*` | create / change | +| `src/lib/mosaicLayout.ts`, `storyLayout.ts`, `shootPageBands.ts`, `readMoreLabel.ts`, `headingId.ts` (+ tests) | create | +| `src/lib/shootPageView.ts` | `MOSAIC_MIN_PHOTOS` value only **[Q2]** | +| `src/content/shootPages/*.ts` | photo selection and alt texts only **[Q1]** | +| `src/sitePages.ts` | five `ogImage` fields **[Q7]** | +| `public/og-<id>.jpg` x 5 | create **[Q7]** | +| `src/shootPages.test.tsx` | create: page structure per shoot, overview links, OG registry consistency, heading outline, axe | +| `src/test/arbitraries.ts` | append only | +| `LAYOUT.md`, `.ai/layout-conventions.md` (repo root) | change (section 9) | + +`MediaText` and `CallToAction` are not touched by unit 3, so the units stay disjoint. `theme.ts` is expected to need no change (all values use existing tokens or component-level rem values). + +## 9. LAYOUT.md "Shoot page" section + +Source to place after "Types of shoots" in `LAYOUT.md` (the repository's template: `block-beta`, one block per section, lettered A to J in page order; Photos is shown although it is omitted below the minimum, as the diagram is the abstract page). Letters A-G keep their colours; H, I and J are new, with stroke = fill x 0.75 (rounded) as the convention requires: + +| Letter | Block | Fill | Stroke | +|---|---|---|---| +| A | Intro (with breadcrumb) | `#e76f51` | `#ad533d` | +| B | Story 1 | `#f4a261` | `#b77a49` | +| C | Story 2 | `#2a9d8f` | `#20766b` | +| D | Story 3 | `#264653` | `#1d353e` | +| E | Story 4 | `#e9c46a` | `#af9350` | +| F | Process timeline | `#b56576` | `#884c59` | +| G | Photos | `#6d7fcc` | `#525f99` | +| H | FAQ | `#9b6bb5` (new) | `#745088` | +| I | Package | `#4cc3e0` (new) | `#3992a8` | +| J | Book | `#8cb83f` (new) | `#698a2f` | + +Calculation: H 155,107,181 x 0.75 = 116,80,136 = `#745088`; I 76,195,224 x 0.75 = 57,146,168 = `#3992a8`; J 140,184,63 x 0.75 = 105,138,47 = `#698a2f`. The new colours are distinct from the seven existing ones (purple, cyan, lime) with the same medium-high saturation. + +```text +block-beta +columns 1 + A["Intro"] + B["Story 1"] + C["Story 2"] + D["Story 3"] + E["Story 4"] + F["Process timeline"] + G["Photos"] + H["FAQ"] + I["Package"] + J["Book"] + + style A fill:#e76f51,stroke:#ad533d,color:#fff,font-size:16px,width:400px,height:125px,stroke-width:2px + style B fill:#f4a261,stroke:#b77a49,color:#fff,font-size:16px,width:400px,height:125px,stroke-width:2px + style C fill:#2a9d8f,stroke:#20766b,color:#fff,font-size:16px,width:400px,height:125px,stroke-width:2px + style D fill:#264653,stroke:#1d353e,color:#fff,font-size:16px,width:400px,height:125px,stroke-width:2px + style E fill:#e9c46a,stroke:#af9350,color:#fff,font-size:16px,width:400px,height:125px,stroke-width:2px + style F fill:#b56576,stroke:#884c59,color:#fff,font-size:16px,width:400px,height:125px,stroke-width:2px + style G fill:#6d7fcc,stroke:#525f99,color:#fff,font-size:16px,width:400px,height:125px,stroke-width:2px + style H fill:#9b6bb5,stroke:#745088,color:#fff,font-size:16px,width:400px,height:125px,stroke-width:2px + style I fill:#4cc3e0,stroke:#3992a8,color:#fff,font-size:16px,width:400px,height:125px,stroke-width:2px + style J fill:#8cb83f,stroke:#698a2f,color:#fff,font-size:16px,width:400px,height:125px,stroke-width:2px +``` + +Preview of the same order (documentation colours with black text; D is lightened here so its label stays readable, the real LAYOUT.md block keeps `#264653`): + +```mermaid +graph TD + A["A Intro"] --> B["B Story 1"] + B --> C["C Story 2"] + C --> D["D Story 3"] + D --> E["E Story 4"] + E --> F["F Process timeline"] + F --> G["G Photos"] + G --> H["H FAQ"] + H --> I["I Package"] + I --> J["J Book"] + classDef a fill:#e76f51,stroke:#ad533d,color:#000; + classDef b fill:#f4a261,stroke:#b77a49,color:#000; + classDef c fill:#2a9d8f,stroke:#20766b,color:#000; + classDef d fill:#7fb3c8,stroke:#1d353e,color:#000; + classDef e fill:#e9c46a,stroke:#af9350,color:#000; + classDef f fill:#b56576,stroke:#884c59,color:#000; + classDef g fill:#6d7fcc,stroke:#525f99,color:#000; + classDef h fill:#9b6bb5,stroke:#745088,color:#000; + classDef i fill:#4cc3e0,stroke:#3992a8,color:#000; + classDef j fill:#8cb83f,stroke:#698a2f,color:#000; + class A a; + class B b; + class C c; + class D d; + class E e; + class F f; + class G g; + class H h; + class I i; + class J j; +``` + +Text alternative: the Shoot page runs from the intro through four story blocks, the process timeline, the photos, the FAQ and the package block to the booking band, each block keeping its permanent letter colour (H purple, I cyan and J lime are new). + +`.ai/layout-conventions.md` gets the same three `style` lines appended to the template list, and its sentence "extend with a new letter using the same formula if an 8th block is ever needed" is updated to name the 10 letters. "Types of shoots" and Shell stay unchanged (the new links add no section; the Shell diagram shows no menu items). The note under the photo block in LAYOUT.md may say that Photos is omitted when fewer than the minimum photos exist. + +## 10. Test plan summary (code generation input) + +- **Pure functions** (PBT + examples): `mosaicLayout`, `storyLayout`, `shootPageBands`, `readMoreLabel`, `headingId` (100 % coverage, `src/lib/**` threshold). +- **Component tests** (`renderWithProviders`, axe in each): `Breadcrumb`, `ProcessTimeline` (order, alternation by `data-` attribute or class-independent DOM order, last marker, `role="list"`), `PhotoMosaic` (2, 3, 4, 5 photos; empty), `FaqList` (all closed at load, answers in the DOM, keyboard toggle with `userEvent`), `PackageBlock` (both variants), `StoryBlocks` (photo and text-only; first priority image; others not), `PageIntro` (unchanged output without the new props), `MediaText` (`medium`), `CallToAction` (`tone`), `ShootBlock` (Lees meer). +- **Route-level** (`shootPages.test.tsx`, via `renderApp`): per shoot the heading outline, sections present or omitted (Newborn mosaic present; Loveshoot no mosaic, "Prijs op aanvraag"; Newborn "Boek dit pakket" to `/contact?pakket=newborn`), breadcrumb, a single `aria-current="page"` in the whole page including header and footer, OG registry (BR-SP-80), overview links and anchors. +- Existing tests stay green unchanged; `pnpm check` incl. Lighthouse as the unit gate. diff --git a/aidlc-docs/features/shoot-type-pages/inception/application-design/application-design-questions.md b/aidlc-docs/features/shoot-type-pages/inception/application-design/application-design-questions.md new file mode 100644 index 0000000..7c441d1 --- /dev/null +++ b/aidlc-docs/features/shoot-type-pages/inception/application-design/application-design-questions.md @@ -0,0 +1,57 @@ +# Ontwerpvragen — Application Design + +Zes keuzes uit [application-design.md](application-design.md) ("Decisions for the user"). Bij elke vraag staat de aanbeveling als optie A. + +## Vraag 1 — Hoe worden de routes opgebouwd? (D1) + +- A) Vijf losse routebestanden `routes/soorten-fotoshoots/{newborn,zwangerschap,gezin,loveshoot,portret}.tsx`, en het overzicht verhuist naar `soorten-fotoshoots/index.tsx`. Het paginaregister, de sitemap, Lighthouse en de getypte links werken zonder aanpassingen. Een ontbrekende pagina wordt een typefout, en de bestaande `#ankers` blijven werken. (aanbevolen) +- B) Eén dynamische route `soorten-fotoshoots/$id.tsx`. Minder bestanden, maar het register, de sitemap, Lighthouse en de typecheck kennen dan maar één sjabloon en moeten de vijf pagina's zelf opbouwen. +- X) Anders (beschrijf hieronder na de [Answer]:-tag) + +[Answer]: A + +## Vraag 2 — Vaste ID van de dienst in de gestructureerde data (D2) + +- A) Naar `https://andreaslop.nl/soorten-fotoshoots/<id>#service`. Het overzicht en de shootpagina verwijzen naar dezelfde dienst, met de shootpagina als `url`. (aanbevolen) +- B) De huidige `…/soorten-fotoshoots#<id>` houden; alleen de `url` wijst naar de shootpagina +- X) Anders (beschrijf hieronder na de [Answer]:-tag) + +[Answer]: A + +## Vraag 3 — Hoe worden conceptteksten gemarkeerd? (D3) + +- A) Een vaste commentaarregel `// DRAFT(CON-ST-03): awaiting Andrea's approval` boven elk concept. Uit die regels wordt de reviewlijst voor Andrea gemaakt. In Build and Test controleert een zoekopdracht dat er vóór de merge geen markering meer staat. (aanbevolen) +- B) Een test die faalt zolang er markeringen zijn (blokkeert dan elke `pnpm check` tot Andrea akkoord geeft) +- C) Een `status: 'draft'`-veld in de content zelf (ook zichtbaar voor een toekomstig CMS) +- X) Anders (beschrijf hieronder na de [Answer]:-tag) + +[Answer]: A + +## Vraag 4 — "Huidige pagina" in menu, footer en kruimelpad (D4) + +Zonder aanpassing kondigt een schermlezer op een shootpagina ook "Soorten fotoshoots" in het menu, in de footer en in het kruimelpad aan als huidige pagina. Dat komt doordat TanStack Router links standaard op het begin van de URL laat matchen. + +- A) Alleen de pagina zelf krijgt `aria-current="page"`. "Soorten fotoshoots" in het menu krijgt op shootpagina's alleen visueel het streepje eronder, en het kruimelpad en de footer matchen exact. (aanbevolen) +- B) "Soorten fotoshoots" krijgt op shootpagina's `aria-current="true"` (betekent: onderdeel van deze sectie) +- C) Het standaardgedrag van TanStack laten staan +- X) Anders (beschrijf hieronder na de [Answer]:-tag) + +[Answer]: A + +## Vraag 5 — Bron van het submenu (D5) + +- A) Het submenu wordt opgebouwd uit `shootTypes`. Dat maakt de hoofdbundel ongeveer 1,5 KB (gzip) groter. In unit 3 meet ik het effect op de mobiele Lighthouse-score van `/`, die al op de 0.8-grens zit. (aanbevolen) +- B) Een aparte kleine lijst `{id, name}` voor het menu (kleinere bundel, maar de namen staan dan op twee plekken) +- X) Anders (beschrijf hieronder na de [Answer]:-tag) + +[Answer]: A + +## Vraag 6 — Duur van de shoot (D6) + +De duur staat nu als vrije tekst in de pakketonderdelen ("1-2 uur fotografie"). + +- A) Een eigen veld per shoot (voor de tijdlijn en de tekstblokken), plus een test die controleert dat het overeenkomt met het pakket. Loveshoot en portret wachten op Andrea. (aanbevolen) +- B) Een gestructureerde duur in `packages.ts`, waar de pakketkaarten ook uit lezen (één bron, maar dan veranderen de prijskaarten op de homepage mee) +- X) Anders (beschrijf hieronder na de [Answer]:-tag) + +[Answer]: A diff --git a/aidlc-docs/features/shoot-type-pages/inception/application-design/application-design.md b/aidlc-docs/features/shoot-type-pages/inception/application-design/application-design.md new file mode 100644 index 0000000..9895764 --- /dev/null +++ b/aidlc-docs/features/shoot-type-pages/inception/application-design/application-design.md @@ -0,0 +1,198 @@ +# Application Design — Shoot Type Pages + +Consolidated design. Details: [components.md](components.md), [component-methods.md](component-methods.md), [services.md](services.md), [component-dependency.md](component-dependency.md). Plan: [application-design-plan.md](../plans/application-design-plan.md). Inputs: [requirements.md](../requirements/requirements.md), [execution-plan.md](../plans/execution-plan.md), design E (`E-Definitief.dc.html`), and the code on master `18e81d0` (verified, not assumed). + +## Overview +Five static routes `/soorten-fotoshoots/<id>` render one template (`ShootPage`) from flat per-shoot content plus shared content. One pure function, `shootPageView`, resolves everything the page shows (steps in fixed order, placeholders, package or "Prijs op aanvraag", photos without repeats, links, breadcrumb). The visible page and the structured data are both built from that view, so they cannot drift. Navigation gets a disclosure submenu built from the shoot types. All new logic is pure and covered by PBT; all new building blocks are generic shared components, with the page-specific composition in `components/shoots/`. + +## Page composition + +```mermaid +graph TD + Intro["A PageIntro + Breadcrumb"] --> S1["B-E StoryBlocks: 4 MediaText bands"] + S1 --> TL["F ProcessTimeline: six steps"] + TL --> Mosaic["G PhotoMosaic, omitted below minimum"] + Mosaic --> Faq["H FaqList"] + Faq --> Pkg["I PackageBlock: price or Prijs op aanvraag"] + Pkg --> Cta["J CallToAction"] + classDef head fill:#e76f51,stroke:#ad533d,color:#000; + classDef story fill:#f4a261,stroke:#b77a49,color:#000; + classDef generic fill:#2a9d8f,stroke:#20766b,color:#000; + classDef perShoot fill:#e9c46a,stroke:#af9350,color:#000; + classDef cta fill:#b56576,stroke:#884c59,color:#000; + class Intro head; + class S1 story; + class TL generic; + class Mosaic,Faq,Pkg perShoot; + class Cta cta; +``` + +Text alternative: ShootPage stacks the intro with breadcrumb, four story bands, the six-step timeline, the photo mosaic (left out when too few photos), the FAQ, the package block and the closing call to action, lettered A–J as in LAYOUT.md. + +## Route mechanism (O-ST-01) — recommendation D1 + +**Recommended: five static route files in a folder, with the overview moved to the folder's index route.** + +```mermaid +graph TD + Root["__root.tsx"] --> Index["soorten-fotoshoots/index.tsx: overview"] + Root --> N["soorten-fotoshoots/newborn.tsx"] + Root --> Z["soorten-fotoshoots/zwangerschap.tsx"] + Root --> G["soorten-fotoshoots/gezin.tsx"] + Root --> L["soorten-fotoshoots/loveshoot.tsx"] + Root --> P["soorten-fotoshoots/portret.tsx"] + Root --> NF["notFoundComponent: unknown slugs"] + classDef root_node fill:#4CAF50,stroke:#2e7d32,stroke-width:2px,color:#000; + classDef route fill:#9C27B0,stroke:#4a148c,stroke-width:1px,color:#000; + classDef page fill:#f6e05e,stroke:#c05621,stroke-width:1px,color:#000; + classDef guard fill:#FF9800,stroke:#e65100,stroke-width:1px,color:#000; + class Root root_node; + class Index page; + class N,Z,G,L,P route; + class NF guard; +``` + +Text alternative: all six pages are direct children of the root route (no layout route), so the overview never wraps a shoot page, and any other path under the folder falls through to the root not-found page. + +Why, checked against the code: +- **`Record<RoutePath, PageMeta>`**: `RoutePath = keyof FileRoutesByTo`. Static files give five concrete keys, so the compiler forces five `sitePages` entries and `pageHead('/soorten-fotoshoots/newborn')` just works. A `$id` route gives the key `'/soorten-fotoshoots/$id'`: the registry would need a template entry plus an expansion step, and `pageHead`, `webPage` and `canonicalUrl` take a `RoutePath` that would no longer be a real URL. +- **Registry test**: `app.test.tsx` compares `Object.keys(sitePages)` with `router.routesByPath`. With `$id` that list contains the template, so the test would need rewriting; with static files it passes unchanged (the index route's `'/soorten-fotoshoots/'` is trimmed to `'/soorten-fotoshoots'` by router-core). +- **Sitemap and Lighthouse**: `sitemapXml(pageList(sitePages))` and `indexedPaths` stay plain lists; nothing to expand. +- **Typed links**: `NavItem.to`, `LinkTarget.to` (used by `RichText` links in content) and `homeContent.about.link` are `RoutePath`. With static routes, `shootPagePath(id)` returns a literal that is a `RoutePath`; with `$id` every link would need `to` + `params`, and `NavItem`/`LinkTarget` would change shape for all pages. +- **Code splitting**: each static route's component (and its own content file) becomes its own chunk; the shared template and shared content form one shared chunk. A `$id` route would put all five pages' content in one chunk, or need a dynamic import per id. +- **Validation**: no route parameter exists, so there is nothing to validate (SECURITY-05); unknown slugs hit the root `notFoundComponent`. +- **Cost**: five ~20-line files, and adding a shoot type needs a route file. A compile-time check in `lib/shootPages.ts` (`ShootPagePath extends RoutePath`) turns a missing route file into a type error, so it cannot be forgotten (NFR-ST-04). + +Overview restructuring: `git mv routes/soorten-fotoshoots.tsx routes/soorten-fotoshoots/index.tsx`. No `route.tsx` layout (a layout with only `<Outlet/>` adds a level for nothing); not the `soorten-fotoshoots_.newborn.tsx` un-nesting syntax (it keeps the old file but spreads the pages over oddly named files with `_` in their route ids). The article ids stay, so `/soorten-fotoshoots#newborn` keeps working. + +## Decisions + +| # | Decision | Alternatives and rationale | +|---|---|---| +| D1 | Five static route files + overview as `soorten-fotoshoots/index.tsx` | See above. `$id`: one file but breaks the registry's and links' types. **For the user.** | +| D2 | Service `@id` = `https://andreaslop.nl/soorten-fotoshoots/<id>#service`, used by both the overview `ItemList` and the shoot page; `url` = the shoot page | Keep `/soorten-fotoshoots#<id>`: no change for crawlers, but the entity's id would point at the overview while its page is elsewhere. The site is new, so changing it now costs nothing. **For the user.** | +| D3 | Drafts marked with one fixed comment, `// DRAFT(CON-ST-03): awaiting Andrea's approval`, above each drafted field (content files and `sitePages.ts`); a review list for Andrea is generated from the content during Construction; the gate is a step in Build and Test: `rg "DRAFT\(CON-ST-03\)" web/src` must be empty before merge | (b) a test that fails while markers exist: blocks every `pnpm check` until approval, which the per-unit checks need to pass. (c) a typed `draft()` wrapper or `status` field: changes the content shape the API will deliver. The Gezin overview draft comment moves to the same marker. **For the user.** | +| D4 | Current state: `aria-current="page"` only on the exact page. The parent "Soorten fotoshoots" gets the same underline through `sectionCurrent` while a shoot page is open; the breadcrumb and footer links use exact matching | TanStack `Link` marks a link active (and adds `aria-current="page"`) when the location starts with its path, so today, unchanged, the nav parent, the footer link and the breadcrumb link would all say "current page" on a shoot page. Alternative: `aria-current="true"` on the parent. **For the user.** | +| D5 | Nav children derived from `shootTypes` in `navigation.ts` (single source); this moves the shoot type texts into the main bundle (~1.5 KB gzip); unit 3 measures `/` mobile Lighthouse (borderline 0.8) | A small `{ id, name }` list in content that `shootTypes` and the nav both use: smaller bundle, but splits the shoot type in two. **For the user.** | +| D6 | Shoot duration is a per-shoot field in the shoot page content; for shoots with a package a content test checks that the package's features name the same duration | Structured `duration` in `PricingPackage`: one source, but changes the price cards and the package shape. **For the user.** | +| D7 | Content: one file per shoot `content/shootPages/<id>.ts` + `content/shootPageShared.ts`; shared FAQ items are exported constants included in the per-shoot lists | One `Record<ShootTypeId, ShootPageContent>` file: compile-time completeness, but every page's chunk carries all five; completeness is covered by the registry test instead | +| D8 | Placeholders `{reactietermijn}`, `{aanbetaling}`, `{locatie}`, `{duur}`, `{opleverduur}` in shared texts, filled by `fillPlaceholders` | Composing texts in components would put Dutch wording in code; placeholders keep the wording in content and the figures in one place (NFR-ST-04), as the contact page already does | +| D9 | `shootPageView` resolves the whole page; `ShootPage` and its sections are presentational | Rules spread over components would be hard to test with PBT and could disagree with the JSON-LD | +| D10 | Reuse `PageIntro` with an optional `breadcrumb` slot and `titleId`; new generic `Breadcrumb`, `ProcessTimeline`, `PhotoMosaic`, `FaqList`, `PackageBlock`; page parts `ShootPage`, `StoryBlocks`, `ProcessIcons` in `components/shoots/` | Justified per component in components.md | +| D11 | FAQ as native `details`/`summary` | Chakra `Accordion`: more JS and a slot recipe, no a11y gain | +| D12 | Desktop submenu: parent stays a link, separate toggle button, disclosure pattern; no hover opening | Hover is optional (FR-ST-10) and easy to trigger by accident; can be added later on top of click | +| D13 | Structured data: one script with `WebPage` (`mainEntity` Service, `breadcrumb` BreadcrumbList) and one `FAQPage` script (`isPartOf` the WebPage) when there are FAQ items, all via `StructuredData` → `jsonLdScript` | One `@graph`: equally valid, but breaks the one-object-per-script pattern the other pages use | +| D14 | A photo appears once per page: `shootPageView` drops mosaic photos already used by a story block or the package block (design E repeats `f41a8700`) | Content discipline only: a later data change could repeat a photo; the content test still checks the real data | +| D15 | Mosaic minimum proposed at 2 photos; confirmed in FD unit 2. Loveshoot and Portret have only their main and detail photo, which the story and package blocks are likely to use, so with D14 their mosaic is left out until Andrea delivers more photos (the page still has a valid outline) | A minimum of 1 would show a lone photo as "Impressie" | + +## Content model in short +Per shoot (`ShootPageContent`): intro, four `StoryBlock`s (eyebrow, h2, `RichText` paragraphs, optional `ContentImage`), `process.location`/`duration`/`deliveryTime`, `photos.title` + ordered `images`, `faq.title` + 3–5 `FaqItem`s, `offer.eyebrow`/`title`, `closing`. Shared (`ShootPageShared`): breadcrumb labels, the six step titles and texts by `ProcessStepId`, `deposit.amount` (50) and note, eyebrows, FAQ lead, offer button labels and "Prijs op aanvraag" texts, shared FAQ items. Unchanged: `ShootType`, `packages`, `siteContent.contactForm.replyTime`. Adding photos is a data-only change (append a `ContentImage`). Drafts: D3. Full types: component-methods.md. + +## File ownership per unit +Units 2 and 3 run in parallel after unit 1; every file has one owner among them. "Edit" for a unit-1 file means a later sequential change by unit 2, which is safe because unit 3 never touches it. + +| Path (under `web/` unless noted) | Unit 1 | Unit 2 | Unit 3 | +|---|---|---|---| +| `src/routes/soorten-fotoshoots/index.tsx` (moved), `newborn/zwangerschap/gezin/loveshoot/portret.tsx`, `-shootPageSources.ts` | create | — | — | +| `src/routeTree.gen.ts` (generated) | regenerate | — | — | +| `src/content/types.ts` | add types | add a field only if FD needs it | — | +| `src/content/shootPages/*.ts`, `shootPageShared.ts` | create (drafts) | edit texts and photo selection | — | +| `src/content/shootTypes.ts` | draft marker only | — | — | +| `src/lib/shootPages.ts`, `shootPackage.ts`, `fillPlaceholders.ts`, `richTextToPlain.ts`, `shootPageView.ts` + tests; `shootLinks.ts` + test | create / change | `MOSAIC_MIN_PHOTOS` only | — | +| `src/seo.ts`, `src/seo.test.ts` | change | — | — | +| `src/sitePages.ts` | five entries | `ogImage` fields | — | +| `lighthouserc.cjs` | five paths ×2 lists | — | — | +| `src/app.test.tsx` | registry, not-found, extract `renderApp` | — | — | +| `src/test/renderApp.tsx` (new, extracted) | create | — | — | +| `src/test/arbitraries.ts` | add generators | append only | — | +| `src/components/StructuredData/*` | create | — | — | +| `src/components/shoots/ShootPage/*` | shell | sections | — | +| `src/components/shoots/{StoryBlocks,ProcessIcons}/*`, `ShootBlock/*` | — | create / change | — | +| `src/components/{Breadcrumb,ProcessTimeline,PhotoMosaic,FaqList,PackageBlock}/*`, `PageIntro/*` | — | create / change | — | +| `src/components/MediaText/*` (additive optional `mediaSize="medium"`; approved deviation, unit 2 FD Q8 = A) | — | change | — | +| `src/components/CallToAction/*` (additive optional `tone`; approved deviation, unit 2 FD Q8 = A) | — | change | — | +| `src/lib/mosaicLayout.ts` + test | — | create | — | +| `src/shootPages.test.tsx` (route-level tests) | — | create | — | +| `src/theme.ts` | — | only if a token is needed | — | +| `public/og-<id>.jpg` ×5 | — | create | — | +| `LAYOUT.md`, `.ai/layout-conventions.md` (repo root) | — | change | — | +| `src/navigation.ts`, `src/navigation.test.ts` | — | — | change | +| `src/lib/shootNavItems.ts`, `src/lib/navCurrent.ts` + tests | — | — | create | +| `src/lib/navMenuState.ts` + test (pure `navMenuReducer`; approved deviation, unit 3 FD Q6 = A) | — | — | create | +| `src/components/NavigationBar/*` (incl. new `NavSubmenu`, `MobileNavGroup`, `ChevronIcon`) | — | — | change / create | +| `src/components/Footer/Footer.tsx` + test (exact matching, D4) | — | — | change | +| `src/hooks/useDismiss.ts` + test | — | — | create | +| `src/navSubmenu.test.tsx` (route-change closing in the real app) | — | — | create | +| `aidlc-docs/_shared/reverse-engineering/*` (repo root) | own lines | lines handed to the orchestrator | lines handed to the orchestrator | +| `aidlc-docs/features/shoot-type-pages/construction/<unit>/` | own folder | own folder | own folder | +| `aidlc-state.md`, `audit.md`, `active-features.md` | orchestrator | orchestrator | orchestrator | + +**Disjointness of units 2 and 3**: no row has both a unit-2 and a unit-3 entry. Unit 3 reads `lib/shootPages.ts`, `content/shootTypes.ts`, `test/arbitraries.ts` (import only) and `theme.ts` tokens, and changes none of them. Unit 2 does not touch `navigation.ts`, `NavigationBar/`, `Footer/` or `hooks/`. The reverse-engineering files are the only shared documents; the orchestrator writes both units' lines after both are done. + +**Hot files** (NFR-ST-07): `sitePages.ts`, `lighthouserc.cjs`, `seo.ts`, `content/types.ts`, `shootTypes.ts`, `routeTree.gen.ts`, `app.test.tsx`, `test/arbitraries.ts` (unit 1, with unit 2 sequentially for a few); `navigation.ts`, `NavigationBar/` (unit 3 only); `LAYOUT.md` (unit 2 only); `_shared/reverse-engineering/`, `active-features.md` (orchestrator). + +## Risks found in the code +1. **Fuzzy active links** (`@tanstack/react-router` 1.170 `resolveIsActive`): without `exact`, a link is active when the location starts with its path plus `/`, and active links get `aria-current="page"`. On a shoot page the nav parent, the footer's "Soorten fotoshoots" and the breadcrumb's middle link would all announce "current page". Handled by D4 (exact matching where needed, `sectionCurrent` for the visual). +2. **Route moves need the generator**: `routeTree.gen.ts` is generated by the Vite plugin; moving the overview to `soorten-fotoshoots/index.tsx` changes its `createFileRoute` string to `'/soorten-fotoshoots/'`. The worktree has no `node_modules` yet, so unit 1 starts with `pnpm install` and lets the plugin rewrite the file rather than editing it by hand. +3. **Lighthouse sync test compares order**: `app.test.tsx` checks `lighthouseConfig.indexedPaths` with `toEqual` against `sitePages` order. The five entries go right after `'/soorten-fotoshoots'` in both files, in `shootTypes` order. +4. **Auto code splitting needs inline route options**: a factory such as `createFileRoute(...)(shootRoute('newborn'))` would keep the component and content in the main bundle. Each route file declares `component` itself. +5. **Main bundle growth** from the nav submenu (D5) while `/` mobile performance is at its 0.8 exception. +6. **Mobile menu overflow**: `MobileNav` centres its list in a fixed box with the body scroll locked; five extra items can be cut off on short phones (FR-ST-10). Unit 3 makes it scroll. +7. **Desktop nav width at `lg` (1024 px)**: five uppercase, letter-spaced items with `mx=4` plus a new toggle button; check that it fits at 1024 px in FD unit 3. +8. **Duration duplicated as free text**: package features ("1-2 uur fotografie") and the new per-shoot duration (D6). +9. **`MediaText` requires an image**: a story block without a photo cannot use it; `StoryBlocks` renders a text-only column instead (no change to `MediaText`). +10. **The overview's "no price" invariant** in `seo.test.ts` must keep holding for `shootServices`; the Offer exists only on the shoot page Service. +11. **CI duration**: ten more Lighthouse runs on the Raspberry Pi runner (accepted in NFR-ST-03). + +## Handed to Functional Design +- Unit 2: timeline breakpoint (proposed the theme's `lg`, since six columns at `md`, 768 px, leave ~110 px per step), mosaic layouts for 2–6 photos and `MOSAIC_MIN_PHOTOS`, which FAQ items start open, story image aspect ratios (design E mixes 4:5, 3:2 and 2:3), photo selection per slot, OG image crops (shown to the user before they are fixed). +- Unit 3: exact keyboard and focus rules, outside-click and route-change closing, panel position and the transparent-header case, mobile group default state and scrolling, 1024 px fit. + +## Decisions for the user + +> **Confirmed by the user (2026-10-30)**: D1–D6 all A, i.e. every recommendation below is accepted as written ([application-design-questions.md](application-design-questions.md)). +1. **D1 Route mechanism** — recommend five static route files under `routes/soorten-fotoshoots/` with the overview moved to `index.tsx`, instead of one `$id` route. +2. **D2 Service id** — recommend moving the Service `@id` to `…/soorten-fotoshoots/<id>#service` (shared by overview and shoot page), instead of keeping `…/soorten-fotoshoots#<id>`. +3. **D3 Draft marking and gate** — recommend one fixed comment marker per drafted field plus a pre-merge `rg` check in Build and Test, instead of a failing test or a `draft()`/`status` field in the content. +4. **D4 "Current page" in menus** — recommend `aria-current="page"` only on the exact page, with a visual-only highlight on the parent "Soorten fotoshoots" (and exact matching in breadcrumb and footer), instead of TanStack's default (parent, footer and breadcrumb all marked as current) or `aria-current="true"` on the parent. +5. **D5 Nav source vs bundle size** — recommend deriving the submenu from `shootTypes` (≈1.5 KB gzip more in the main bundle, measured against the `/` mobile score), instead of a separate small name list. +6. **D6 Shoot duration** — recommend a per-shoot duration field with a consistency test against the package features, instead of a structured duration in `packages.ts`. + +> **Approved deviations (2026-10-30)**: unit 2 adds the optional `mediaSize="medium"` to `MediaText` and the optional `tone` to `CallToAction` (unit 2 FD Q8 = A); unit 3 keeps the menu open/closed state in one pure reducer, `navMenuReducer` in `lib/navMenuState.ts`, instead of per-component `useState` (unit 3 FD Q6 = A). + +## Extension compliance (design level) + +### Security Baseline +| Rule | Status | Rationale | +|---|---|---| +| SECURITY-01 Encryption | N/A | No data stores | +| SECURITY-02 Access logging | N/A | No intermediaries added | +| SECURITY-03 Application logging | N/A | No server-side component; Sentry unchanged | +| SECURITY-04 HTTP headers | Compliant | `config/securityHeaders.ts` untouched; no inline handlers; the only inline scripts are JSON-LD via `StructuredData` (CSP `script-src 'self'` does not apply to `application/ld+json` data blocks, as on the existing pages) | +| SECURITY-05 Input validation | Compliant | No route parameters (D1); `shootIdFromSlug`/`shootIdFromPath` accept only known ids and never throw; outgoing `?pakket=` only from `shootPackage` (visible packages); the contact page's existing validation is unchanged | +| SECURITY-06 Least privilege | N/A | No IAM | +| SECURITY-07 Network | N/A | No network configuration | +| SECURITY-08 Access control | N/A | Public content | +| SECURITY-09 Hardening | Compliant | No debug output; no placeholder content in production: the D3 gate blocks the merge while draft markers exist; design E's bracketed placeholders ("[een korte checklist]") are not copied into content (CON-ST-04) | +| SECURITY-10 Supply chain | Compliant | No new dependencies; icons as inline SVG; native `details` instead of extra components; lockfile unchanged | +| SECURITY-11 Secure design | Compliant | Content rendered as text and typed router links (`RichText`); `dangerouslySetInnerHTML` only inside `StructuredData` with `jsonLdScript`; no e-mail address in structured data (PBT invariant) | +| SECURITY-12 Authentication | N/A | No authentication | +| SECURITY-13 Integrity | Compliant | All photos and OG images bundled or in `public/`; no CDN or embeds | +| SECURITY-14 Alerting | N/A | No server-side component | +| SECURITY-15 Fail-safe | Compliant | Unknown slug → root not-found; missing shoot type or mismatched content → `NotFound`; invalid/removed package → "Prijs op aanvraag"; too few photos → no mosaic; no FAQ items → no FAQ section and no FAQPage | + +No blocking security findings. + +### Property-Based Testing +| Rule | Status | Rationale | +|---|---|---| +| PBT-01 Identification | Compliant (unit 1), planned (units 2, 3) | Properties for every new pure function listed in services.md; units 2 and 3 confirm theirs in Functional Design | +| PBT-02 Round trip | Planned | `shootIdFromSlug`/`shootIdFromPath` ∘ `shootPagePath`; `JSON.parse ∘ jsonLdScript` for every new builder | +| PBT-03 Invariants | Planned | `shootPageView`, `shootPackage`, `breadcrumbList`, `faqPage`, `shootService`, `richTextToPlain`, `shootNavItems`, `navCurrent`, `mosaicLayout` (services.md) | +| PBT-04 Idempotency | Planned | `fillPlaceholders`/`fillRichText`: filling twice equals once | +| PBT-05 Oracle | N/A | No reference implementation; `richTextToPlain` is checked against its definition, not an oracle | +| PBT-06 Stateful | Planned (unit 3) | `navMenuReducer` (unit 3 FD Q6 = A, approved): model-based event sequences with invariants I1–I4 (services.md) | +| PBT-07 Generators | Planned | `shootPageContent`, `shootPageShared`, hostile slug strings in `src/test/arbitraries.ts` | +| PBT-08 Shrinking/reproducibility | Compliant | fast-check shrinking; seed logging in `config/testSeed.ts` | +| PBT-09 Framework | Compliant | fast-check already configured | +| PBT-10 Complementary | Compliant | Example-based route, component, axe and registry-consistency tests alongside (services.md "Not PBT") | diff --git a/aidlc-docs/features/shoot-type-pages/inception/application-design/component-dependency.md b/aidlc-docs/features/shoot-type-pages/inception/application-design/component-dependency.md new file mode 100644 index 0000000..6cef470 --- /dev/null +++ b/aidlc-docs/features/shoot-type-pages/inception/application-design/component-dependency.md @@ -0,0 +1,110 @@ +# Component Dependencies — Shoot Type Pages + +## Shoot page dependency graph + +```mermaid +graph TD + Route["routes/soorten-fotoshoots/id x5"] --> Sources["-shootPageSources"] + Route --> ViewFn["lib/shootPageView"] + Route --> Graph["seo: shootPageGraph"] + Route --> SD["StructuredData"] + Route --> ShootPage["shoots/ShootPage"] + ViewFn --> Paths["lib/shootPages"] + ViewFn --> Pkg["lib/shootPackage"] + ViewFn --> Links["lib/shootLinks"] + ViewFn --> Fill["lib/fillPlaceholders"] + Graph --> Rich2Plain["lib/richTextToPlain"] + Graph --> Paths + ShootPage --> Intro["PageIntro + breadcrumb slot"] + Intro --> Crumb["Breadcrumb"] + ShootPage --> Stories["shoots/StoryBlocks"] + Stories --> MediaText["MediaText"] + ShootPage --> Timeline["ProcessTimeline"] + ShootPage --> Icons["shoots/ProcessIcons"] + ShootPage --> Mosaic["PhotoMosaic"] + ShootPage --> Faq["FaqList"] + Faq --> RichP["RichParagraph"] + ShootPage --> PkgBlock["PackageBlock"] + PkgBlock --> MediaText + ShootPage --> Cta["CallToAction"] + ShootPage --> Section["PageSection + SectionHeading"] + Overview["routes/soorten-fotoshoots/index"] --> Block["shoots/ShootBlock"] + Block --> Paths + classDef route fill:#f6e05e,stroke:#c05621,stroke-width:1px,color:#000; + classDef logic fill:#9ae6b4,stroke:#2f855a,stroke-width:1px,color:#000; + classDef newcomp fill:#FFA726,stroke:#E65100,stroke-width:1px,color:#000; + classDef changed fill:#63b3ed,stroke:#2b6cb0,stroke-width:1px,color:#000; + classDef existing fill:#e2e8f0,stroke:#4a5568,stroke-width:1px,color:#000; + class Route,Sources,Overview route; + class ViewFn,Paths,Pkg,Fill,Rich2Plain,Graph logic; + class SD,ShootPage,Crumb,Stories,Timeline,Icons,Mosaic,Faq,PkgBlock newcomp; + class Intro,Block,Links changed; + class MediaText,RichP,Cta,Section existing; +``` + +Text alternative: each shoot route uses the shared sources, the view builder (with the path, package, link and placeholder helpers) and seo's shootPageGraph, then renders StructuredData and ShootPage; ShootPage composes PageIntro with Breadcrumb, StoryBlocks on MediaText, ProcessTimeline with icons, PhotoMosaic, FaqList on RichParagraph, PackageBlock on MediaText and CallToAction; the overview's ShootBlock links to the shoot pages via the path helper (orange new, blue changed, grey reused, green pure logic, yellow routes). + +## Navigation dependency graph + +```mermaid +graph TD + Nav["navigation.ts mainNav"] --> NavItems["lib/shootNavItems"] + NavItems --> Shoots["content/shootTypes"] + NavItems --> Paths["lib/shootPages"] + Bar["NavigationBar"] --> Nav + Bar --> Submenu["NavSubmenu"] + Bar --> NavLink["NavLink sectionCurrent"] + Submenu --> NavLink + Submenu --> Dismiss["hooks/useDismiss"] + Submenu --> Chevron["ChevronIcon"] + Submenu --> Current["lib/navCurrent"] + Mobile["MobileNav"] --> Nav + Mobile --> Group["MobileNavGroup"] + Group --> Chevron + Group --> Current + Footer["Footer exact match"] --> FooterNav["navigation.ts footerNav"] + classDef logic fill:#9ae6b4,stroke:#2f855a,stroke-width:1px,color:#000; + classDef newcomp fill:#FFA726,stroke:#E65100,stroke-width:1px,color:#000; + classDef changed fill:#63b3ed,stroke:#2b6cb0,stroke-width:1px,color:#000; + classDef existing fill:#e2e8f0,stroke:#4a5568,stroke-width:1px,color:#000; + class NavItems,Current,Paths logic; + class Submenu,Group,Dismiss,Chevron newcomp; + class Nav,Bar,NavLink,Mobile,Footer changed; + class Shoots,FooterNav existing; +``` + +Text alternative: mainNav gets its shoot children from shootNavItems (shoot types plus the path helper); NavigationBar renders NavSubmenu (NavLink, useDismiss, ChevronIcon, navCurrent) and MobileNav renders MobileNavGroup; the Footer only switches its links to exact matching. + +The only link between the two graphs is `lib/shootPages` (unit 1), which both units read and neither changes. + +## Dependency matrix + +| Component | Depends on | Used by | +|---|---|---| +| `lib/shootPages` | `ShootTypeId`, `RoutePath` (types), `isShootTypeId` | `shootPageView`, `seo.ts`, `ShootBlock`, `shootNavItems`, tests | +| `lib/shootPackage` | `visiblePackages` | `shootLinks`, `shootPageView` | +| `lib/fillPlaceholders` | — | `shootPageView` | +| `lib/richTextToPlain` | `RichText` (type) | `seo.faqPage` | +| `lib/shootPageView` | the four helpers above, `formatPrice`, `shootPortfolioLink` | shoot routes, tests | +| `seo.ts` additions | `canonicalUrl`, `webPage`, `areaServed`, `shootPages`, `richTextToPlain` | shoot routes, overview route | +| `StructuredData` | `jsonLdScript` | shoot routes, overview route | +| `ShootPage` | the section components, `ShootPageView` (type) | shoot routes | +| `StoryBlocks` | `PageSection`, `MediaText`, `RichParagraph`, `Eyebrow` | `ShootPage` | +| `Breadcrumb` | `RouterLink`, Chakra `Link` | `PageIntro` slot via `ShootPage` | +| `ProcessTimeline` | Chakra primitives, theme tokens | `ShootPage` | +| `PhotoMosaic` | `DeferredImage`, `mosaicLayout` | `ShootPage` | +| `FaqList` | `RichParagraph` | `ShootPage` | +| `PackageBlock` | `MediaText`, `formatPrice`, `Eyebrow` | `ShootPage` | +| `ShootBlock` | + `shootPagePath` | `ShootList` | +| `shootNavItems` | `shootPagePath`, `ShootType` | `navigation.ts` | +| `navCurrent` | `NavItem` (type) | `NavSubmenu`, `MobileNavGroup`, `NavigationBar` | +| `NavSubmenu` | `NavLink`, `useDismiss`, `ChevronIcon`, `navCurrent`, `useRouterState` | `NavigationBar` | +| `MobileNavGroup` | `RouterLink`, `ChevronIcon`, `navCurrent` | `MobileNav` | + +## Communication +Props only, top-down; no context and no global state, as on every page so far. The route builds one view object; components render it. Navigation reads the router's location for current state and route-change closing. Links are typed router links: shoot page paths are concrete `RoutePath` literals, so a wrong path is a type error, and `?pakket=` is only ever built from a visible package id. + +## Import cycles and bundles +- `content/types.ts` imports the `RoutePath` type from `navigation.ts`; `navigation.ts` will import `content/shootTypes.ts` (a value) and `lib/shootNavItems.ts`. Type-only imports are erased, so no runtime cycle exists; keep the `import type` in `types.ts`. +- `navigation.ts` is in the main bundle (header and footer), so importing `shootTypes` moves its texts (~4 KB raw, roughly 1.5 KB gzip; image imports are URL strings) into the main bundle (decision D5). +- Everything else new is reachable only from the shoot routes and is split off with them. diff --git a/aidlc-docs/features/shoot-type-pages/inception/application-design/component-methods.md b/aidlc-docs/features/shoot-type-pages/inception/application-design/component-methods.md new file mode 100644 index 0000000..7cea2bf --- /dev/null +++ b/aidlc-docs/features/shoot-type-pages/inception/application-design/component-methods.md @@ -0,0 +1,285 @@ +# Component Methods — Shoot Type Pages + +Types, props and function signatures. Business rules in detail (timeline alternation and breakpoint, mosaic minimum and layouts, FAQ open state, submenu interaction) follow in Functional Design for units 2 and 3. Unit 1 has no Functional Design, so the rules of its pure functions are stated here in one line each, and its PBT properties are listed in services.md. + +## Content types (`content/types.ts`, unit 1) + +```ts +// One block of the shoot page story (FR-ST-03) +export interface StoryBlock { + id: string; // stable slug, e.g. 'verwachten'; used in the heading id + eyebrow: string; + title: string; + paragraphs: RichText[]; // one or more; RichText so a block can link inline + image?: ContentImage; // without one the block is text only +} + +// One question of the FAQ (FR-ST-06); answer pieces may contain placeholders +export interface FaqItem { + id: string; // stable slug, unique per page + question: string; + answer: RichText; +} + +// The six fixed steps, in this order (FR-ST-04) +export type ProcessStepId = + 'aanvragen' | 'datum' | 'aanbetaling' | 'shoot' | 'bewerking' | 'oplevering'; + +export interface ProcessStepContent { + title: string; + text: string; // may contain placeholders, see below +} + +export interface DepositInfo { + amount: number; // whole euros: 50 + note: string; // 'Aanbetaling {aanbetaling}, restbedrag na de shoot.' +} + +// The same on every shoot page (FR-ST-11, shared part) +export interface ShootPageShared { + breadcrumb: { label: string; home: string; overview: string }; // 'Kruimelpad', 'Home', 'Soorten fotoshoots' + process: { + eyebrow: string; // 'Zo werkt het' + title: string; // 'Van aanvraag tot online galerij' + lead: string; + steps: Record<ProcessStepId, ProcessStepContent>; + }; + deposit: DepositInfo; + photos: { eyebrow: string }; // 'Impressie' + faq: { eyebrow: string; lead: RichText }; + offer: { + bookLabel: string; // 'Boek dit pakket' + askLabel: string; // 'Eerst een vraag stellen' + onRequest: { price: string; text: string; linkLabel: string }; // 'Prijs op aanvraag', … + }; +} + +// One shoot page (FR-ST-11, per-shoot part); one file per shoot +export interface ShootPageContent { + id: ShootTypeId; // must match the route that imports it (test) + intro: { eyebrow: string; title: string; text: string }; + stories: StoryBlock[]; // four per shoot (content test) + process: { + location: string; // step 2: 'Een newbornshoot is bij jou thuis.' + duration: string; // step 4: '1-2 uur fotografie, in het tempo van jullie baby.' + deliveryTime: string; // step 5 and shared FAQ: '2–3 weken' + }; + photos: { title: string; images: ContentImage[] }; // ordered; adding one is a data-only change + faq: { title: string; items: FaqItem[] }; // 3–5, shared constants mixed in + offer: { eyebrow: string; title: string }; // 'Pakket newborn', 'Wat zit er in een newbornshoot' + closing: { title: string; lead: RichText; buttonLabel: string }; +} +``` + +**Placeholders** (one mechanism, extending the existing `{reactietermijn}` of the contact page): `{reactietermijn}` ← `siteContent.contactForm.replyTime`, `{aanbetaling}` ← `formatPrice(shared.deposit.amount)`, `{locatie}`, `{duur}`, `{opleverduur}` ← the shoot's `process` fields. They may appear in step texts, the deposit note and FAQ answers. Link targets are never stored in content (FR-ST-11); they are derived in `shootPageView`. + +**Draft marker** (CON-ST-03, decision D3): a line comment directly above each drafted field or block, always the same text: `// DRAFT(CON-ST-03): awaiting Andrea's approval`. `rg -n "DRAFT\(CON-ST-03\)" web/src` lists every draft. + +## Pure functions (`lib/`) + +```ts +// lib/shootPages.ts (unit 1) +export const SHOOT_TYPES_PATH = '/soorten-fotoshoots'; +export const SHOOT_TYPE_IDS: readonly ShootTypeId[]; // all five, checked exhaustive at compile time +export type ShootPagePath = `/soorten-fotoshoots/${ShootTypeId}`; +// Compile-time guard: every ShootTypeId needs a route file, otherwise ShootPagePath is no RoutePath +type EveryShootHasARoute = Assert<ShootPagePath extends RoutePath ? true : false>; + +export function shootPagePath(id: ShootTypeId): ShootPagePath; +// The inverse: a known id for exactly a known slug, else undefined; never throws +export function shootIdFromSlug(slug: unknown): ShootTypeId | undefined; // reuses isShootTypeId +// '/soorten-fotoshoots/<slug>' (one trailing slash tolerated) → id, anything else → undefined +export function shootIdFromPath(pathname: string): ShootTypeId | undefined; + +// lib/shootPackage.ts (unit 1) +// The visible package the shoot points to, else undefined (removed, invalid, none) +export function shootPackage( + shoot: ShootType, + packages: readonly PricingPackage[], +): PricingPackage | undefined; + +// lib/shootLinks.ts (unit 1, same results as today) +export function shootContactLink(shoot: ShootType, packages: readonly PricingPackage[]): + { to: '/contact'; search: { pakket: string } } | { to: '/contact' }; // now via shootPackage + +// lib/fillPlaceholders.ts (unit 1) +// Replaces every {name} whose name is in values; other text stays as it is +export function fillPlaceholders(text: string, values: Readonly<Record<string, string>>): string; +export function fillRichText(text: RichText, values: Readonly<Record<string, string>>): RichText; + +// lib/richTextToPlain.ts (unit 1) +// The visible text: string pieces as they are, links by their text +export function richTextToPlain(text: RichText): string; + +// lib/shootPageView.ts (unit 1; MOSAIC_MIN_PHOTOS confirmed in FD unit 2) +export const PROCESS_STEP_ORDER: readonly ProcessStepId[]; // the fixed order of FR-ST-04 +export const MOSAIC_MIN_PHOTOS: number; // proposed 2 + +export interface BreadcrumbItem { label: string; to: RoutePath } +export interface ProcessStep { id: ProcessStepId; title: string; text: string } + +export interface ShootPageSources { + shootTypes: readonly ShootType[]; + packages: readonly PricingPackage[]; + shared: ShootPageShared; + site: SiteContent; + portfolioShoots: readonly ShootTypeId[]; // types that link to the portfolio (live + has photos) +} + +export interface ShootPageView { + id: ShootTypeId; + path: ShootPagePath; + shoot: ShootType; + breadcrumb: { label: string; items: BreadcrumbItem[] }; // last item = this page + intro: ShootPageContent['intro']; + stories: StoryBlock[]; // placeholders filled + process: { eyebrow: string; title: string; lead: string; steps: ProcessStep[] }; // always six, in order + photos?: { // undefined below MOSAIC_MIN_PHOTOS + eyebrow: string; title: string; images: ContentImage[]; // no photo used elsewhere on the page + portfolioLink?: ReturnType<typeof shootPortfolioLink>; + }; + faq?: { eyebrow: string; title: string; lead: RichText; items: FaqItem[] }; // undefined when no items + offer: { + eyebrow: string; title: string; image: ContentImage; // the shoot's detail photo, else its main photo + pkg?: PricingPackage; // present iff shootPackage() is + onRequest: ShootPageShared['offer']['onRequest']; + bookLabel: string; askLabel: string; + bookLink: ReturnType<typeof shootContactLink>; + askLink: { to: '/contact' }; + depositNote: string; + }; + closing: { title: string; lead: RichText; buttonLabel: string; link: ReturnType<typeof shootContactLink> }; +} + +// undefined when the shoot type is missing from shootTypes or page.id !== id (fail safe → not-found) +export function shootPageView( + id: ShootTypeId, + page: ShootPageContent, + sources: ShootPageSources, +): ShootPageView | undefined; + +// lib/mosaicLayout.ts (unit 2, shape fixed in FD) +export type MosaicTile = { column: string; row: string; wide: boolean }; +export function mosaicLayout(count: number): MosaicTile[]; + +// lib/shootNavItems.ts (unit 3) +export function shootNavItems(shoots: readonly ShootType[]): NavItem[]; // one per shoot, in order + +// lib/navCurrent.ts (unit 3) +// exact: pathname is item.to; section: pathname is item.to or one of its children +export function isItemCurrent(item: NavItem, pathname: string): boolean; +export function isSectionCurrent(item: NavItem, pathname: string): boolean; +``` + +## SEO builders (`seo.ts`, unit 1) + +```ts +// One stable id per shoot service, shared by the overview's ItemList and the shoot page (SEO-ST-03, D2) +export function shootServiceId(id: ShootTypeId): string; // `${siteUrl}/soorten-fotoshoots/<id>#service` + +// The Service: name/serviceType = shootLabel, description = paragraphs[0], image, provider, areaServed, +// url = the shoot page; offers (Offer, price, 'EUR') only when pkg is given +export function shootService(shoot: ShootType, site: SiteContent, pkg?: PricingPackage): object; + +// Unchanged signature; its items now come from shootService(shoot, site) without pkg +export function shootServices(shoots: readonly ShootType[], site: SiteContent): object; + +// positions 1..n, item = absolute URL of each path, name = label +export function breadcrumbList(items: readonly BreadcrumbItem[]): object; + +// One Question per item in order, acceptedAnswer.text = richTextToPlain(answer); undefined for no items +export function faqPage(path: RoutePath, items: readonly FaqItem[]): object | undefined; + +// What a shoot page renders: WebPage (mainEntity = shootService with the view's pkg, +// breadcrumb = breadcrumbList) and, when there are FAQ items, a FAQPage (isPartOf the WebPage) +export function shootPageGraph(view: ShootPageView, site: SiteContent): object[]; +``` + +## Components + +```ts +// components/StructuredData (unit 1) +type StructuredDataProps = { data: unknown }; // rendered via jsonLdScript only + +// components/PageIntro (unit 2, additive) +type PageIntroProps = { + title: string; + eyebrow?: string; + titleId?: string; // new: id of the h1; the section is then named by it + breadcrumb?: ReactNode; // new: rendered above the eyebrow + children?: ReactNode; +}; + +// components/Breadcrumb (unit 2) +type BreadcrumbProps = { + label: string; // accessible name of the nav: 'Kruimelpad' + items: readonly BreadcrumbItem[]; // last one is the current page +}; + +// components/ProcessTimeline (unit 2) +type ProcessTimelineProps = { + steps: readonly { id: string; title: string; text: string; icon: ReactNode }[]; + 'data-testid'?: string; +}; + +// components/PhotoMosaic (unit 2) +type PhotoMosaicProps = { images: readonly ContentImage[]; 'data-testid'?: string }; + +// components/FaqList (unit 2) +type FaqListProps = { + items: readonly FaqItem[]; + openCount?: number; // how many items start open (FD decides the default) +}; + +// components/PackageBlock (unit 2) +type PackageBlockProps = { + titleId: string; + eyebrow: string; + title: string; + image: ContentImage; + frameColor?: FrameColor; + pkg?: PricingPackage; // present: price + features; absent: onRequest texts + onRequest: { price: string; text: string }; + note?: string; // the deposit note + children: ReactNode; // the actions: primary LinkButton + secondary link +}; + +// components/shoots/ShootPage (shell unit 1, sections unit 2) +type ShootPageProps = { view: ShootPageView }; + +// components/shoots/StoryBlocks (unit 2) +type StoryBlocksProps = { + stories: readonly StoryBlock[]; + frameColor: FrameColor; + idPrefix: string; // heading ids unique per page, e.g. 'newborn-story' +}; + +// components/shoots/ProcessIcons (unit 2) +export const processIcons: Record<ProcessStepId, () => JSX.Element>; + +// components/shoots/ShootBlock (unit 2, props unchanged; adds the "Lees meer" link) + +// navigation.ts (unit 3) +export interface NavItem { + to: RoutePath; + label: string; + children?: readonly NavItem[]; // new +} + +// components/NavigationBar/NavSubmenu (unit 3) +type NavSubmenuProps = { item: NavItem & { children: readonly NavItem[] }; id: string }; +// internal: open state (useState<boolean>), toggle(), close({ focusToggle }), closes on route change + +// components/NavigationBar/MobileNavGroup (unit 3) +type MobileNavGroupProps = { item: NavItem & { children: readonly NavItem[] }; id: string; onNavigate: () => void }; + +// components/NavigationBar/NavLink (unit 3, additive) +type NavLinkProps = React.ComponentProps<typeof RouterLink> & { sectionCurrent?: boolean }; + +// hooks/useDismiss (unit 3) +export default function useDismiss( + ref: RefObject<HTMLElement | null>, + active: boolean, + onDismiss: (reason: 'escape' | 'outside') => void, +): void; +``` diff --git a/aidlc-docs/features/shoot-type-pages/inception/application-design/components.md b/aidlc-docs/features/shoot-type-pages/inception/application-design/components.md new file mode 100644 index 0000000..8c86175 --- /dev/null +++ b/aidlc-docs/features/shoot-type-pages/inception/application-design/components.md @@ -0,0 +1,139 @@ +# Components — Shoot Type Pages + +Status per component: **new**, **changed** (backwards compatible) or **reused** (unchanged). The unit that owns each one is in brackets; see [application-design.md § File ownership](application-design.md#file-ownership-per-unit). Signatures are in [component-methods.md](component-methods.md). + +Rule carried over from the previous pages: components never import content modules. The route passes content (or a view built from it) as props, so tests can pass any content and the CMS API can replace the modules 1-to-1. + +## Routes (`web/src/routes/soorten-fotoshoots/`) [unit 1] + +### `index.tsx` (moved, behaviour unchanged) +- **Purpose**: the overview page `/soorten-fotoshoots`, moved from `routes/soorten-fotoshoots.tsx` with `git mv`. Without a `soorten-fotoshoots.tsx` or `route.tsx` next to the folder there is no layout route, so the overview never renders a child inside itself (FR-ST-01) and the article anchors `#newborn` … stay as they are (FR-ST-09). +- **Change**: only the route string (`createFileRoute('/soorten-fotoshoots/')`, written by the generator) and the JSON-LD, which now uses the shared Service `@id` (see services.md). The registry key stays `'/soorten-fotoshoots'`: TanStack's `FileRoutesByTo` and `router.routesByPath` both trim the index route's trailing slash (verified in router-core 1.171 `new-process-route-tree.js`), so the existing registry test keeps passing. + +### `newborn.tsx`, `zwangerschap.tsx`, `gezin.tsx`, `loveshoot.tsx`, `portret.tsx` (new) +- **Purpose**: one static route per shoot type, `/soorten-fotoshoots/<id>`. Each file is about 20 lines: `head: () => pageHead('/soorten-fotoshoots/<id>')` and a component that builds the page view from its own content file and renders `StructuredData` + `ShootPage`. +- **Why five files**: see the route decision in application-design.md (D1). The component is declared inline in each file so `autoCodeSplitting` can move it, and the shoot's content, out of the main bundle (a route options object produced by a factory function would not be split). + +### `-shootPageSources.ts` (new) +- **Purpose**: the inputs every shoot page shares (shoot types, packages, shared shoot page content, site content, which types link to the portfolio), assembled once. The `-` prefix keeps the route generator from treating it as a route. Only the five shoot routes import it. + +## Shared building blocks (`web/src/components/`) + +### `StructuredData` (new) [unit 1] +- **Purpose**: renders one `<script type="application/ld+json">` from a data object through `jsonLdScript`. +- **Why new**: today the overview and other routes each write `dangerouslySetInnerHTML` themselves. Five more pages would mean five more copies. One component keeps the only `dangerouslySetInnerHTML` use behind the escaping helper (SECURITY-11). Existing routes may move to it; the moved overview route does. + +### `PageIntro` (changed) [unit 2] +- **Purpose**: the page head (eyebrow, the only h1, intro). +- **Change**: optional `breadcrumb?: ReactNode` rendered above the eyebrow, and optional `titleId?: string` that puts an id on the h1 and names the section (`aria-labelledby`), as design E's intro section does. Existing callers pass neither and render exactly as before. +- **Why not a new `ShootPageIntro`**: design E's intro is the same centred block as `.page-head` (max 680 px, eyebrow, h1, intro text). Only the breadcrumb is extra, so a slot is enough. + +### `Breadcrumb` (new) [unit 2] +- **Purpose**: the visible trail Home › Soorten fotoshoots › <shoot> (FR-ST-02): `nav` named "Kruimelpad", an `ol`, links for every item but the last, the last item as text with `aria-current="page"`, and separators that are decorative (`aria-hidden`). +- **Why new**: nothing like it exists yet. It is generic (items in, no shoot knowledge), so future pages can use it. +- **Note**: the links pass `activeOptions={{ exact: true }}`. Without it TanStack's fuzzy matching marks "Soorten fotoshoots" with `aria-current="page"` on every shoot page (see the risks in application-design.md). + +### `ProcessTimeline` (new) [unit 2] +- **Purpose**: an ordered list of steps, each with a decorative icon, an h3 and a short text (FR-ST-04). Horizontal with the texts alternating above and below the line on wide screens, vertical below a theme breakpoint; the DOM order is the reading order in both. +- **Why new**: no step or timeline block exists. It is generic: it takes resolved steps and an icon per step; it knows nothing about shoots, deposits or placeholders. +- **Section frame**: rendered inside `PageSection` with `SectionHeading` (eyebrow "Zo werkt het", h2, lead) by `ShootPage`. + +### `PhotoMosaic` (new) [unit 2] +- **Purpose**: a grid of photos that adapts to their number (design E: one large, one wide, two small on desktop; two columns on phones). All photos use `DeferredImage` with intrinsic width and height. +- **Why new**: `PortfolioGrid` is a masonry grid in reading order for many photos with a lightbox; the mosaic is a fixed composition for 2–6 photos without interaction. Sharing one component would make both worse. + +### `FaqList` (new) [unit 2] +- **Purpose**: questions as native `details`/`summary` disclosures, answers as `RichParagraph` (inline links, no HTML). The answer is in the DOM when collapsed. +- **Why native `details`**: keyboard, state and focus come from the browser, no JavaScript, no new dependency, and nothing to animate (reduced motion is trivially respected). Chakra's `Accordion` would add a slot recipe and its JS to the page chunk for no gain. Which items start open is a Functional Design detail. + +### `PackageBlock` (new) [unit 2] +- **Purpose**: the package block of design direction B (FR-ST-07): detail photo, eyebrow, h2, then either the price (`formatPrice`) with the features, or "Prijs op aanvraag" with a short text; a primary link, a secondary link, and the deposit note. +- **Interface**: the variant is chosen by data (`pkg` present or not), never by a shoot id. Link targets come in as props, already derived. +- **Why new and not `PriceCard`**: `PriceCard` is a narrow centred card in a three-card grid that links to the homepage form. The block here is a two-column `MediaText` layout with two actions and a note. It reuses `formatPrice`, `MediaText` and `LinkButton`, not the card. + +### Reused unchanged +`PageSection`, `SectionHeading`, `MediaText` (`reverse`, `mediaSize`, `frameColor`, `priority`), `FramedImage`, `DeferredImage`, `Reveal`, `CallToAction`, `LinkButton` (`accent`), `RouterLink`, Chakra `Link` (`underline`), `RichParagraph`, `Eyebrow`, `VisuallyHidden`, `NotFound`. + +## Shoot page parts (`web/src/components/shoots/`) [unit 2, shell by unit 1] + +### `ShootPage` (new) +- **Purpose**: the page template for all five shoots, in the order of the page structure: intro with breadcrumb → story blocks → process timeline → photos → FAQ → package → closing call to action. +- **Responsibilities**: composition only. Everything it shows comes from a `ShootPageView` (built by `lib/shootPageView.ts`), so it has no rules of its own: which variant, which photos, which links and which texts are decided before it renders. It gives each section its heading id. +- **Unit split**: unit 1 creates a minimal shell (the intro with the h1, so routes, heads, registry and Lighthouse work end to end); unit 2 adds the sections. + +### `StoryBlocks` (new) +- **Purpose**: the four story blocks (FR-ST-03), each a `PageSection` named by its h2, bands alternating `paper`/`paper.alt`, photo side alternating, photo above the text on phones. +- **Responsibilities**: per block: `MediaText` when the block has a photo (frame colour from the shoot); a plain text column without an empty frame when it has none. The first block's photo gets `priority` (the likely largest paint, NFR-ST-03); all others are deferred. +- **Why new**: the same role as `ShootList` on the overview (a list of `MediaText` bands with alternation). Kept in `shoots/` because the alternation rule and eyebrow/h2 layout belong to this page. + +### `ProcessIcons` (new) +- **Purpose**: six inline SVG icon components, one per process step id (`aria-hidden`, `currentColor`), and a map from step id to icon. No icon library (NFR-ST-02), although `@iconify` is already a dependency. + +### `ShootBlock` (changed) +- **Change**: a third link "Lees meer over de <shootLabel lowercased>" (e.g. "Lees meer over de newbornshoot") to `shootPagePath(shoot.id)`. The visible text is unique per shoot, so no `aria-label` is needed (FR-ST-09). Anchors and the other links stay. + +### Reused unchanged +`ShootList`. + +## Navigation (`web/src/components/NavigationBar/`, `web/src/navigation.ts`) [unit 3] + +### `NavItem` / `mainNav` (changed) +- **Change**: `NavItem` gets `children?: readonly NavItem[]`. `mainNav`'s "Soorten fotoshoots" item gets the five shoot pages as children, built by `shootNavItems(shootTypes)` from the shoot types and `shootPagePath`, so a new shoot type cannot be missed. `footerNav` is unchanged and has no children. + +### `NavSubmenu` (new) +- **Purpose**: desktop (from `lg`) disclosure for an item with children: the parent stays a `NavLink` to the overview; next to it a toggle button (`aria-expanded`, `aria-controls`, accessible name "Submenu Soorten fotoshoots") opens a panel with a plain list of links. Not the ARIA `menu` pattern, not Chakra `Menu` (NFR-ST-01). +- **Responsibilities**: open on click/Enter/Space; close on Escape (focus back to the toggle), on a pointer down outside, on choosing a link and on a route change. Solid panel (`bg`/`fg` tokens) also when the header is transparent over the home hero. Motion only without `prefers-reduced-motion`. + +### `MobileNavGroup` (new) +- **Purpose**: inside `MobileNav`, the parent link plus a toggle that expands the sub-list (`aria-expanded`). Choosing any link closes the whole menu (existing `onClose`). + +### `NavigationBar` (changed) +- Renders `NavSubmenu` for items with children, `NavLink` otherwise. + +### `MobileNav` (changed) +- Renders `MobileNavGroup` for items with children. Scrolls when the content is taller than the screen (today it is centred with `justifyContent="center"` inside a fixed box and the body's overflow is locked, so extra items can be cut off on short phones). + +### `NavLink` (changed) +- Optional `sectionCurrent?: boolean`: the same underline as `aria-current="page"` via a data attribute, for the parent while a shoot page is open (decision D4). Existing callers unchanged. + +### `ChevronIcon` (new) +- Inline SVG for the toggles, rotates when open (no rotation with reduced motion). + +### `Footer` (changed, one prop) +- The footer links pass `activeOptions={{ exact: true }}`, so "Soorten fotoshoots" in the footer is not announced as the current page on a shoot page (decision D4). No visible change; the footer menu itself is unchanged (FR-ST-10). + +### `useDismiss` (new hook, `web/src/hooks/`) +- Calls a close callback on Escape and on a pointer down outside a given element while active. Used by `NavSubmenu`. + +## Content (`web/src/content/`) [unit 1] + +### Types in `types.ts` (new types, nothing existing changes) +`ShootPageContent`, `StoryBlock`, `FaqItem`, `ShootPageShared`, `ProcessStepId`, `ProcessStepContent`, `DepositInfo`. Flat API shape: strings, `RichText`, `ContentImage`, ids and numbers. See component-methods.md. + +### `shootPages/<id>.ts` × 5 (new) +- One file per shoot with that shoot's page content (`id`, intro, four story blocks, the three per-shoot process values, mosaic heading and photos, FAQ heading and items, package eyebrow/heading, closing texts). One file per shoot because each route imports only its own file, so a page's chunk carries only its own texts, the CMS will serve one page per request, and Andrea can review one shoot at a time. + +### `shootPageShared.ts` (new) +- Everything that is the same on every shoot page: breadcrumb labels, the six step titles and texts (with placeholders), the deposit amount (whole euros) and note, mosaic and FAQ eyebrows, the FAQ lead, the package button labels and the "Prijs op aanvraag" texts, plus the shared FAQ items (exported `FaqItem` constants that the per-shoot lists include). + +### `shootTypes.ts` (unchanged data) +- Only the Gezin draft comment changes to the common draft marker (CON-ST-03). + +## Logic (`web/src/lib/`, `web/src/seo.ts`) + +| Module | Status | Unit | Purpose | +|---|---|---|---| +| `lib/shootPages.ts` | new | 1 | Shoot page paths: id → path, slug → id, path → id; the compile-time check that every shoot id has a route | +| `lib/shootPackage.ts` | new | 1 | The visible package of a shoot, or `undefined` | +| `lib/shootLinks.ts` | changed | 1 | `shootContactLink` uses `shootPackage` (same results) | +| `lib/fillPlaceholders.ts` | new | 1 | `{name}` placeholders in text and in `RichText` | +| `lib/richTextToPlain.ts` | new | 1 | `RichText` as plain text (FAQ answers in JSON-LD) | +| `lib/shootPageView.ts` | new | 1 | Builds the complete, resolved view of one shoot page | +| `lib/mosaicLayout.ts` | new (if FD keeps it pure) | 2 | Tile spans for a given photo count | +| `lib/shootNavItems.ts` | new | 3 | Nav children from the shoot types | +| `lib/navCurrent.ts` | new | 3 | Whether a nav item or its section is current for a pathname | +| `seo.ts` | changed | 1 | Shared Service `@id`, `shootService`, `breadcrumbList`, `faqPage`, `shootPageGraph`; `shootServices` uses `shootService` | + +## Registry and CI configuration [unit 1, OG images unit 2] +- `sitePages.ts`: five entries, `indexed: true`, title and description drafts; `ogImage` added by unit 2 together with `public/og-<id>.jpg`. +- `lighthouserc.cjs`: the five paths in `indexedPaths` (same order as `sitePages`, the sync test compares with `toEqual`) and in `photoPagePaths`. `lighthouserc.desktop.cjs` derives from it and does not change. diff --git a/aidlc-docs/features/shoot-type-pages/inception/application-design/services.md b/aidlc-docs/features/shoot-type-pages/inception/application-design/services.md new file mode 100644 index 0000000..fe2383b --- /dev/null +++ b/aidlc-docs/features/shoot-type-pages/inception/application-design/services.md @@ -0,0 +1,114 @@ +# Services — Shoot Type Pages + +The SPA has no service layer. As on the other pages, the route orchestrates: it collects static content (later the CMS API), lets pure functions derive everything that is decided, and hands the result to presentational components. What is new is one pure "view" builder per shoot page, so the five routes share one tested orchestration instead of five copies. + +## Shoot page route (`routes/soorten-fotoshoots/<id>.tsx`) + +- **`head()`**: `pageHead('/soorten-fotoshoots/<id>')`: title, description, canonical, `og:image`; no `noindex` (indexed). `head()` stays in the main bundle, so it reads only `sitePages`. +- **`component`** (split off by `autoCodeSplitting`): + 1. `view = shootPageView('<id>', <id>Page, shootPageSources)`. + 2. `view` is `undefined` → render `NotFound` (fail safe, SECURITY-15; cannot happen with today's content, guarded by a test). + 3. Otherwise render `StructuredData` once per object of `shootPageGraph(view, siteContent)`, then `ShootPage view={view}`. The JSON-LD lives in the component, not in `head()`, for the same reason as on the overview: the content stays in the page's chunk. + +```mermaid +sequenceDiagram + box rgba(246,224,94,0.4) Route + participant R as ShootRoute + end + box rgba(154,230,180,0.4) Pure logic + participant V as shootPageView + participant S as seo.shootPageGraph + end + box rgba(251,211,141,0.4) Content + participant C as content modules + end + box rgba(99,179,237,0.4) Components + participant P as ShootPage + end + R->>C: read own page content and shared sources + R->>V: build view for this shoot id + V-->>R: resolved view or undefined + R->>S: build WebPage and FAQPage data from the view + S-->>R: structured data objects + R->>P: render page from the view +``` + +Text alternative: the route reads its content, asks shootPageView for a resolved view (or undefined → not-found), asks seo.ts for the structured data built from that same view, and renders ShootPage from the view. + +Because the visible page and the structured data come from the same view, the breadcrumb, FAQ, price and Service `url` cannot disagree between markup and JSON-LD. + +## `shootPageView` — the orchestration in one pure function (unit 1) + +| Step | Rule (one line; detailed rules for photos in FD unit 2) | Requirement | +|---|---|---| +| Shoot lookup | `shoot = shootTypes.find(id)`; missing, or `page.id !== id` → `undefined` | FR-ST-01, SECURITY-15 | +| Path, breadcrumb | `path = shootPagePath(id)`; items Home `/`, overview `/soorten-fotoshoots`, `shoot.name` → `path` | FR-ST-02 | +| Placeholders | values from `site.contactForm.replyTime`, `formatPrice(deposit.amount)` and the page's `process` fields; applied to steps, deposit note, stories and FAQ answers | FR-ST-04, NFR-ST-04 | +| Steps | `PROCESS_STEP_ORDER.map(id => shared.process.steps[id])`: always six, fixed order, whatever the content order | FR-ST-04 | +| Package | `pkg = shootPackage(shoot, packages)`; `bookLink = shootContactLink(shoot, packages)` | FR-ST-07, SECURITY-05 | +| Photos | page photos without any `src` already used by a story block or the package block, first occurrence kept, order kept; fewer than `MOSAIC_MIN_PHOTOS` left → no photo section; portfolio link only when `id ∈ portfolioShoots` | FR-ST-05 | +| FAQ | items with placeholders filled; none → no FAQ section | FR-ST-06 | +| Closing | `link = shootContactLink(shoot, packages)` | FR-ST-08 | + +## Overview route (`routes/soorten-fotoshoots/index.tsx`) +Unchanged composition. Its JSON-LD keeps `webPage('WebPage', '/soorten-fotoshoots', { mainEntity: shootServices(shootTypes, siteContent) })`; `shootServices` now builds each item with `shootService`, so each Service has the shared `@id` and the shoot page as `url`. No `offers` on the overview (it shows no prices; the existing "no price" invariant stays). `ShootBlock` adds the "Lees meer" link (unit 2). + +## Navigation (unit 3) +`navigation.ts` builds the "Soorten fotoshoots" children with `shootNavItems(shootTypes)` at module load. `NavigationBar` and `MobileNav` read `mainNav` as today. Current state: `isItemCurrent` / `isSectionCurrent` with the router's `location.pathname` (`useRouterState`). The open state of the mobile menu, the mobile group and the desktop submenu is one pure reducer, `navMenuReducer` in `lib/navMenuState.ts` (unit 3 FD Q6 = A, approved 2026-10-30), held with `useReducer` in `NavigationBar`; closed by events (toggle, Escape, outside, link, route change, viewport change); no context. + +## Data flow + +```mermaid +graph LR + Content["content: shootPages, shootPageShared, shootTypes, packages, siteContent, portfolioContent"] + Sources["routes: -shootPageSources"] + View["lib: shootPageView"] + Helpers["lib: shootPages, shootPackage, shootLinks, fillPlaceholders, richTextToPlain"] + Seo["seo.ts: shootPageGraph, shootService, breadcrumbList, faqPage"] + Route["routes: soorten-fotoshoots/id"] + Page["components: ShootPage and sections"] + Registry["sitePages, lighthouserc"] + Content --> Sources + Sources --> Route + Route --> View + View --> Helpers + Route --> Seo + Seo --> Helpers + Route --> Page + Registry --> Route + classDef database fill:#fbd38d,stroke:#92400e,stroke-width:1px,color:#000; + classDef service fill:#9ae6b4,stroke:#2f855a,stroke-width:1px,color:#000; + classDef client fill:#f6e05e,stroke:#c05621,stroke-width:1px,color:#000; + classDef gateway fill:#63b3ed,stroke:#2b6cb0,stroke-width:1px,color:#000; + class Content,Registry database; + class View,Helpers,Seo service; + class Route,Sources client; + class Page gateway; +``` + +Text alternative: content modules feed the shared sources, which the shoot route passes to shootPageView (using the small helpers); the route also asks seo.ts for structured data and renders the page components; the registry supplies the head. + +## Pure functions with property-based tests (PBT-01 identification) + +Unit 1's properties are fixed here (no Functional Design for unit 1); units 2 and 3 confirm or extend theirs in Functional Design. Generators in `src/test/arbitraries.ts` (PBT-07): `shootPageContent` (stories 0–6 with optional image, FAQ 0–6 with `RichText` answers containing placeholders and links, photos 0–8 with deliberate duplicates of story/package `src`), `shootPageShared` (steps as a record, deposit amount 1–999), and arbitrary strings for slugs that include known ids, case variants, slashes, `..`, `%2F`, whitespace and `</script>`. + +| Function | Property | Rule | +|---|---|---| +| `shootPagePath` / `shootIdFromSlug` / `shootIdFromPath` | `shootIdFromSlug(id) === id` and `shootIdFromPath(shootPagePath(id)) === id` for every id | PBT-02 | +| `shootIdFromSlug`, `shootIdFromPath` | any input → a known id or `undefined`, never throws; a defined result `r` satisfies `shootPagePath(r) === input` without its one trailing slash | PBT-03 | +| `fillPlaceholders`, `fillRichText` | text without placeholders is unchanged; filling twice equals filling once when values contain no `{…}`; no known placeholder remains; links keep `to`/`hash` | PBT-03, PBT-04 | +| `richTextToPlain` | equals the joined string pieces and link texts; length is the sum of the piece lengths | PBT-03 | +| `shootPackage` | result is `undefined` or a member of `visiblePackages(packages)` with `id === shoot.packageId`; agrees with `shootContactLink(...).search?.pakket` | PBT-03 | +| `shootPageView` | `undefined` iff the shoot is missing or ids differ; exactly six steps in `PROCESS_STEP_ORDER`; no known placeholder left in any text; photos are an ordered subset of the page photos without duplicates and without any story/package `src`, or absent below the minimum; `offer.pkg` defined iff `shootPackage` is; `bookLink.search?.pakket` only a visible package id; breadcrumb ends with `path`; portfolio link iff `id ∈ portfolioShoots` | PBT-03 | +| `breadcrumbList` | positions are 1..n consecutive; every `item` is an absolute URL under `siteUrl`; names equal the labels in order | PBT-03 | +| `faqPage` | one `Question` per item in order; `name` = question; answer text = `richTextToPlain(answer)`; `undefined` for an empty list | PBT-03 | +| `shootService`, `shootServices` | the overview item and the shoot page Service have the same `@id` for every shoot; `url` = canonical shoot page; `offers` present iff `pkg` given, with that price and `EUR` | PBT-03 | +| `shootPageGraph` and all new builders through `jsonLdScript` | `JSON.parse(jsonLdScript(x))` deep-equals `x` for content with `</script>`, `<`, `>`, `&`, U+2028; the output never contains `<`, `>` or `&`; never the e-mail address | PBT-02, PBT-03 | +| `mosaicLayout` (unit 2) | one tile per photo; tiles never overlap; every count 1..n gets a layout | PBT-03 (FD unit 2) | +| `shootNavItems` (unit 3) | one item per shoot, in order; `to === shootPagePath(id)`; labels = names; every `to` is a known route | PBT-03 | +| `isItemCurrent`, `isSectionCurrent` (unit 3) | exact iff pathname equals `to` (trailing slash ignored); section iff exact for the item or a child; never true for unrelated paths | PBT-03 | +| `navMenuReducer` (unit 3) | after every event of a random `NavMenuEvent` sequence, invariants I1–I4 hold (model-based); `routeChanged` and `linkChosen` idempotent and close everything; `outside` and `focusLeave` never change `menuOpen` | PBT-03, PBT-06 | + +**Not PBT** (finite sets, example-based, PBT-10): the registry consistency (every shoot id has a route, a `sitePages` entry, a sitemap line, entries in `indexedPaths` and `photoPagePaths`, a nav child and a "Lees meer" link, nothing extra), the four-stories and 3–5 FAQ content checks, "no photo twice per page" on the real content, and "a shoot with a package names the same duration as the package's features" (D6). + +**PBT-06 stateful, `navMenuReducer` (unit 3, approved 2026-10-30)**: model-based sequence tests. Random sequences of `NavMenuEvent`s (open and close the mobile menu and group, toggle the submenu, Escape, outside click, focus leave, route change, link chosen, viewport change) are applied to the reducer, and after every step the invariants hold: I1 `submenuOpen` implies `isDesktop`; I2 `menuOpen` implies `!isDesktop`; I3 `groupOpen` implies `menuOpen`; I4 `focusRequest === 'menuToggle'` implies `!isDesktop`, and `'submenuToggle'` implies `isDesktop`. The rest of the reducer's properties are listed in the table above and in unit 3's business-logic-model.md. diff --git a/aidlc-docs/features/shoot-type-pages/inception/plans/application-design-plan.md b/aidlc-docs/features/shoot-type-pages/inception/plans/application-design-plan.md new file mode 100644 index 0000000..f473d29 --- /dev/null +++ b/aidlc-docs/features/shoot-type-pages/inception/plans/application-design-plan.md @@ -0,0 +1,27 @@ +# Application Design Plan — Shoot Type Pages + +Depth: standard. Per the orchestrator's instruction, no question file was created: where a genuine decision was needed, the design picks a recommendation, states alternatives and rationale, and lists it under "Decisions for the user" in [application-design.md](../application-design/application-design.md#decisions-for-the-user). Business rules for units 2 and 3 follow in their Functional Design; unit 1 is fully specified here. + +## Plan + +- [x] Analyse context + - [x] Read requirements.md (FR-ST, SEO-ST, NFR-ST, CON-ST), execution-plan.md (units 1, 2 ∥ 3), aidlc-state.md, audit.md + - [x] Read the shared reverse-engineering artifacts (architecture, component inventory, code structure) + - [x] Read the previous feature's application design as format template + - [x] Read design E (`E-Definitief.dc.html`): intro, story bands, timeline markup and breakpoint, mosaic, FAQ, package, CTA + - [x] Verify in code: routes, `routeTree.gen.ts`, `navigation.ts`, `sitePages.ts`, `sitemap.ts`, `seo.ts` + tests, content types and modules, `visiblePackages`, `shootLinks`, `components/shoots/*`, `MediaText`, `PageSection`, `PageIntro`, `CallToAction`, `PriceCard`, `NavigationBar`/`MobileNav`/`NavLink`/`FooterLink`, `lighthouserc*.cjs`, the registry/Lighthouse sync tests, and TanStack's `resolveIsActive` and `routesByPath` in `node_modules` +- [x] Resolve O-ST-01 route mechanism (five static files vs `$id`) and the overview restructuring (D1) +- [x] Define the content model: per-shoot and shared types, file layout, placeholders, draft markers (D3, D6, D7, D8) +- [x] Identify components with responsibilities and interfaces; justify each new one (D10–D12) +- [x] Define services/helpers: path helpers and inverse, `shootPackage`, placeholders, `richTextToPlain`, `shootPageView`, `seo.ts` additions (D2, D9, D13, D14) +- [x] Identify pure functions and their PBT properties (PBT-01) +- [x] Generate `components.md` with component definitions and high-level responsibilities +- [x] Generate `component-methods.md` with types, props and method signatures +- [x] Generate `services.md` with orchestration, data flow and PBT properties +- [x] Generate `component-dependency.md` with dependency graphs, matrix and communication patterns +- [x] Generate `application-design.md`: consolidated design, decisions, file ownership per unit (units 2 and 3 disjoint), hot files, risks, "Decisions for the user", extension compliance +- [x] Validate design completeness and consistency + - [x] Every FR-ST/SEO-ST/NFR-ST item has a component, helper or test home + - [x] Units 2 and 3 share no file (ownership table) + - [x] Mermaid diagrams use `classDef` with `color:#000`, safe node ids, a text alternative after each + - [x] Security Baseline and PBT compliance summarised; no blocking findings diff --git a/aidlc-docs/features/shoot-type-pages/inception/plans/execution-plan.md b/aidlc-docs/features/shoot-type-pages/inception/plans/execution-plan.md new file mode 100644 index 0000000..2e8eb66 --- /dev/null +++ b/aidlc-docs/features/shoot-type-pages/inception/plans/execution-plan.md @@ -0,0 +1,148 @@ +# Execution Plan — Shoot Type Pages + +## Detailed Analysis Summary + +### Transformation Scope (Brownfield) +- **Transformation Type**: Single component (front-end `web/`), multiple modules inside it; no back-end, infrastructure or deployment change +- **Primary Changes**: five new pages `/soorten-fotoshoots/<id>` built from design E; a navigation submenu; SEO additions (BreadcrumbList, FAQPage, Service URLs) +- **Related Components**: `routes/soorten-fotoshoots*`, `content/` (types, shootTypes, new shoot-page content), `seo.ts`, `sitePages.ts`, `navigation.ts`, `NavigationBar` + `MobileNav`, `components/shoots/ShootBlock`, `lighthouserc*.cjs`, `LAYOUT.md`, `.ai/layout-conventions.md` + +### Change Impact Assessment +- **User-facing changes**: Yes — five new pages, a submenu in the main navigation, a "Lees meer" link per shoot on the overview +- **Structural changes**: Yes (small) — the overview route gets child routes, so `soorten-fotoshoots.tsx` must be restructured (index route or layout + `<Outlet/>`) +- **Data model changes**: Yes — new flat content types (story blocks, timeline, FAQ, mosaic photos, opleverduur, deposit); `NavItem` gains optional children +- **API changes**: No (no back-end yet; content stays shaped for the future CMS API 1:1) +- **NFR impact**: Yes — Lighthouse (10 extra runs, photo-page bucket 0.85 mobile), a11y of the submenu (keyboard, Escape, focus), JSON-LD escaping, CI duration on the Pi + +### Component Relationships +- **Primary Component**: `web/src/routes` (new shoot page route(s)) + new page section components +- **Shared Components**: `PageSection`, `MediaText`, `FramedImage`, `CallToAction`, `LinkButton`, `PriceCard`/package logic (`visiblePackages`, `shootContactLink`), `seo.ts` helpers +- **Dependent Components**: `/soorten-fotoshoots` (links + JSON-LD Service `url`), `/portfolio?shoot=` links, `sitemap`, Lighthouse config +- **Supporting Components**: tests (`*.test.tsx`, `seo.test.ts`, registry tests, axe), CI (`pnpm check`) + +| Component | Change Type | Reason | Priority | +|---|---|---|---| +| content types + shoot page content | Major (new) | page data | Critical | +| routes + sitePages + lighthouserc | Minor | new pages | Critical | +| seo.ts | Minor | breadcrumb, FAQ, Service url | Important | +| new section components | Major (new) | design E | Critical | +| NavigationBar / MobileNav / navigation.ts | Major | submenu | Important | +| ShootBlock (overview) | Minor | "Lees meer" link | Important | +| LAYOUT.md / layout-conventions | Configuration-only | docs | Optional | + +### Risk Assessment +- **Risk Level**: Medium — several modules; the navigation is used on every page; route restructuring touches an existing page +- **Rollback Complexity**: Easy — one PR, front-end only +- **Testing Complexity**: Moderate — component + a11y tests, PBT for pure helpers, Lighthouse for 5 pages + +## Workflow Visualization + +```mermaid +flowchart TD + Start(["User Request"]) + + subgraph INCEPTION["🔵 INCEPTION PHASE"] + WD["Workspace Detection<br/><b>COMPLETED</b>"] + RE["Reverse Engineering<br/><b>SKIP</b>"] + RA["Requirements Analysis<br/><b>COMPLETED</b>"] + US["User Stories<br/><b>SKIP</b>"] + WP["Workflow Planning<br/><b>IN PROGRESS</b>"] + AD["Application Design<br/><b>EXECUTE</b>"] + UG["Units Generation<br/><b>SKIP</b>"] + end + + subgraph CONSTRUCTION["🟢 CONSTRUCTION PHASE"] + FD["Functional Design<br/><b>EXECUTE (units 2, 3)</b>"] + NFRA["NFR Requirements<br/><b>SKIP</b>"] + NFRD["NFR Design<br/><b>SKIP</b>"] + ID["Infrastructure Design<br/><b>SKIP</b>"] + CG["Code Generation<br/>(Planning + Generation)<br/><b>EXECUTE</b>"] + BT["Build and Test<br/><b>EXECUTE</b>"] + end + + Start --> WD + WD --> RA + RA --> WP + WP --> AD + AD --> FD + FD --> CG + CG -.->|Next Unit| FD + CG --> BT + BT --> End(["Complete"]) + + style WD fill:#4CAF50,stroke:#1B5E20,stroke-width:3px,color:#fff + style RA fill:#4CAF50,stroke:#1B5E20,stroke-width:3px,color:#fff + style WP fill:#4CAF50,stroke:#1B5E20,stroke-width:3px,color:#fff + style CG fill:#4CAF50,stroke:#1B5E20,stroke-width:3px,color:#fff + style BT fill:#4CAF50,stroke:#1B5E20,stroke-width:3px,color:#fff + style AD fill:#FFA726,stroke:#E65100,stroke-width:3px,stroke-dasharray: 5 5,color:#000 + style FD fill:#FFA726,stroke:#E65100,stroke-width:3px,stroke-dasharray: 5 5,color:#000 + style RE fill:#BDBDBD,stroke:#424242,stroke-width:2px,stroke-dasharray: 5 5,color:#000 + style US fill:#BDBDBD,stroke:#424242,stroke-width:2px,stroke-dasharray: 5 5,color:#000 + style UG fill:#BDBDBD,stroke:#424242,stroke-width:2px,stroke-dasharray: 5 5,color:#000 + style NFRA fill:#BDBDBD,stroke:#424242,stroke-width:2px,stroke-dasharray: 5 5,color:#000 + style NFRD fill:#BDBDBD,stroke:#424242,stroke-width:2px,stroke-dasharray: 5 5,color:#000 + style ID fill:#BDBDBD,stroke:#424242,stroke-width:2px,stroke-dasharray: 5 5,color:#000 + style INCEPTION fill:#BBDEFB,stroke:#1565C0,stroke-width:3px,color:#000 + style CONSTRUCTION fill:#C8E6C9,stroke:#2E7D32,stroke-width:3px,color:#000 + style Start fill:#CE93D8,stroke:#6A1B9A,stroke-width:3px,color:#000 + style End fill:#CE93D8,stroke:#6A1B9A,stroke-width:3px,color:#000 + + linkStyle default stroke:#333,stroke-width:2px +``` + +Text alternative: Inception runs Workspace Detection, Requirements Analysis, Workflow Planning and Application Design (Reverse Engineering, User Stories and Units Generation skipped); Construction runs Functional Design for units 2 and 3, Code Generation per unit and Build and Test (NFR and Infrastructure stages skipped); no Operations phase. + +## Phases to Execute + +### 🔵 INCEPTION PHASE +- [x] Workspace Detection (COMPLETED) +- [x] Reverse Engineering (SKIPPED — shared artifacts reused; only this feature's lines are updated) +- [x] Requirements Analysis (COMPLETED) +- [x] User Stories (SKIPPED — one visitor persona, concrete FRs with acceptance detail) +- [x] Execution Plan (IN PROGRESS) +- [ ] Application Design — EXECUTE (standard) + - **Rationale**: new components (Breadcrumb, StoryBlocks, ProcessTimeline, PhotoMosaic, FaqList, ShootPackage, nav submenu), new content model, route mechanism decision (O-ST-01: five static route files vs one `$slug` route against `Record<RoutePath, PageMeta>`), new `seo.ts` helpers and the shared `Service @id` +- [ ] Units Generation — SKIP + - **Rationale**: the split is fixed below; three units in one package need no separate decomposition stage + +### 🟢 CONSTRUCTION PHASE +- [ ] Functional Design — EXECUTE for unit 2 and unit 3, SKIP for unit 1 + - **Rationale**: unit 2 has real UI rules (timeline alternation and breakpoint, mosaic with 2–N photos, package vs "Prijs op aanvraag", FAQ open state, photo-once-per-page); unit 3 has interaction rules (disclosure, keyboard, Escape, route-change close, transparent hero, mobile scroll). Unit 1 is fully specified by Application Design +- [ ] NFR Requirements — SKIP + - **Rationale**: NFRs are set at requirements level (NFR-ST-01..07); stack unchanged +- [ ] NFR Design — SKIP + - **Rationale**: no new NFR patterns beyond existing Lighthouse/a11y/CSP setup +- [ ] Infrastructure Design — SKIP + - **Rationale**: static front-end assets only; CI/CD and hosting unchanged +- [ ] Code Generation — EXECUTE (ALWAYS, per unit) +- [ ] Build and Test — EXECUTE (ALWAYS) + +### 🟡 OPERATIONS PHASE +- [ ] Deployment Setup, Monitoring Setup, Production Readiness Validation — SKIP (Operations Configuration = No) + +## Units and Change Sequence + +| # | Unit | Contents | Depends on | +|---|---|---|---| +| 1 | Content and SEO foundation | content types; shoot page content for all five types (drafts marked); deposit/opleverduur data; route(s) for `/soorten-fotoshoots/<id>` with a minimal page shell; overview route restructuring; `sitePages`, sitemap, `lighthouserc*`; `seo.ts` (BreadcrumbList, FAQPage, Service `url` → shoot page, Offer only with a price); PBT for slug↔id, JSON-LD escaping, breadcrumb/FAQ invariants | — | +| 2 | Shoot page UI | Breadcrumb, intro, StoryBlocks, ProcessTimeline (horizontal with alternating texts, vertical on narrow screens), PhotoMosaic, FaqList, ShootPackage / "Prijs op aanvraag", CTA; "Lees meer" links on the overview; OG images; `LAYOUT.md` + layout conventions (letters H–J) | 1 | +| 3 | Navigation submenu | `NavItem` children; desktop disclosure (keyboard, Escape, close on route change, transparent hero); `MobileNav` expandable group with scrolling | 1 (route paths only) | + +- **Update approach**: hybrid — unit 1 first (critical path); units 2 and 3 can run in parallel afterwards (disjoint files), each by its own sub-agent; integration checkpoint at Build and Test +- **Orchestration** (user request): the main session orchestrates; complex work (Application Design, Functional Design, unit 2 and unit 3 code, reviews) → larger sub-agents (opus); mechanical work (registry entries, docs updates, LAYOUT.md, content inventories, running checks) → smaller sub-agents (sonnet/haiku) +- **Shared hot files**: `sitePages.ts`, `lighthouserc.cjs`, `active-features.md` — own entries only (team agreement) +- **Delivery**: branch `feature/shoot-type-pages`, a commit per unit, `pnpm check` per unit, one PR at the end; commit/push only when the user asks + +## Content Approval Gate +All drafted copy (story blocks, FAQ, timeline texts, titles/descriptions, alt texts) is marked as draft in the content files. Before the merge, the drafts plus the open facts of CON-ST-04 go to Andrea in one review; the PR is not merged with unapproved drafts. + +## Estimated Timeline +- **Total stages to execute**: 5 more (Application Design, Functional Design ×2, Code Generation ×3, Build and Test) +- **Estimated duration**: about 2–3 working sessions, plus Andrea's content review and CI runs (~20+ min each on the Pi, longer with 10 extra Lighthouse runs) + +## Success Criteria +- **Primary Goal**: five indexed shoot pages per design E that explain each shoot, show photos and the process, and link into booking +- **Key Deliverables**: shoot page route(s) and components, content data, SEO helpers, navigation submenu, overview links, LAYOUT.md update, tests +- **Quality Gates**: `pnpm check` green (types, lint, vitest incl. PBT and axe, build, Lighthouse: a11y/best-practices/SEO 1.0, performance ≥ 0.85 mobile / 0.9 desktop on the new pages); Security Baseline and PBT compliance per unit; Andrea's content approval before merge +- **Integration Testing**: overview ↔ shoot pages ↔ contact/portfolio links, navigation on every page, sitemap and JSON-LD consistent across registry, routes and Lighthouse lists diff --git a/aidlc-docs/features/shoot-type-pages/inception/requirements/requirement-clarification-questions.md b/aidlc-docs/features/shoot-type-pages/inception/requirements/requirement-clarification-questions.md new file mode 100644 index 0000000..0d7ae72 --- /dev/null +++ b/aidlc-docs/features/shoot-type-pages/inception/requirements/requirement-clarification-questions.md @@ -0,0 +1,25 @@ +# Verduidelijkingsvragen — Pagina per shoottype + +De antwoorden zijn compleet en spreken elkaar niet tegen. Over de aanbetaling (Vraag 6: A, € 50) is nog iets open, want het komt in de tijdlijn, bij het pakket en in de FAQ. + +Hoe ik de andere antwoorden samen lees (zeg het als dat niet klopt): + +- Vraag 1 (D + FAQ uit C) en Vraag 3 (A, alle vijf, zonder prijsblok bij loveshoot/portret): loveshoot en portret krijgen in plaats van het pakketblok een blok "Prijs op aanvraag" met een link naar contact. De fotomozaïek toont dan de 2 foto's die er zijn, tot Andrea meer aanlevert. +- Vraag 2 (A) en Vraag 4 (A): `/soorten-fotoshoots` blijft het overzicht; de shootpagina's komen eronder (`/soorten-fotoshoots/newborn`, …). De bestaande ankers (`/soorten-fotoshoots#newborn`) blijven werken. + +## Verduidelijkingsvraag 1 — Wat gebeurt er met de aanbetaling van € 50? + +- A) Wordt verrekend met het totaalbedrag; het restbedrag betaal je na de shoot +- B) Wordt verrekend met het totaalbedrag; het restbedrag betaal je vóór of op de dag van de shoot +- C) Komt bovenop de prijs (bijv. reserveringskosten) +- X) Anders (beschrijf hieronder na de [Answer]:-tag) + +[Answer]: A + +## Verduidelijkingsvraag 2 — Krijg je de aanbetaling terug bij annuleren of verzetten? + +- A) Verzetten kan kosteloos (bijv. bij een ziek kindje of een baby die later komt); bij annuleren vervalt de aanbetaling +- B) Niet noemen op de website (staat in de algemene voorwaarden of wordt persoonlijk afgesproken) +- X) Anders (beschrijf hieronder na de [Answer]:-tag) + +[Answer]: B diff --git a/aidlc-docs/features/shoot-type-pages/inception/requirements/requirement-verification-questions.md b/aidlc-docs/features/shoot-type-pages/inception/requirements/requirement-verification-questions.md new file mode 100644 index 0000000..405c501 --- /dev/null +++ b/aidlc-docs/features/shoot-type-pages/inception/requirements/requirement-verification-questions.md @@ -0,0 +1,171 @@ +# Verificatievragen — Pagina per shoottype + +Al vastgelegd (geen vraag nodig): + +- **Stijl**: de pagina's gebruiken de bestaande huisstijl (paper/alt-banden, Marcellus + Jost, heidegroen accent, hoekige vormen) en bestaande blokken waar dat kan: `PageIntro`, `PageSection`, `MediaText`, `CallToAction`, `LinkButton`, `PriceCard`. Er komen geen hardgecodeerde kleuren of nieuwe dependencies. +- **Inhoud als vaste data** in `web/src/content/`, plat en in de vorm die de API straks 1-op-1 levert (zoals `shootTypes.ts`). +- **SEO-basis per pagina**: een eigen entry in `sitePages.ts` (titel, description, eventueel OG-afbeelding), een canonical, een sitemapregel en JSON-LD via de gedeelde `webPage()`-helper. Ook komt elke pagina in `lighthouserc.cjs`, met dezelfde lat als de andere fotopagina's. +- **Toegankelijkheid**: één h1, secties met een toegankelijke naam, contrast ≥ 4.5:1, `prefers-reduced-motion`, axe in de tests en Lighthouse a11y 1.0. +- **LAYOUT.md** krijgt een diagram voor de shootpagina, en "Types of shoots" wordt bijgewerkt als die pagina verandert. +- **Feiten uit de code**: alleen newborn, zwangerschap en gezin hebben een pakket (€ 185 / € 175 / € 175). Loveshoot en portret hebben geen pakket en maar 2 foto's elk. Nergens staat iets over aanbetaling of opleverduur. + +De designvoorstellen staan op het canvas: https://claude.ai/artifact/BdXmEgsTPK2567g9AFQCXa + +--- + +## Vraag 1 — Designrichting + +Welke richting van het canvas wil je als basis? + +- A) A · Verhaal: redactioneel, tekst en foto wisselen elkaar af, horizontale tijdlijn +- B) B · Beeld eerst: grote foto-hero, vroeg een fotoreeks, verticale tijdlijn naast een foto +- C) C · Praktisch: balk met kerngegevens, tijdlijn als genummerde kaarten, FAQ +- D) D · Verhaal + pakket uit B + horizontale icoon-tijdlijn met tekst om en om boven/onder de lijn (gemaakt na jullie feedback op A) +- E) Een andere combinatie (beschrijf welke onderdelen uit welke richting na de [Answer]:-tag) +- X) Anders (beschrijf hieronder na de [Answer]:-tag) + +[Answer]: D + de FAQ van optie C. Zet dat eventueel als Design E in de design asset zodat ik hem nog kan bekijken voordat het gebouwd wordt. + +## Vraag 2 — URL-structuur + +Welke URL krijgen de pagina's? + +- A) Onder het overzicht: `/soorten-fotoshoots/newborn`, `/soorten-fotoshoots/zwangerschap`, … (duidelijke hiërarchie, makkelijk een breadcrumb) +- B) Met zoekwoorden: `/newbornshoot`, `/zwangerschapsshoot`, `/gezinsshoot`, `/loveshoot`, `/portretshoot` (kort, met het woord waarop mensen zoeken) +- C) Met zoekwoord en plaats: `/newbornfotograaf-huizen`, … (lokale SEO, maar lange URL's en minder ruimte voor andere plaatsen) +- X) Anders (beschrijf hieronder na de [Answer]:-tag) + +[Answer]: A + +## Vraag 3 — Welke shoottypes krijgen nu een pagina? + +Loveshoot en portret hebben maar 2 foto's en geen pakket. + +- A) Alle vijf meteen; loveshoot en portret met de 2 foto's die er zijn (en zonder prijsblok) +- B) Alle vijf bouwen, maar loveshoot en portret pas live (geïndexeerd) zodra er meer foto's zijn +- C) Nu alleen newborn, zwangerschap en gezin; loveshoot en portret later +- X) Anders (beschrijf hieronder na de [Answer]:-tag) + +[Answer]: A + +## Vraag 4 — Rol van de bestaande pagina /soorten-fotoshoots + +- A) Blijft zoals hij is, met per shoot een extra link "Lees meer over de …shoot" naar de nieuwe pagina +- B) Wordt een compacter overzicht (kaarten met foto, korte tekst en link); de uitgebreide tekst verhuist naar de shootpagina's +- X) Anders (beschrijf hieronder na de [Answer]:-tag) + +[Answer]: A + +## Vraag 5 — Opleverduur per shoot + +Hoe lang duurt het van shoot tot oplevering van de foto's? + +- A) Ik vul de waarden zelf in na de [Answer]:-tag (bijv. newborn 3 weken, zwangerschap 2 weken, …) +- B) Gebruik voorlopige waarden die duidelijk als concept gemarkeerd zijn; Andrea bevestigt ze vóór de merge +- C) Noem geen termijn, alleen de stap "Bewerking" zonder duur +- X) Anders (beschrijf hieronder na de [Answer]:-tag) + +[Answer]: X, De termijn voor nu is voor alles 2-3 weken + +## Vraag 6 — Aanbetaling + +Wat moet er bij de stap "Aanbetaling" staan? + +- A) Een vast bedrag (vul het in na de [Answer]:-tag, bijv. € 50, en eventueel of het verrekend wordt) +- B) Een percentage van de prijs (vul het in na de [Answer]:-tag) +- C) Alleen dat er een aanbetaling is om de datum vast te leggen, zonder bedrag +- X) Anders (beschrijf hieronder na de [Answer]:-tag) + +[Answer]: A, €50,- + +## Vraag 7 — Is de tijdlijn voor elke shoot gelijk? + +De stappen zijn aanvragen → datum & locatie kiezen → aanbetaling → shoot → bewerking → oplevering. + +- A) Ja, dezelfde stappen voor alle shoots; alleen de opleverduur (en eventueel de stap Locatie, zoals "bij jou thuis" bij newborn) verschilt per shoot +- B) Ja, volledig gelijk, inclusief de teksten +- C) Nee, per shoot kunnen er stappen bij of af (bijv. een voorgesprek bij newborn) +- X) Anders (beschrijf hieronder na de [Answer]:-tag) + +[Answer]: A + +## Vraag 8 — Uitgebreidere tekst per shoot + +Wie schrijft de verdiepende tekst (wat houdt de shoot in, beste periode, duur, locatie, wat neem je mee)? + +- A) Ik (Claude) schrijf concepten in Andrea's toon, op basis van de bestaande teksten; Andrea keurt ze goed vóór de merge +- B) Andrea levert de teksten aan; tot die tijd placeholders +- X) Anders (beschrijf hieronder na de [Answer]:-tag) + +[Answer]: A + +## Vraag 9 — Veelgestelde vragen (FAQ) + +Een FAQ per shoot helpt bij SEO (Google kan de vragen herkennen) en beantwoordt praktische vragen. + +- A) Ja, 3–5 vragen per shoot (concepten door Claude, Andrea keurt goed) +- B) Ja, maar één gedeelde FAQ op alle pagina's (algemene vragen) +- C) Nee, geen FAQ +- X) Anders (beschrijf hieronder na de [Answer]:-tag) + +[Answer]: A, dit kan een mix zijn van specifieke vragen voor dat type shoot en algemene vragen. + +## Vraag 10 — Uitgelichte foto's + +- A) Kies uit de foto's die er al zijn (portfolio + `assets/shoots/`); loveshoot en portret krijgen dan weinig +- B) Andrea levert per shoot een nieuwe selectie (bijv. 4–6 foto's); tot die tijd de bestaande foto's +- X) Anders (beschrijf hieronder na de [Answer]:-tag) + +[Answer]: A, Andrea levert later meer foto's aan + +## Vraag 11 — Navigatie + +Hoe vind je de shootpagina's via het menu? + +- A) Geen menuwijziging; alleen links vanaf /soorten-fotoshoots, de homepage en de footer +- B) Een submenu onder "Soorten fotoshoots" in de navigatiebalk (meer werk: dropdown op desktop, uitklapbaar op mobiel) +- C) Alleen extra links in de footer (plus de links vanaf /soorten-fotoshoots) +- X) Anders (beschrijf hieronder na de [Answer]:-tag) + +[Answer]: B + +## Vraag 12 — Breadcrumb + +- A) Ja, een zichtbare breadcrumb (Home › Soorten fotoshoots › Newborn) plus `BreadcrumbList` JSON-LD +- B) Alleen de `BreadcrumbList` JSON-LD, niet zichtbaar +- C) Nee +- X) Anders (beschrijf hieronder na de [Answer]:-tag) + +[Answer]: A + +## Vraag: Beveiligingsextensies + +Moeten de beveiligingsregels als harde vereisten worden afgedwongen voor dit project? (Bij de vorige features: Ja.) + +- A) Ja — dwing alle BEVEILIGINGSREGELS af als blokkerende vereisten (aanbevolen voor productietoepassingen) +- B) Nee — sla alle BEVEILIGINGSREGELS over (geschikt voor PoC's, prototypes en experimentele projecten) +- X) Anders (beschrijf hieronder na de [Answer]:-tag) + +[Answer]: A + +## Vraag: Property-Based Testing Extensie + +Moeten de property-based testing (PBT) regels worden afgedwongen voor dit project? (Bij de vorige features: Ja, volledig.) + +- A) Ja — dwing alle PBT-regels af als blokkerende vereisten (aanbevolen voor projecten met bedrijfslogica, datatransformaties, serialisatie of stateful componenten) +- B) Gedeeltelijk — dwing PBT-regels alleen af voor pure functies en serialisatie round-trips (geschikt voor projecten met beperkte algoritmische complexiteit) +- C) Nee — sla alle PBT-regels over (geschikt voor eenvoudige CRUD-applicaties, UI-only projecten of dunne integratielagen zonder significante bedrijfslogica) +- X) Anders (beschrijf hieronder na de [Answer]:-tag) + +[Answer]: A + +## Vraag: Operations-fase + +Moet deze feature na Construction door de Operations-fase (deployment en monitoring opzetten)? (Bij de vorige features: Nee; de bestaande CI/CD-pipeline deployt.) + +- A) Ja — voer de Operations-fase uit na Construction (deployment + monitoring) +- B) Nee — stop na Build and Test (deployment/monitoring vallen buiten deze feature) +- C) Weet ik nog niet — vraag het opnieuw na de Construction-fase +- X) Anders (beschrijf hieronder na de [Answer]:-tag) + +[Answer]: B diff --git a/aidlc-docs/features/shoot-type-pages/inception/requirements/requirements.md b/aidlc-docs/features/shoot-type-pages/inception/requirements/requirements.md new file mode 100644 index 0000000..e14a087 --- /dev/null +++ b/aidlc-docs/features/shoot-type-pages/inception/requirements/requirements.md @@ -0,0 +1,303 @@ +# Requirements — Shoot Type Pages + +## Intent Analysis +- **User Request**: one page per shoot type, to improve SEO and to go deeper into what each shoot involves, with a few highlighted photos as an impression and generic information shown on every page, such as a timeline of the steps (request, choose date and location, deposit, shoot, editing time per shoot, delivery). Design suggestions first; built with AI-DLC. +- **Request Type**: New Feature (five new routes under `/soorten-fotoshoots/`) with backwards-compatible extensions of the overview page, the navigation, the content model and the SEO helpers +- **Scope Estimate**: Multiple components within one package (`web/`), plus [LAYOUT.md](../../../../../LAYOUT.md) +- **Complexity Estimate**: Moderate. One page template filled from data for five shoot types, a new timeline and FAQ block, a navigation submenu (desktop dropdown + mobile expandable), three new kinds of structured data (BreadcrumbList, FAQPage, per-page Service), route restructuring of `/soorten-fotoshoots`, and a large amount of new Dutch copy awaiting Andrea's approval +- **Requirements Depth**: Standard + +## Source of Truth +- **Layout and styling**: design **E · Definitief** on the Design canvas (https://claude.ai/artifact/BdXmEgsTPK2567g9AFQCXa, board `E-Definitief.dc.html`, worked out for Newborn): direction D (A · Verhaal + the package block of B + the horizontal icon timeline) plus the FAQ of C. There is no shoot page in `design/andreaslop-static/`; design E takes its place for this page type. The house style (theme tokens, text styles, angular shapes, `paper`/`paper.alt` bands) applies as everywhere. *Source: Q1 = D + FAQ from C* +- **Decisions**: [requirement-verification-questions.md](requirement-verification-questions.md), [requirement-clarification-questions.md](requirement-clarification-questions.md) (including the stated readings at the top, accepted by the user) +- **Codebase facts**: shoot content in `web/src/content/shootTypes.ts`, `packages.ts`, `types.ts`; registry `web/src/sitePages.ts`; SEO helpers `web/src/seo.ts`; menus `web/src/navigation.ts` and `web/src/components/NavigationBar/` + +## Page Structure (per shoot) +Shell header → **Intro** (breadcrumb, eyebrow, h1, intro text) → **Story 1–4** (four text/photo blocks on alternating bands) → **Process timeline** ("Zo werkt het", six steps) → **Photo mosaic** ("Impressie") → **FAQ** ("Veelgestelde vragen") → **Package** (or "Prijs op aanvraag") → **Book** (CTA band) → shell footer. + +```mermaid +graph TD + Intro["Intro: breadcrumb + h1"] --> S1["Story 1: wat kun je verwachten"] + S1 --> S2["Story 2: beste periode"] + S2 --> S3["Story 3: locatie"] + S3 --> S4["Story 4: duur"] + S4 --> TL["Process timeline (6 steps)"] + TL --> Mosaic["Photo mosaic"] + Mosaic --> Faq["FAQ (3-5 questions)"] + Faq --> Pkg["Package or Prijs op aanvraag"] + Pkg --> Cta["Book (CTA band)"] + classDef head fill:#e76f51,stroke:#ad533d,color:#000; + classDef story fill:#f4a261,stroke:#b77a49,color:#000; + classDef generic fill:#2a9d8f,stroke:#20766b,color:#000; + classDef perShoot fill:#e9c46a,stroke:#af9350,color:#000; + classDef cta fill:#b56576,stroke:#884c59,color:#000; + class Intro head; + class S1,S2,S3,S4 story; + class TL generic; + class Mosaic,Faq,Pkg perShoot; + class Cta cta; +``` + +Text alternative: each shoot page runs from the intro with breadcrumb through four story blocks, the process timeline (same steps on every page), the photo mosaic, the FAQ and the package (or "Prijs op aanvraag") block to the closing call to action. + +--- + +## Functional Requirements + +### FR-ST-01 Routes and slugs +- Five pages: `/soorten-fotoshoots/newborn`, `/zwangerschap`, `/gezin`, `/loveshoot`, `/portret`. The slug equals the stable `ShootTypeId`. *Source: Q2 = A* +- All five go live and indexed with this feature. *Source: Q3 = A* +- `/soorten-fotoshoots` keeps rendering the overview page; it must not turn into a layout that renders a child page inside it. (Today `routes/soorten-fotoshoots.tsx` is a flat leaf route; adding children requires restructuring it, e.g. to an index route. Mechanism decided in design.) +- Each of the five paths is a concrete `RoutePath` with its own `sitePages` entry (FR-ST-12). If design chooses one parameterised route (`$slug`), it must still yield five concrete registry entries, sitemap lines and Lighthouse URLs; `Record<RoutePath, PageMeta>` cannot key on a `$slug` template as it is. +- A single pure function derives the page path from a shoot id, and a single pure function maps a slug back to a shoot id (or `undefined`). Links, navigation, breadcrumb, structured data and the registry use these, never hand-written paths. +- An unknown slug (e.g. `/soorten-fotoshoots/onzin`) shows the existing not-found page, never a broken or empty shoot page. + +### FR-ST-02 Intro with breadcrumb +- Visible breadcrumb above the h1: **Home › Soorten fotoshoots › <shoot name>** (e.g. "Newborn", "Portretten"), as `nav` named "Kruimelpad" with an ordered list; the first two items are links, the last is the current page (`aria-current="page"`, not a link). Separators are decorative. *Source: Q12 = A* +- Eyebrow, the page's only h1 and an intro paragraph per shoot (design E Newborn: eyebrow "Newbornfotograaf in Huizen", h1 "Newbornshoot bij jou thuis"). Uses or extends the existing `PageIntro`; the extension is optional and existing callers render unchanged. + +### FR-ST-03 Story blocks +- Four blocks per shoot, each a `section` named by its h2, with eyebrow, h2, one or more paragraphs and an optional photo. Bands alternate `paper` / `paper.alt` and the photo side alternates, as in design E; on phones the photo sits above the text. Built on `MediaText` (with its existing `reverse`, `aspectRatio`, `frameColor` options) and the shoot's frame colour. +- Design E's four themes for Newborn: wat kun je verwachten · de beste periode · locatie · duur. Other shoots use four blocks with headings that fit the shoot (drafts, CON-ST-02). +- A block without a photo renders as a text block without an empty frame or layout gap. + +### FR-ST-04 Process timeline +- Section "Zo werkt het", h2 "Van aanvraag tot online galerij", with the **same six steps on every page**, in this order: **Aanvragen → Datum & locatie kiezen → Aanbetaling → De shoot → Bewerking → Oplevering**. Each step has a decorative icon (no numbers), an h3 and a short text. *Source: Q7 = A* +- Per-shoot values filled in from data: the location text in step 2 (e.g. Newborn "Een newbornshoot is bij jou thuis."), the shoot duration in step 4, and the **opleverduur** in step 5. Opleverduur is a per-shoot field, currently **2–3 weken** for all five. *Source: Q5 = X, Q7 = A* +- Generic values come from one shared place: the reply time (existing `siteContent.contactForm.replyTime`, "1-2 werkdagen") in step 1 and the deposit in step 3: "Met een aanbetaling van € 50 staat je datum vast." *Source: Q6 = A* +- Layout: on wide screens a horizontal line with the six icons and the step texts alternating above and below the line; below ~900 px (design E; the exact breakpoint is chosen in design, a theme breakpoint or token, not a hard-coded pixel value in components) it collapses into a vertical line with the texts beside the icons. The DOM order (an `ol`) equals the reading order in both layouts. +- **No** cancellation or rescheduling terms anywhere on the site. *Source: Clarification 2 = B* + +### FR-ST-05 Photo mosaic +- Section "Impressie" with a heading per shoot (design E: "Uit eerdere newbornshoots") and a mosaic of the shoot's highlight photos that adapts to the number of photos (design E: one large, one wide, two small on desktop; two columns on phones). +- Photos are chosen from existing assets (`assets/portfolio/`, `assets/shoots/`). Loveshoot and Portret have only their 2 photos (main + detail) for now. *Source: Q10 = A, Q3 = A* +- A minimum photo count below which the mosaic is left out is set in design; the page then still has a valid heading outline. +- A photo appears at most once per page (design E repeats `f41a8700` in Story 2 and the mosaic; resolve in design). +- "Bekijk meer …foto's" (`shootPortfolioLink`) follows the existing rule: only when the portfolio page is live and the type has portfolio photos (today Loveshoot and Portret have none, so no link). + +### FR-ST-06 FAQ +- Section "Veelgestelde vragen" (h2 per shoot, e.g. "Vragen over de newbornshoot"), a lead with a link to contact ("Staat je vraag er niet tussen? Stuur gerust een berichtje."), and **3–5 questions per shoot**, mixing shoot-specific and general questions. *Source: Q9 = A* +- Each question is an expandable item (native `details`/`summary` or an accessible disclosure/accordion); the answer text is in the DOM also when collapsed. Which items start open is a design detail (design E opens the first two). +- Answers may contain inline links (existing `RichText` with typed internal targets), no raw HTML. + +### FR-ST-07 Package block +- For a shoot whose `packageId` points to a **visible** package (`visiblePackages`; today Newborn € 185, Zwangerschap € 175, Gezin € 175): the package block in the style of direction B: detail photo, eyebrow ("Pakket newborn"), h2 ("Wat zit er in een newbornshoot"), the price (`formatPrice`), the package features, button **"Boek dit pakket"** → `/contact?pakket=<id>` (existing `shootContactLink`), secondary link **"Eerst een vraag stellen"** → `/contact`, and the note **"Aanbetaling € 50, restbedrag na de shoot."** All figures come from `packages.ts` and the shared deposit value, not from free text. *Source: Q1, Q6 = A, Clarification 1 = A* +- For a shoot without a visible package (today Loveshoot and Portret): the same block with **"Prijs op aanvraag"** in place of the price and features, and a link to `/contact`. *Source: Q3 = A, accepted reading* +- The variant is decided by the data (visible package or not), not by the shoot id, so an invalid or removed package falls back to "Prijs op aanvraag" instead of breaking the page. + +### FR-ST-08 Closing call to action +- The existing `CallToAction` band with a per-shoot h2 and lead (design E: "Op zoek naar een newbornfotograaf in Huizen?" / "Stuur gerust een berichtje voor de mogelijkheden. …") and an accent `LinkButton` ("Boek je newbornshoot") → `shootContactLink(shoot, packages)`. + +### FR-ST-09 Overview page links +- `/soorten-fotoshoots` stays as it is, plus per shoot block a link **"Lees meer over de <shoot>"** (e.g. "Lees meer over de newbornshoot") to the shoot's page. Each link's accessible name is unique per shoot. *Source: Q4 = A* +- The existing anchors (`/soorten-fotoshoots#newborn`, …) keep working (the `article` ids stay). + +### FR-ST-10 Navigation submenu +- In the main navigation, "Soorten fotoshoots" gets a submenu with the five shoot pages (labels = shoot `name`), derived from `shootTypes` and the path function of FR-ST-01, so a new shoot type cannot be forgotten in the menu. *Source: Q11 = B* +- **Desktop** (from `lg`): a dropdown. "Soorten fotoshoots" itself stays a link to the overview; a separate toggle (or an equivalent accessible pattern chosen in design) opens the submenu. Opens by click/tap and keyboard (Enter/Space), closes on Escape (focus back to the toggle), on a click outside, on choosing a link and on route change. Hover opening is optional and never the only way. The panel stays readable when the header is transparent over the home hero. +- **Mobile** (below `lg`): inside the existing full-screen `MobileNav`, an expandable sub-list under "Soorten fotoshoots" with a toggle (`aria-expanded`). Choosing a link closes the whole menu. The menu scrolls when its content is taller than the screen (today it is vertically centred with `overflow` locked on the body, so five extra items can be cut off on short phones). +- The parent item shows as current (existing underline/accent styling) when the overview or one of the shoot pages is open; the active shoot link has `aria-current="page"`. +- The footer menu is unchanged. + +### FR-ST-11 Content model (flat, CMS-ready) +- The shoot page content is flat, API-shaped data in `web/src/content/` (strings, string arrays, `RichText`, `ContentImage`, ids, numbers), extending `ShootType` or in a separate per-shoot page content list keyed by `ShootTypeId` (decided in design). Per shoot: intro (eyebrow, title, text), four story blocks (eyebrow, title, paragraphs, optional image), timeline location text, shoot duration text, opleverduur, highlight photos (ordered list of `ContentImage`), FAQ items (question, answer as `RichText`), mosaic heading, CTA texts. +- Shared, generic content in one place: the six step titles and texts, the deposit amount (whole euros, € 50) and its settlement note, the FAQ lead, the "Prijs op aanvraag" texts. +- **Adding photos later (Andrea delivers more, Q10) is a data-only change**: adding a `ContentImage` to the shoot's list (plus the asset file, until the CMS serves images) changes the page without touching components or routes. +- Link targets are derived in code (`shootContactLink`, `shootPortfolioLink`, the path function), not stored as URLs in content. +- Existing content (`shootTypes.ts` fields, the overview page texts) and its consumers (overview page, portfolio filters, contact options) keep working unchanged. + +### FR-ST-12 Registry, sitemap and Lighthouse entries +- Each shoot page gets a `sitePages.ts` entry: `indexed: true`, a title (≤ ~60 characters including " | Andrea Slop Fotografie"), a description (≤ ~155 characters) naming the shoot and the region, and an `ogImage` (see SEO-ST-05). Sitemap lines follow automatically from the registry. +- The five paths are added to `indexedPaths` in `web/lighthouserc.cjs` (the existing sync test with `sitePages` must pass) and, as photo pages, to `photoPagePaths` (FR-ST-13, NFR-ST-04). + +### FR-ST-13 LAYOUT.md +- New section **"Shoot page"** (one generic diagram for all five shoots) following [.ai/layout-conventions.md](../../../../../.ai/layout-conventions.md): A Intro (with breadcrumb), B–E Story 1–4, F Process timeline, G Photos, H FAQ, I Package, J Book. Letters H, I and J need new template colours (stroke = fill × 0.75), added to the template in `.ai/layout-conventions.md` as well. +- "Types of shoots" keeps its blocks (the new links do not add a section). The Shell diagram does not show menu items, so it stays unchanged. + +--- + +## SEO Requirements + +### SEO-ST-01 Indexing and canonical +- All five pages indexed (no `robots noindex`), in `sitemap.xml`, each with its own canonical via `pageHead`. *Source: Q3 = A* + +### SEO-ST-02 Titles and descriptions +- One title and description per page, drafted with the shoot keyword and the region (e.g. "Newbornshoot in Huizen …"), unique across the site. Drafts for Andrea's approval (CON-ST-02). + +### SEO-ST-03 Structured data per shoot page +- `WebPage` via the shared `webPage()` helper whose `mainEntity` is the shoot's `Service` (`name`, `serviceType`, `description`, `image`, `provider: { '@id': businessId }`, `areaServed` from `siteContent.serviceArea`). The Service has **one stable `@id`** shared with the overview page's `ItemList`, so search engines see one entity; its `url` is the shoot page. The overview's `shootServices` is updated accordingly. +- Only where the page shows a price: an `offers` `Offer` with that price in EUR. No offer for "Prijs op aanvraag". +- `BreadcrumbList` matching the visible breadcrumb (positions 1..3, absolute URLs; Home, Soorten fotoshoots, the shoot). *Source: Q12 = A* +- `FAQPage` with one `Question`/`acceptedAnswer` per visible FAQ item, in page order, answer text equal to the visible text (inline links flattened to their text). *Source: Q9 = A* +- No e-mail address. All structured data goes through `jsonLdScript` (escapes `<`, `>`, `&`) and, as on the overview page, is rendered by the route component so the content stays in the page's chunk. The new helpers are pure functions in `seo.ts` (100 % coverage threshold applies). + +### SEO-ST-04 Semantic structure +- One h1; h2 per section (story blocks, timeline, mosaic, FAQ, package, CTA); h3 per timeline step; questions as the disclosure labels (no skipped levels); descriptive link texts; images with width and height. + +### SEO-ST-05 Preview image +- Per page an `ogImage` 1200×630 from the shoot's main photo, in `web/public/` with its own alt text, as on the other pages. If a crop does not work, the default `/og-image.jpg` is used. *(Assumption, not asked; see A-ST-04.)* + +--- + +## Non-Functional Requirements + +### NFR-ST-01 Accessibility (WCAG 2.1 AA as guideline) +- Heading outline as in SEO-ST-04; every section named by its heading (`aria-labelledby`). +- Breadcrumb as FR-ST-02. Timeline as an ordered list with decorative icons (`aria-hidden`), the line decorative. +- Navigation submenu: **disclosure navigation pattern** (button with `aria-expanded`/`aria-controls`, a plain list of links), **not** the ARIA `menu`/`menuitem` pattern (so not Chakra's `Menu` as is); full keyboard operation and focus handling per FR-ST-10; visible focus ring (theme). +- FAQ disclosures operable by keyboard with a visible state. +- Text contrast ≥ 4.5:1; touch targets ≥ 44×44 px (links, buttons, toggles, FAQ summaries); `prefers-reduced-motion` respected (reveal, submenu and FAQ animations). +- Axe checks in the component and route tests; Lighthouse accessibility 1.0 on all five pages (mobile and desktop) and unchanged on the existing pages. + +### NFR-ST-02 Styling and reuse +- Reuse before building: `PageIntro`, `PageSection`, `MediaText`/`FramedImage`/`DeferredImage`, `Reveal`, `CallToAction`, `LinkButton`, `Link` (`underline`), `RouterLink`, `RichParagraph`, `formatPrice`, `visiblePackages`, `shootContactLink`, `shootPortfolioLink`, and theme tokens/text styles. +- New building blocks (breadcrumb, timeline, mosaic, FAQ, package block, nav submenu) are shared components in their own folders under `components/`, usable for future pages; no hard-coded colours, CSS files or Tailwind; icons as inline SVG components, no icon library. +- Responsive from 320 px to ultrawide, mobile-first, no horizontal scroll, usable at 200 % zoom. +- Prettier style; code comments in English; visitor-facing texts in Dutch. + +### NFR-ST-03 Performance +- The shoot page content and components are code-split from the main bundle (as the overview page does). +- The largest contentful paint image (decided in design; in design E the first story photo) is not deferred; all other photos use `DeferredImage` with intrinsic width/height (no layout shift). +- Lighthouse performance: desktop ≥ 0.9; mobile ≥ 0.85 via `photoPagePaths` (same known limit as `/over-mij` and `/soorten-fotoshoots`), with 0.9 as the goal. Performance stays warn-only in CI. +- No new network requests other than bundled images. Five extra pages × two Lighthouse runs lengthen the CI Lighthouse step on the Raspberry Pi runner; accepted. + +### NFR-ST-04 Maintainability +- One source per fact: shoot ids/slugs (FR-ST-01), prices and features (`packages.ts`), deposit and step texts (shared content), reply time (`siteContent`), opleverduur per shoot. No figure is repeated as free text where data exists. +- A new shoot type needs only content plus a route entry (if static routes are chosen) and registry/Lighthouse entries, all guarded by tests (NFR-ST-06). + +### NFR-ST-05 Security (Security Baseline enabled, blocking) +- **SECURITY-04**: header set and CSP in `web/config/securityHeaders.ts` unchanged; no inline event handlers; the only inline script is the existing JSON-LD pattern. +- **SECURITY-05**: any route or search parameter (a `$slug` if chosen; existing `?pakket=`) is validated against the known id lists; outgoing `?pakket=` values come only from visible package ids. +- **SECURITY-09**: no debug output, no sample or placeholder content in production; draft markers are removed before merge (CON-ST-03). +- **SECURITY-10**: no new dependencies (Chakra's built-in primitives only); lockfile unchanged except if unavoidable and justified in design. +- **SECURITY-11**: content is rendered as text/typed links only; `dangerouslySetInnerHTML` only with `jsonLdScript` output; no e-mail address in markup, bundle, content or structured data. +- **SECURITY-13**: all assets self-hosted; no CDN or third-party embeds. +- **SECURITY-15**: unknown slugs and missing/invalid content fail safe (not-found page, "Prijs op aanvraag", omitted mosaic), never a crash; existing global error handling unchanged. +- SECURITY-01, -02, -03, -06, -07, -08, -12, -14: N/A (see compliance table). + +### NFR-ST-06 Testing (Property-Based Testing enabled, full) +- **Example-based**: page structure and heading outline per shoot; timeline order and per-shoot values; package vs "Prijs op aanvraag" variant; FAQ disclosures; breadcrumb; mosaic with 2 and with many photos; overview "Lees meer" links and kept anchors; nav submenu (desktop and mobile: open, close by Escape/outside/route change, focus return, current state); not-found for unknown slugs; head tags (title, description, canonical, `og:image`, no `noindex`); axe checks. +- **Registry consistency** (finite sets, example-based): every shoot type has a route, an indexed `sitePages` entry, a sitemap line, an entry in `indexedPaths` and `photoPagePaths`, a nav child and a "Lees meer" link, and nothing extra exists. +- **Property-based** (fast-check, `src/test/arbitraries.ts`, existing seed logging): see PBT targets in the compliance table. +- `pnpm check` (lint, format, tests incl. coverage thresholds, build, audits, Lighthouse) passes. + +### NFR-ST-07 Coordination +- Hot files (`sitePages.ts`, `lighthouserc.cjs`, `navigation.ts`, `NavigationBar/`, `seo.ts`, `content/types.ts`, `shootTypes.ts`, `LAYOUT.md`, `_shared/reverse-engineering/`): only this feature's entries are changed, and changes to shared components are backwards compatible. No other feature is active at the time of writing (`active-features.md`). + +--- + +## Content Requirements + +### CON-ST-01 Fixed facts (from the user's answers) +| Fact | Value | Source | +|---|---|---| +| Deposit | € 50, settled against the total; remainder paid after the shoot | Q6 = A, Clarification 1 = A | +| Opleverduur | 2–3 weken, all five shoots (per-shoot field) | Q5 = X | +| Steps | Aanvragen → Datum & locatie kiezen → Aanbetaling → De shoot → Bewerking → Oplevering | Q7 = A | +| Cancellation / rescheduling | Not mentioned on the site | Clarification 2 = B | +| Newborn date (exception) | Newborn depends on the birth date, so the Newborn page keeps "We zetten een voorlopige datum … en schuiven mee als jullie baby eerder of later komt". This is a Newborn-specific planning fact, not general rescheduling terms; other shoots do not get such a line | User, 2026-10-29 | +| Prices | From `packages.ts` (Newborn € 185, Zwangerschap € 175, Gezin € 175); Loveshoot and Portret "Prijs op aanvraag" | code, Q3 = A | +| Reply time | 1-2 werkdagen (`siteContent`) | code | + +### CON-ST-02 Drafts by Claude in Andrea's tone (Andrea approves before merge) +*Source: Q8 = A, Q9 = A.* Per shoot, based on the existing texts in `shootTypes.ts` and `packages.ts`: intro (eyebrow, h1, text); four story blocks; timeline location text and shoot-duration text; mosaic heading; 3–5 FAQ items; CTA texts; package/"Prijs op aanvraag" texts; page title and description; alt texts for photos used in a new context; the photo selection per slot. Design E's Newborn texts are the starting draft for Newborn. The Gezin overview text from the previous feature is still a draft as well. + +### CON-ST-03 Approval gate +- Every drafted text is marked as a draft in the content file until Andrea approves it; the list of drafts is presented to her in one review. The feature is not merged with unapproved drafts. + +### CON-ST-04 Unknown facts — not to be invented (ask Andrea) +| Item | Why open | +|---|---| +| Shoot duration for Loveshoot and Portret | No package, so no "N uur fotografie"; needed for Story 4 and timeline step 4 | +| Number of photos delivered and online gallery for Loveshoot and Portret | Package features exist only for the three packages; timeline step 6 assumes an online gallery for all | +| Best period for Loveshoot and Portret, locations for Portret (natuur / zakelijk) | Not in the current texts | +| "Na de aanvraag stuur ik je een korte checklist" (design E FAQ) | Placeholder in the design; unknown whether such a checklist exists | +| "Ik neem zelf dekens en doeken mee" / "Ik neem alles mee wat ik nodig heb" (design E) | Plausible but not confirmed | +| When and how the remainder is paid "na de shoot" (before delivery?) | Only "after the shoot" is known | +| Whether the € 50 deposit also applies to Loveshoot and Portret | Assumed yes (identical timeline, Q7 = A) | + +### CON-ST-05 Photos +- From existing assets only (Q10 = A). Available pools: Newborn 6 portfolio + 2 shoot photos; Zwangerschap 2 + 2; Gezin 2 + 2 (the `shoots/gezin*` photos show newborn families); Loveshoot 2; Portret 2. Andrea delivers more later; adding them is data-only (FR-ST-11). + +--- + +## Out of Scope +- New photos (Andrea delivers later), a responsive image pipeline, prerendering. +- Cancellation, rescheduling and general terms (Clarification 2 = B). +- Footer and homepage links to the shoot pages (Q11 = B covers the main navigation only). +- Changes to the contact page or form (it already handles `?pakket=`). +- `HowTo` structured data for the timeline. +- Google Business Profile. +- Operations phase. *Source: Operations = B* +- Process note, not a requirement: the work is orchestrated with sub-agents (aidlc-state.md § Orchestration). + +## Assumptions and Open Items +- **A-ST-01** Slug = `ShootTypeId`; Portret's page is `/soorten-fotoshoots/portret` while its display name is "Portretten". +- **A-ST-02** The timeline step texts are identical on every page except the per-shoot fields (location, duration, opleverduur). +- **A-ST-03** The deposit note appears in both package variants; confirm with Andrea (CON-ST-04). +- **A-ST-04** Per-page OG images are wanted (not asked; follows earlier pages). +- **A-ST-05** FAQPage markup is valid schema.org, but Google shows FAQ rich results only for a limited set of authoritative sites since 2023, so the SEO value is mainly the on-page content; the markup is kept because it is cheap and matches the page. +- **O-ST-01** Route mechanism (five static files vs one `$slug` route) and how the overview route is restructured: Application Design. +- **O-ST-02** Exact horizontal/vertical timeline breakpoint, mosaic minimum and layouts for 2 photos, FAQ items open by default: Functional/UI design. +- **O-ST-03** Content facts in CON-ST-04: Andrea. + +--- + +## Extension Compliance — Requirements Level + +### Security Baseline +| Rule | Status | Rationale | +|---|---|---| +| SECURITY-01 Encryption | N/A | No data stores | +| SECURITY-02 Access logging | N/A | No intermediaries added; hosting unchanged | +| SECURITY-03 Application logging | N/A | No server-side component; client errors already go to Sentry | +| SECURITY-04 HTTP security headers | Compliant | Header set and CSP unchanged (NFR-ST-05) | +| SECURITY-05 Input validation | Compliant | Slug and `?pakket=` validated against known ids (NFR-ST-05) | +| SECURITY-06 Least privilege | N/A | No IAM | +| SECURITY-07 Network configuration | N/A | No network infrastructure | +| SECURITY-08 Access control | N/A | Public content | +| SECURITY-09 Hardening | Compliant | No debug output; draft markers removed before merge | +| SECURITY-10 Supply chain | Compliant | No new dependencies | +| SECURITY-11 Secure design | Compliant | Text-only rendering, escaped JSON-LD, no e-mail | +| SECURITY-12 Authentication | N/A | No authentication | +| SECURITY-13 Integrity | Compliant | All assets self-hosted | +| SECURITY-14 Alerting | N/A | No server-side component; monitoring unchanged | +| SECURITY-15 Exception handling | Compliant | Fail-safe fallbacks (NFR-ST-05) | + +### Property-Based Testing (PBT targets) +| Rule | Status | Target | +|---|---|---| +| PBT-01 Property identification | Planned | Properties listed per unit in Functional Design | +| PBT-02 Round-trip | Planned | `slugToId(pathOf(id))` = id for every shoot id; `jsonLdScript` output of BreadcrumbList/FAQPage/Service built from arbitrary strings (incl. `</script>`, `<`, `>`, `&`, U+2028) parses back to the same data | +| PBT-03 Invariants | Planned | Slug parsing of any string returns a known id or `undefined`, never throws; breadcrumb positions are 1..n consecutive with absolute URLs under `siteUrl`, last item the page; FAQPage has one Question per item in order with answer = flattened visible text; structured data never contains an e-mail address; `offers` present iff a visible package exists; the package variant and `?pakket=` follow `visiblePackages` only; the timeline always has the six steps in fixed order for any shoot content; nav children are known routes, one per shoot | +| PBT-04 Idempotency | N/A / candidate | None identified yet; if a nav state reducer is introduced, `close(close(s))` = `close(s)` | +| PBT-05 Oracle | N/A | No reference implementation | +| PBT-06 Stateful | Planned if applicable | If the submenu/mobile-menu state is a reducer: model-based sequences (open, close, Escape, route change, breakpoint change) with invariants (submenu never open while the mobile menu is closed). Otherwise N/A with rationale in design | +| PBT-07 Generators | Planned | Extend `src/test/arbitraries.ts` with the new shoot page content (story blocks, FAQ with `RichText`, photo lists of 0..n, optional package) | +| PBT-08 Shrinking/reproducibility | Compliant | Existing seed logging (`config/testSeed.ts`) | +| PBT-09 Framework | Compliant | fast-check already configured | +| PBT-10 Complementary testing | Planned | Example-based and registry-consistency tests alongside PBT (NFR-ST-06) | + +--- + +## Traceability +| Answer | Decision | Requirements | +|---|---|---| +| Q1 = D + FAQ of C | Design E | Page Structure, FR-ST-02..08, FR-ST-13 | +| Q2 = A | `/soorten-fotoshoots/<slug>` | FR-ST-01, FR-ST-02, SEO-ST-03 | +| Q3 = A | All five live; Loveshoot/Portret 2 photos, no price | FR-ST-01, FR-ST-05, FR-ST-07, FR-ST-12, SEO-ST-01 | +| Q4 = A | Overview unchanged + "Lees meer" links, anchors kept | FR-ST-09 | +| Q5 = X | Opleverduur 2–3 weken for all, per-shoot field | FR-ST-04, FR-ST-11, CON-ST-01 | +| Q6 = A | Deposit € 50 | FR-ST-04, FR-ST-07, CON-ST-01 | +| Q7 = A | Same steps; location and opleverduur per shoot | FR-ST-04, A-ST-02 | +| Q8 = A | Claude drafts, Andrea approves | CON-ST-02, CON-ST-03 | +| Q9 = A | 3–5 FAQ per shoot, mixed | FR-ST-06, SEO-ST-03, CON-ST-02 | +| Q10 = A | Existing photos; more later | FR-ST-05, FR-ST-11, CON-ST-05 | +| Q11 = B | Nav submenu (dropdown / expandable) | FR-ST-10, NFR-ST-01 | +| Q12 = A | Visible breadcrumb + BreadcrumbList | FR-ST-02, SEO-ST-03 | +| Clarification 1 = A | Deposit settled; remainder after the shoot | FR-ST-07, CON-ST-01 | +| Clarification 2 = B | No cancellation/rescheduling text | FR-ST-04, CON-ST-04, Out of Scope | +| Accepted readings | "Prijs op aanvraag" + 2 photos; anchors kept | FR-ST-07, FR-ST-05, FR-ST-09 | +| Security = A | Baseline enforced | NFR-ST-05 | +| PBT = A | Full enforcement | NFR-ST-06, PBT table | +| Operations = B | No Operations phase | Out of Scope | diff --git a/web/lighthouserc.cjs b/web/lighthouserc.cjs index 6703071..bba7cfb 100644 --- a/web/lighthouserc.cjs +++ b/web/lighthouserc.cjs @@ -11,6 +11,11 @@ const indexedPaths = [ '/over-mij', '/portfolio', '/soorten-fotoshoots', + '/soorten-fotoshoots/newborn', + '/soorten-fotoshoots/zwangerschap', + '/soorten-fotoshoots/gezin', + '/soorten-fotoshoots/loveshoot', + '/soorten-fotoshoots/portret', '/contact', ]; const noindexPaths = ['/privacyverklaring']; @@ -25,9 +30,18 @@ const homeMobilePerformance = 0.8; // Lighthouse simulates a slow connection: the photo is only requested once // the main bundle and the page's own chunk have run, so these pages land on // LCP ~3.2s and a score of ~0.895, right on 0.9 (measured on /over-mij and -// /soorten-fotoshoots; fewer image bytes do not move it). Back to 0.9 with -// prerendering or a smaller main bundle (NFR-P-01). -const photoPagePaths = ['/over-mij', '/soorten-fotoshoots']; +// /soorten-fotoshoots; fewer image bytes do not move it). The shoot pages +// (largest paint: the first story photo) are in the same position. Back to +// 0.9 with prerendering or a smaller main bundle (NFR-P-01). +const photoPagePaths = [ + '/over-mij', + '/soorten-fotoshoots', + '/soorten-fotoshoots/newborn', + '/soorten-fotoshoots/zwangerschap', + '/soorten-fotoshoots/gezin', + '/soorten-fotoshoots/loveshoot', + '/soorten-fotoshoots/portret', +]; const photoPageMobilePerformance = 0.85; // Performance hangt af van de snelheid van de meetmachine: Lighthouse vertraagt diff --git a/web/lighthouserc.d.cts b/web/lighthouserc.d.cts index 226b62b..bd537e4 100644 --- a/web/lighthouserc.d.cts +++ b/web/lighthouserc.d.cts @@ -4,6 +4,7 @@ declare const config: { indexedPaths: string[]; noindexPaths: string[]; notFoundPath: string; + photoPagePaths: string[]; ci: unknown; }; diff --git a/web/src/app.test.tsx b/web/src/app.test.tsx index a5a2780..380696d 100644 --- a/web/src/app.test.tsx +++ b/web/src/app.test.tsx @@ -1,20 +1,16 @@ -import { ChakraProvider } from '@chakra-ui/react'; -import { - createMemoryHistory, - createRouter, - RouterProvider, -} from '@tanstack/react-router'; -import { render, screen, waitFor, within } from '@testing-library/react'; +import { screen, waitFor, within } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import lighthouseConfig from '../lighthouserc.cjs'; -import ErrorPage from './components/StatusPage/ErrorPage'; +import shootTypes from './content/shootTypes'; +import { shootPagePath } from './lib/shootPages'; +import { siteUrl } from './seo'; +import { sitemapXml } from './sitemap'; import { FakeIntersectionObserver } from './test/fakeIntersectionObserver'; -import { routeTree } from './routeTree.gen'; import sitePages from './sitePages'; import { axeResults } from './test/axe'; +import { expectShell, renderApp } from './test/renderApp'; import type { SocialLink } from './content/types'; -import system from './theme'; // Laat PageIntro op verzoek crashen, om de foutpagina binnen de shell te testen const crash = vi.hoisted(() => ({ enabled: false })); @@ -65,28 +61,6 @@ afterEach(() => { delete Element.prototype.scrollTo; }); -// De echte app: route tree, router-opties en thema zoals in main.tsx -async function renderApp(path: string) { - const router = createRouter({ - routeTree, - history: createMemoryHistory({ initialEntries: [path] }), - scrollRestoration: true, - defaultErrorComponent: ErrorPage, - }); - await router.load(); - const result = render( - <ChakraProvider value={system}> - <RouterProvider router={router} /> - </ChakraProvider>, - ); - return { ...result, router }; -} - -const expectShell = () => { - expect(screen.getByRole('banner')).toBeInTheDocument(); - expect(screen.getByRole('contentinfo')).toBeInTheDocument(); -}; - describe('app', () => { it.each(Object.keys(sitePages))( '%s rendert binnen de shell met een h1 en zonder axe-fouten', @@ -520,7 +494,133 @@ describe('homepage ?pakket=', () => { ); }); +// The JSON-LD objects in the page, in document order +const structuredData = () => + [...document.querySelectorAll('script[type="application/ld+json"]')].map( + (script) => JSON.parse(script.textContent!), + ); + +const shootIds = shootTypes.map((shoot) => shoot.id); + +describe('shoot pages', () => { + it.each(shootIds)('%s has its own head and structured data', async (id) => { + const path = shootPagePath(id); + await renderApp(path); + await screen.findByRole('heading', { level: 1 }); + expect(document.title).toBe( + `${sitePages[path].title} | Andrea Slop Fotografie`, + ); + expect( + document.head.querySelector('meta[name="description"]'), + ).toHaveAttribute('content', sitePages[path].description); + expect( + document.head.querySelector('link[rel="canonical"]'), + ).toHaveAttribute('href', `${siteUrl}${path}`); + // The default image until unit 2 gives the pages their own + expect( + document.head.querySelector('meta[property="og:image"]'), + ).toHaveAttribute('content', `${siteUrl}/og-image.jpg`); + expect(document.head.querySelector('meta[name="robots"]')).toBeNull(); + + const data = structuredData(); + expect(data.map((item) => item['@type']).sort()).toEqual([ + 'FAQPage', + 'ProfessionalService', + 'WebPage', + ]); + const page = data.find((item) => item['@type'] === 'WebPage'); + expect(page.mainEntity['@id']).toBe(`${siteUrl}${path}#service`); + expect('offers' in page.mainEntity).toBe( + ['newborn', 'zwangerschap', 'gezin'].includes(id), + ); + }); + + it('gives the overview the Service ids of the shoot pages and renders no shoot page', async () => { + await renderApp('/soorten-fotoshoots'); + await screen.findByRole('heading', { + level: 1, + name: 'Soorten fotoshoots', + }); + const page = structuredData().find( + (item) => item['@type'] === 'WebPage', + ); + expect( + page.mainEntity.itemListElement.map( + (entry: { item: { '@id': string } }) => entry.item['@id'], + ), + ).toEqual( + shootIds.map((id) => `${siteUrl}${shootPagePath(id)}#service`), + ); + // No layout route: nothing of a shoot page on the overview + expect( + document.querySelector('script[type="application/ld+json"]'), + ).not.toBeNull(); + expect( + structuredData().some((item) => item['@type'] === 'FAQPage'), + ).toBe(false); + }); + + it.each(['/soorten-fotoshoots/onzin', '/soorten-fotoshoots/newborn/extra'])( + 'shows the 404 within the shell for %s', + async (path) => { + await renderApp(path); + expect( + await screen.findByRole('heading', { + level: 1, + name: 'Pagina niet gevonden', + }), + ).toBeInTheDocument(); + expectShell(); + }, + ); + + // The router matches paths case-insensitively (default), so this is not + // a 404; the canonical URL stays the lowercase one + it('serves /soorten-fotoshoots/Newborn as the newborn page with the lowercase canonical', async () => { + await renderApp('/soorten-fotoshoots/Newborn'); + await screen.findByRole('heading', { level: 1 }); + expect( + document.head.querySelector('link[rel="canonical"]'), + ).toHaveAttribute('href', `${siteUrl}/soorten-fotoshoots/newborn`); + }); +}); + describe('pagina-register', () => { + // Finite sets, so example-based: every shoot page is registered + // everywhere, and nothing else lives under /soorten-fotoshoots/ + it('has every shoot page in the router, registry, sitemap and Lighthouse lists', async () => { + const { router } = await renderApp('/'); + const sitemap = sitemapXml( + Object.entries(sitePages).map(([path, page]) => ({ + path, + indexed: page.indexed, + })) as Parameters<typeof sitemapXml>[0], + siteUrl, + ); + const prefix = '/soorten-fotoshoots/'; + const expected = shootIds.map(shootPagePath).sort(); + const underPrefix = (paths: string[]) => + paths.filter((path) => path.startsWith(prefix)).sort(); + + for (const path of expected) { + expect(router.routesByPath).toHaveProperty([path]); + expect(sitePages[path as keyof typeof sitePages].indexed).toBe( + true, + ); + expect(sitemap).toContain(`<loc>${siteUrl}${path}</loc>`); + expect(lighthouseConfig.indexedPaths).toContain(path); + expect(lighthouseConfig.photoPagePaths).toContain(path); + } + expect(underPrefix(Object.keys(router.routesByPath))).toEqual(expected); + expect(underPrefix(Object.keys(sitePages))).toEqual(expected); + expect(underPrefix(lighthouseConfig.indexedPaths)).toEqual(expected); + expect(underPrefix(lighthouseConfig.photoPagePaths)).toEqual(expected); + const sitemapPaths = [...sitemap.matchAll(/<loc>([^<]*)<\/loc>/g)].map( + (match) => match[1].replace(siteUrl, ''), + ); + expect(underPrefix(sitemapPaths)).toEqual(expected); + }); + it('bevat precies de routes van de route tree', async () => { const { router } = await renderApp('/'); const routePaths = Object.keys(router.routesByPath).sort(); diff --git a/web/src/components/StructuredData/StructuredData.test.tsx b/web/src/components/StructuredData/StructuredData.test.tsx new file mode 100644 index 0000000..91f53ce --- /dev/null +++ b/web/src/components/StructuredData/StructuredData.test.tsx @@ -0,0 +1,40 @@ +import { render } from '@testing-library/react'; +import { describe, expect, it } from 'vitest'; +import StructuredData from './StructuredData'; + +const scripts = (container: HTMLElement) => + container.querySelectorAll('script[type="application/ld+json"]'); + +describe('StructuredData', () => { + it('renders the data as one ld+json script that parses back to it', () => { + const data = { + '@type': 'FAQPage', + name: 'Vragen & antwoorden', + items: [1, 'twee'], + }; + const { container } = render(<StructuredData data={data} />); + expect(scripts(container)).toHaveLength(1); + expect(JSON.parse(scripts(container)[0].textContent ?? '')).toEqual( + data, + ); + }); + + it('does not let </script> in the data end the element', () => { + const data = { + name: '</script><img src=x onerror="alert(1)">', + text: '<!-- & -->', + }; + const { container } = render(<StructuredData data={data} />); + const text = scripts(container)[0].textContent ?? ''; + expect(text).not.toMatch(/[<>&]/); + expect(JSON.parse(text)).toEqual(data); + // The serialised page parsed again as HTML: still one script, and + // nothing from the data became an element + const page = new DOMParser().parseFromString( + container.innerHTML, + 'text/html', + ); + expect(page.querySelectorAll('script')).toHaveLength(1); + expect(page.querySelector('img')).toBeNull(); + }); +}); diff --git a/web/src/components/StructuredData/StructuredData.tsx b/web/src/components/StructuredData/StructuredData.tsx new file mode 100644 index 0000000..b2890ee --- /dev/null +++ b/web/src/components/StructuredData/StructuredData.tsx @@ -0,0 +1,18 @@ +import { jsonLdScript } from '@/seo'; + +type StructuredDataProps = { + data: unknown; +}; + +// One object of structured data as an ld+json script in the page. This is +// the only place the shoot pages use dangerouslySetInnerHTML, and only with +// jsonLdScript's output: it escapes <, > and &, so content can never close +// the script element (SECURITY-04, SECURITY-11). +export default function StructuredData({ data }: StructuredDataProps) { + return ( + <script + type="application/ld+json" + dangerouslySetInnerHTML={{ __html: jsonLdScript(data) }} + /> + ); +} diff --git a/web/src/components/shoots/ShootPage/ShootPage.test.tsx b/web/src/components/shoots/ShootPage/ShootPage.test.tsx new file mode 100644 index 0000000..6099ec4 --- /dev/null +++ b/web/src/components/shoots/ShootPage/ShootPage.test.tsx @@ -0,0 +1,35 @@ +import { screen } from '@testing-library/react'; +import { describe, expect, it } from 'vitest'; +import newbornPage from '@/content/shootPages/newborn'; +import shootPageShared from '@/content/shootPageShared'; +import packages from '@/content/packages'; +import shootTypes from '@/content/shootTypes'; +import siteContent from '@/content/siteContent'; +import { shootPageView } from '@/lib/shootPageView'; +import { axeResults } from '@/test/axe'; +import { renderWithProviders } from '@/test/renderWithProviders'; +import ShootPage from './ShootPage'; + +const view = shootPageView('newborn', newbornPage, { + shootTypes, + packages, + shared: shootPageShared, + site: siteContent, + portfolioShoots: [], +}); + +describe('ShootPage', () => { + it('toont label, de enige h1 en de intro', async () => { + if (view === undefined) throw new Error('no view for newborn'); + const { container } = await renderWithProviders( + <ShootPage view={view} />, + ); + expect(screen.getAllByRole('heading', { level: 1 })).toHaveLength(1); + expect(screen.getByRole('heading', { level: 1 })).toHaveTextContent( + view.intro.title, + ); + expect(screen.getByText(view.intro.eyebrow)).toBeInTheDocument(); + expect(screen.getByText(view.intro.text)).toBeInTheDocument(); + expect(await axeResults(container)).toHaveNoViolations(); + }); +}); diff --git a/web/src/components/shoots/ShootPage/ShootPage.tsx b/web/src/components/shoots/ShootPage/ShootPage.tsx new file mode 100644 index 0000000..396345a --- /dev/null +++ b/web/src/components/shoots/ShootPage/ShootPage.tsx @@ -0,0 +1,17 @@ +import PageIntro from '@/components/PageIntro/PageIntro'; +import type { ShootPageView } from '@/lib/shootPageView'; + +type ShootPageProps = { + view: ShootPageView; +}; + +// One shoot page. For now only the page head with the h1; unit 2 adds the +// sections in the order of the page structure. +export default function ShootPage({ view }: ShootPageProps) { + const { intro } = view; + return ( + <PageIntro eyebrow={intro.eyebrow} title={intro.title}> + {intro.text} + </PageIntro> + ); +} diff --git a/web/src/content/shootPageShared.ts b/web/src/content/shootPageShared.ts new file mode 100644 index 0000000..a9e31b8 --- /dev/null +++ b/web/src/content/shootPageShared.ts @@ -0,0 +1,123 @@ +import type { FaqItem, ShootPageShared } from './types'; + +// The general questions every shoot page may include in its own FAQ list +// (D7). The placeholders are filled in per shoot, see ShootPageShared. + +// "Wanneer krijg ik de foto's?" +// DRAFT(CON-ST-03): awaiting Andrea's approval +export const deliveryFaq: FaqItem = { + id: 'fotos-ontvangen', + question: "Wanneer krijg ik de foto's?", + answer: [ + "Reken op {opleverduur} na de shoot. In die tijd selecteer en bewerk ik de mooiste foto's.", + ], +}; + +// "Hoe leg ik de datum vast?" +// DRAFT(CON-ST-03): awaiting Andrea's approval +// OPEN(CON-ST-04): does the deposit also apply to Loveshoot and Portret, and when exactly is the remainder paid after the shoot (before delivery)? +export const bookingFaq: FaqItem = { + id: 'datum-vastleggen', + question: 'Hoe leg ik de datum vast?', + answer: [ + { text: 'Stuur een berichtje', to: '/contact' }, + ', dan kiezen we samen een moment. Met een aanbetaling van {aanbetaling} staat je datum vast. De aanbetaling wordt verrekend met het totaalbedrag; het restbedrag betaal je na de shoot.', + ], +}; + +// "Hoe snel hoor ik iets van je?" +// DRAFT(CON-ST-03): awaiting Andrea's approval +export const replyFaq: FaqItem = { + id: 'reactie', + question: 'Hoe snel hoor ik iets van je?', + answer: ['Ik reageer binnen {reactietermijn} op je berichtje.'], +}; + +// The texts that are the same on every shoot page, until the CMS API exists. +// Step titles, the deposit amount and the breadcrumb labels are fixed by the +// requirements (FR-ST-02, FR-ST-04, CON-ST-01); the other texts are drafts. +const shootPageShared: ShootPageShared = { + breadcrumb: { + label: 'Kruimelpad', + home: 'Home', + overview: 'Soorten fotoshoots', + }, + process: { + // DRAFT(CON-ST-03): awaiting Andrea's approval + eyebrow: 'Zo werkt het', + // DRAFT(CON-ST-03): awaiting Andrea's approval + title: 'Van aanvraag tot online galerij', + // DRAFT(CON-ST-03): awaiting Andrea's approval + lead: 'Elke shoot volgt dezelfde zes stappen, zodat je precies weet waar je aan toe bent.', + steps: { + aanvragen: { + title: 'Aanvragen', + // DRAFT(CON-ST-03): awaiting Andrea's approval + text: 'Stuur een berichtje. Ik reageer binnen {reactietermijn}.', + }, + datum: { + title: 'Datum & locatie kiezen', + // DRAFT(CON-ST-03): awaiting Andrea's approval + text: 'We kiezen samen een moment. {locatie}', + }, + aanbetaling: { + title: 'Aanbetaling', + // DRAFT(CON-ST-03): awaiting Andrea's approval + text: 'Met een aanbetaling van {aanbetaling} staat je datum vast.', + }, + shoot: { + title: 'De shoot', + // DRAFT(CON-ST-03): awaiting Andrea's approval + text: '{duur}', + }, + bewerking: { + title: 'Bewerking', + // DRAFT(CON-ST-03): awaiting Andrea's approval + text: "Ik selecteer en bewerk de mooiste foto's. Opleverduur: {opleverduur}.", + }, + oplevering: { + title: 'Oplevering', + // DRAFT(CON-ST-03): awaiting Andrea's approval + // OPEN(CON-ST-04): is there an online gallery for Loveshoot and Portret too (confirmed only for the three packages)? + text: "Je foto's staan klaar in je persoonlijke online fotogalerij.", + }, + }, + }, + deposit: { + // Whole euros, settled against the total (CON-ST-01) + amount: 50, + // DRAFT(CON-ST-03): awaiting Andrea's approval + // OPEN(CON-ST-04): does the deposit also apply to Loveshoot and Portret, and when exactly is the remainder paid after the shoot (before delivery)? + note: 'Aanbetaling {aanbetaling}, restbedrag na de shoot.', + }, + photos: { + // DRAFT(CON-ST-03): awaiting Andrea's approval + eyebrow: 'Impressie', + }, + faq: { + // DRAFT(CON-ST-03): awaiting Andrea's approval + eyebrow: 'Veelgestelde vragen', + // DRAFT(CON-ST-03): awaiting Andrea's approval + lead: [ + 'Staat je vraag er niet tussen? ', + { text: 'Stuur gerust een berichtje', to: '/contact' }, + '.', + ], + }, + offer: { + // DRAFT(CON-ST-03): awaiting Andrea's approval + bookLabel: 'Boek dit pakket', + // DRAFT(CON-ST-03): awaiting Andrea's approval + askLabel: 'Eerst een vraag stellen', + // Shown for a shoot without a visible package; no figures, the + // variant is decided by the data (FR-ST-07) + // DRAFT(CON-ST-03): awaiting Andrea's approval + onRequest: { + price: 'Prijs op aanvraag', + text: 'Stuur me een berichtje met wat je in gedachten hebt, dan vertel ik je graag meer over de mogelijkheden en de prijs.', + linkLabel: 'Vraag naar de mogelijkheden', + }, + }, +}; + +export default shootPageShared; diff --git a/web/src/content/shootPages/gezin.ts b/web/src/content/shootPages/gezin.ts new file mode 100644 index 0000000..3b6a694 --- /dev/null +++ b/web/src/content/shootPages/gezin.ts @@ -0,0 +1,147 @@ +import type { ShootPageContent } from '../types'; +import { bookingFaq, deliveryFaq } from '../shootPageShared'; + +// Images: the shoot's main photo and the family photos from the portfolio, +// with the descriptions they have there. Provisional selection per slot; +// unit 2 finalises it in its functional design. Note: the shoots/gezin* +// photos show newborn families (CON-ST-05). The detail photo is shown by +// the package block, so it is not used here. +import gezin from '../../assets/shoots/gezin.jpg'; +import f41a1579 from '../../assets/portfolio/f41a1579.jpg'; +import f41a7138 from '../../assets/portfolio/f41a7138.jpg'; + +const bigBrother = { + src: f41a1579, + alt: 'Grote broer kust zijn pasgeboren broertje of zusje op een wit bed', + width: 800, + height: 534, +}; +const parents = { + src: f41a7138, + alt: 'Jonge ouders kijken samen naar hun slapende pasgeboren baby', + width: 800, + height: 1200, +}; + +// The family page (/soorten-fotoshoots/gezin) until the CMS API exists. +// Drafted from the texts in shootTypes.ts and packages.ts; no facts beyond +// them (CON-ST-04). +const gezinPage: ShootPageContent = { + id: 'gezin', + // DRAFT(CON-ST-03): awaiting Andrea's approval + intro: { + eyebrow: 'Gezinsfotograaf in Huizen', + title: 'Gezinsshoot vol echte momenten', + text: 'Met een gezinsshoot leggen we vast hoe jullie nu samen zijn. Ik fotografeer in Huizen, Bussum, Hilversum en omgeving, bij jullie thuis of buiten in de natuur.', + }, + stories: [ + // DRAFT(CON-ST-03): awaiting Andrea's approval + { + id: 'verwachten', + eyebrow: 'Wat kun je verwachten', + title: 'Spelen, knuffelen en lachen', + paragraphs: [ + [ + 'Met een gezinsshoot leggen we vast hoe jullie nu samen zijn: spelen, knuffelen en lachen. Geen stijve poses, maar echte momenten die je later met plezier terugkijkt.', + ], + ], + image: { + src: gezin, + alt: 'Vader en moeder kijken samen naar hun pasgeboren baby in de armen van de vader', + width: 848, + height: 1060, + }, + }, + // DRAFT(CON-ST-03): awaiting Andrea's approval + { + id: 'samen', + eyebrow: 'Het hele gezin', + title: 'Iedereen hoort erbij', + paragraphs: [ + [ + 'Papa, mama, broertjes en zusjes: op een gezinsshoot hoort iedereen erbij. Ook als jullie gezin net een kleintje rijker is.', + ], + ], + image: bigBrother, + }, + // DRAFT(CON-ST-03): awaiting Andrea's approval + { + id: 'locatie', + eyebrow: 'Thuis of buiten', + title: 'Een plek die bij jullie past', + paragraphs: [ + [ + 'We kiezen samen een plek die bij jullie past, bij jullie thuis of buiten in de natuur.', + ], + ], + image: parents, + }, + // DRAFT(CON-ST-03): awaiting Andrea's approval + { + id: 'duur', + eyebrow: 'Hoe lang duurt het', + title: 'Rustig de tijd', + paragraphs: [ + [ + 'We nemen de tijd, zodat iedereen zich op zijn gemak voelt. Ook de kleinsten: is er even een pauze nodig, dan is daar gewoon ruimte voor.', + ], + ], + }, + ], + process: { + // DRAFT(CON-ST-03): awaiting Andrea's approval + location: + 'En een plek die bij jullie past: bij jullie thuis of buiten in de natuur.', + // DRAFT(CON-ST-03): awaiting Andrea's approval + duration: '1 uur fotografie, zonder haast.', + // The same for every shoot (CON-ST-01) + deliveryTime: '2–3 weken', + }, + photos: { + // DRAFT(CON-ST-03): awaiting Andrea's approval + title: 'Uit eerdere gezinsshoots', + // Both photos are used by the story blocks, so the page view leaves + // the mosaic out (D14, D15) until Andrea delivers more photos; adding + // them here is then a data-only change + images: [bigBrother, parents], + }, + faq: { + // DRAFT(CON-ST-03): awaiting Andrea's approval + title: 'Vragen over de gezinsshoot', + items: [ + // DRAFT(CON-ST-03): awaiting Andrea's approval + { + id: 'wie', + question: 'Wie mogen er op de foto?', + answer: [ + 'Het hele gezin: papa, mama, broertjes en zusjes. Geen stijve poses, maar echte momenten met elkaar.', + ], + }, + // DRAFT(CON-ST-03): awaiting Andrea's approval + { + id: 'locatie', + question: 'Fotograferen we bij ons thuis of buiten?', + answer: [ + 'Allebei kan. We kiezen samen een plek die bij jullie past, bij jullie thuis of buiten in de natuur.', + ], + }, + bookingFaq, + deliveryFaq, + ], + }, + // DRAFT(CON-ST-03): awaiting Andrea's approval + offer: { + eyebrow: 'Pakket gezin', + title: 'Wat zit er in een gezinsshoot', + }, + // DRAFT(CON-ST-03): awaiting Andrea's approval + closing: { + title: 'Op zoek naar een gezinsfotograaf in Huizen?', + lead: [ + 'Stuur gerust een berichtje voor de mogelijkheden. Ik denk graag mee over een plek die bij jullie past.', + ], + buttonLabel: 'Boek je gezinsshoot', + }, +}; + +export default gezinPage; diff --git a/web/src/content/shootPages/loveshoot.ts b/web/src/content/shootPages/loveshoot.ts new file mode 100644 index 0000000..a16ff5b --- /dev/null +++ b/web/src/content/shootPages/loveshoot.ts @@ -0,0 +1,140 @@ +import type { ShootPageContent } from '../types'; +import { bookingFaq, deliveryFaq } from '../shootPageShared'; + +// Images: for now only the shoot's main photo and detail photo exist, with +// the descriptions they have in shootTypes.ts (CON-ST-05) +import loveshoot from '../../assets/shoots/loveshoot.jpg'; +import loveshootDetail from '../../assets/shoots/loveshoot-detail.jpg'; + +const mainPhoto = { + src: loveshoot, + alt: 'Een stel ligt in de zon op een plaid in het gras, met de hoofden tegen elkaar', + width: 848, + height: 1060, +}; + +// The loveshoot page (/soorten-fotoshoots/loveshoot) until the CMS API +// exists. Drafted from the text in shootTypes.ts. Duration, number of +// photos, best period and locations are not known, so the texts do not +// name them (CON-ST-04). No package, so no price: the page shows "Prijs op +// aanvraag", decided by the data (FR-ST-07). +const loveshootPage: ShootPageContent = { + id: 'loveshoot', + // DRAFT(CON-ST-03): awaiting Andrea's approval + intro: { + eyebrow: 'Loveshoot in Huizen', + title: 'Loveshoot voor jullie twee', + text: 'Een loveshoot is een prachtige manier om jullie liefde vast te leggen. Ik fotografeer in Huizen, Bussum, Hilversum en omgeving.', + }, + stories: [ + // DRAFT(CON-ST-03): awaiting Andrea's approval + { + id: 'verwachten', + eyebrow: 'Wat kun je verwachten', + title: 'Jullie liefde, vastgelegd', + paragraphs: [ + [ + 'Een loveshoot is een prachtige manier om jullie liefde vast te leggen. Mijn stijl is natuurlijk en ongedwongen: geen ongemakkelijke poses, maar spontane momenten van jullie samen.', + ], + ], + image: mainPhoto, + }, + // DRAFT(CON-ST-03): awaiting Andrea's approval + { + id: 'trouwkaart', + eyebrow: 'Verloofd?', + title: 'Voor jullie trouwkaart', + paragraphs: [ + [ + "Zijn jullie verloofd? Dan kan je de foto's gebruiken voor de trouwkaart. Vertel het me gerust bij je aanvraag, dan houden we daar rekening mee.", + ], + ], + }, + // DRAFT(CON-ST-03): awaiting Andrea's approval + { + id: 'locatie', + eyebrow: 'De locatie', + title: 'Samen een plek kiezen', + paragraphs: [ + [ + 'We kiezen samen een plek die bij jullie past. Vertel me gerust wat jullie mooi vinden of waar jullie graag samen komen.', + ], + ], + }, + // DRAFT(CON-ST-03): awaiting Andrea's approval + { + id: 'ontspannen', + eyebrow: 'Gewoon jullie zelf', + title: 'Ontspannen voor de camera', + paragraphs: [ + [ + 'Spannend om samen voor de camera te staan? Dat hoeft niet. We nemen de tijd, zodat jullie je op je gemak voelen en ik jullie kan vastleggen zoals jullie zijn.', + ], + ], + }, + ], + process: { + // DRAFT(CON-ST-03): awaiting Andrea's approval + location: 'En een plek die bij jullie past.', + // DRAFT(CON-ST-03): awaiting Andrea's approval + // OPEN(CON-ST-04): shoot duration for the loveshoot + duration: 'We stemmen de duur samen af.', + // The same for every shoot (CON-ST-01) + deliveryTime: '2–3 weken', + }, + photos: { + // DRAFT(CON-ST-03): awaiting Andrea's approval + title: 'Uit eerdere loveshoots', + // Only the main and the detail photo for now. Story 1 and the package + // block use them, so the page view leaves the mosaic out (D14, D15); + // they are listed so that adding photos later is a data-only change. + images: [ + mainPhoto, + { + src: loveshootDetail, + alt: 'Een man schuift een ring om de vinger van zijn partner, met paarse heide op de achtergrond', + width: 480, + height: 480, + }, + ], + }, + faq: { + // DRAFT(CON-ST-03): awaiting Andrea's approval + title: 'Vragen over de loveshoot', + items: [ + // DRAFT(CON-ST-03): awaiting Andrea's approval + { + id: 'trouwkaart', + question: "Kunnen we de foto's gebruiken voor onze trouwkaart?", + answer: [ + "Ja, zeker. Zijn jullie verloofd? Dan kan je de foto's van jullie loveshoot gebruiken voor de trouwkaart.", + ], + }, + // DRAFT(CON-ST-03): awaiting Andrea's approval + { + id: 'ontspannen', + question: 'We staan niet graag op de foto. Is dat erg?', + answer: [ + 'Helemaal niet. We nemen de tijd, zodat jullie je op je gemak voelen. Geen ongemakkelijke poses, maar spontane momenten van jullie samen.', + ], + }, + bookingFaq, + deliveryFaq, + ], + }, + // DRAFT(CON-ST-03): awaiting Andrea's approval + offer: { + eyebrow: 'Loveshoot boeken', + title: 'Benieuwd naar de mogelijkheden?', + }, + // DRAFT(CON-ST-03): awaiting Andrea's approval + closing: { + title: 'Op zoek naar een fotograaf voor jullie loveshoot?', + lead: [ + 'Stuur gerust een berichtje voor de mogelijkheden. Ik denk graag mee over een plek die bij jullie past.', + ], + buttonLabel: 'Boek je loveshoot', + }, +}; + +export default loveshootPage; diff --git a/web/src/content/shootPages/newborn.ts b/web/src/content/shootPages/newborn.ts new file mode 100644 index 0000000..134a7ea --- /dev/null +++ b/web/src/content/shootPages/newborn.ts @@ -0,0 +1,195 @@ +import type { ShootPageContent } from '../types'; +import { deliveryFaq } from '../shootPageShared'; + +// Images: the shoot's main photo and newborn photos from the portfolio, with +// the descriptions they have there. Provisional selection per slot; unit 2 +// finalises it in its functional design (CON-ST-05). +import newborn from '../../assets/shoots/newborn.jpg'; +import f41a1916 from '../../assets/portfolio/f41a1916.jpg'; +import f41a1922 from '../../assets/portfolio/f41a1922.jpg'; +import f41a4650 from '../../assets/portfolio/f41a4650.jpg'; +import f41a7176 from '../../assets/portfolio/f41a7176.jpg'; +import f41a7284 from '../../assets/portfolio/f41a7284.jpg'; +import f41a8700 from '../../assets/portfolio/f41a8700.jpg'; + +const sleepingBaby = { + src: f41a8700, + alt: 'Slapende pasgeboren baby in een bruin-wit gestreept pakje', + width: 800, + height: 534, +}; + +// The newborn page (/soorten-fotoshoots/newborn) until the CMS API exists. +// Texts from design E, without its bracketed placeholders and without facts +// that are not confirmed (CON-ST-04). +const newbornPage: ShootPageContent = { + id: 'newborn', + // DRAFT(CON-ST-03): awaiting Andrea's approval + intro: { + eyebrow: 'Newbornfotograaf in Huizen', + title: 'Newbornshoot bij jou thuis', + text: "Ben je in verwachting? Boek een newbornshoot om de 'kleinste' momenten voor altijd te bewaren. Ik fotografeer bij jou thuis in Huizen, Bussum, Hilversum en omgeving, in het rustige ritme van jullie baby.", + }, + stories: [ + // DRAFT(CON-ST-03): awaiting Andrea's approval + { + id: 'verwachten', + eyebrow: 'Wat kun je verwachten', + title: 'De kleinste momenten, voor altijd bewaard', + paragraphs: [ + [ + 'Een newbornshoot is rustig en ontspannen. Ik fotografeer jullie baby in de eerste weken, slapend en wakker, alleen en in jullie armen. Geen haast en geen ingewikkelde opstellingen: de kleine details en de warmte van jullie eerste weken staan centraal.', + ], + ], + image: { + src: newborn, + alt: 'Een pasgeboren baby in een gestreept pakje slaapt met het hoofdje opzij', + width: 848, + height: 1060, + }, + }, + // DRAFT(CON-ST-03): awaiting Andrea's approval + { + id: 'periode', + eyebrow: 'De beste periode', + title: 'Tot 12 weken na de geboorte', + paragraphs: [ + [ + "De ideale periode voor een newbornshoot is tot 12 weken na de geboorte van je baby. In die eerste weken slapen baby's veel en zijn ze nog heerlijk klein.", + ], + // Newborn only: the date depends on the birth (CON-ST-01) + [ + 'Boek je shoot het liefst al tijdens je zwangerschap. Dan zetten we een voorlopige datum rond je uitgerekende datum en schuiven we mee als jullie baby eerder of later komt.', + ], + ], + image: sleepingBaby, + }, + // DRAFT(CON-ST-03): awaiting Andrea's approval + { + id: 'locatie', + eyebrow: 'Bij jou thuis', + title: 'In jullie eigen vertrouwde omgeving', + paragraphs: [ + [ + "De fotoshoot vindt bij jou thuis plaats. Je hoeft nergens heen met een baby van een paar weken oud, en jullie huis maakt de foto's persoonlijk.", + ], + [ + 'Je kunt tussendoor gewoon je baby voeden en verschonen als dat nodig is.', + ], + ], + image: { + src: f41a7176, + alt: 'Moeder drukt haar gezicht tegen het hoofdje van haar pasgeboren baby', + width: 800, + height: 1200, + }, + }, + // DRAFT(CON-ST-03): awaiting Andrea's approval + { + id: 'duur', + eyebrow: 'Hoe lang duurt het', + title: '1 tot 2 uur, op het ritme van je baby', + paragraphs: [ + [ + 'We nemen alle tijd en volgen het ritme van jullie baby. Reken op 1 tot 2 uur fotografie, inclusief pauzes om te voeden, te troosten of even te knuffelen.', + ], + [ + 'Wil je broertjes, zusjes of jezelf ook op de foto? Dat plannen we gewoon in.', + ], + ], + image: { + src: f41a1916, + alt: 'Pasgeboren baby in een wit pakje ligt op de onderarm van een ouder en kijkt in de camera', + width: 800, + height: 1200, + }, + }, + ], + process: { + // DRAFT(CON-ST-03): awaiting Andrea's approval + location: 'Een newbornshoot is bij jou thuis.', + // DRAFT(CON-ST-03): awaiting Andrea's approval + duration: '1-2 uur fotografie, in het tempo van jullie baby.', + // The same for every shoot (CON-ST-01) + deliveryTime: '2–3 weken', + }, + photos: { + // DRAFT(CON-ST-03): awaiting Andrea's approval + title: 'Uit eerdere newbornshoots', + // The sleeping baby is also in story 2, as in design E; the page view + // leaves it out of the mosaic (D14) + images: [ + { + src: f41a1922, + alt: 'Vader kust zijn pasgeboren baby op het hoofd', + width: 800, + height: 1200, + }, + { + src: f41a4650, + alt: 'Babyvuistje tussen een gebreide deken en een geruite doek', + width: 800, + height: 533, + }, + { + src: f41a7284, + alt: 'Blote babyvoetjes in een gestreept gebreid broekje', + width: 800, + height: 1200, + }, + sleepingBaby, + ], + }, + faq: { + // DRAFT(CON-ST-03): awaiting Andrea's approval + title: 'Vragen over de newbornshoot', + items: [ + // DRAFT(CON-ST-03): awaiting Andrea's approval + { + id: 'boeken', + question: 'Wanneer boek ik de newbornshoot het beste?', + answer: [ + 'Het liefst al tijdens je zwangerschap. We zetten een voorlopige datum rond je uitgerekende datum en schuiven mee als jullie baby eerder of later komt. De shoot vindt plaats binnen 12 weken na de geboorte.', + ], + }, + // DRAFT(CON-ST-03): awaiting Andrea's approval + { + id: 'slapen', + question: 'Wat als mijn baby niet wil slapen?', + answer: [ + "Geen probleem. We volgen het ritme van jullie baby en nemen pauzes om te voeden, te verschonen of te troosten. Wakkere momenten leveren ook prachtige foto's op.", + ], + }, + // DRAFT(CON-ST-03): awaiting Andrea's approval + { + id: 'familie', + question: 'Mogen wij en broertjes of zusjes ook op de foto?', + answer: [ + "Ja, heel graag. Foto's met papa, mama en broertjes of zusjes horen er wat mij betreft gewoon bij.", + ], + }, + // DRAFT(CON-ST-03): awaiting Andrea's approval + { + id: 'voorbereiden', + question: 'Wat moet ik thuis voorbereiden?', + answer: ['Weinig. Een warme kamer met wat daglicht is fijn.'], + }, + deliveryFaq, + ], + }, + // DRAFT(CON-ST-03): awaiting Andrea's approval + offer: { + eyebrow: 'Pakket newborn', + title: 'Wat zit er in een newbornshoot', + }, + // DRAFT(CON-ST-03): awaiting Andrea's approval + closing: { + title: 'Op zoek naar een newbornfotograaf in Huizen?', + lead: [ + 'Stuur gerust een berichtje voor de mogelijkheden. Ik denk graag mee over een datum rond je uitgerekende datum.', + ], + buttonLabel: 'Boek je newbornshoot', + }, +}; + +export default newbornPage; diff --git a/web/src/content/shootPages/portret.ts b/web/src/content/shootPages/portret.ts new file mode 100644 index 0000000..34216e1 --- /dev/null +++ b/web/src/content/shootPages/portret.ts @@ -0,0 +1,142 @@ +import type { ShootPageContent } from '../types'; +import { bookingFaq, deliveryFaq } from '../shootPageShared'; + +// Images: for now only the shoot's main photo and detail photo exist, with +// the descriptions they have in shootTypes.ts (CON-ST-05) +import portret from '../../assets/shoots/portret.jpg'; +import portretDetail from '../../assets/shoots/portret-detail.jpg'; + +const mainPhoto = { + src: portret, + alt: 'Een vrouw met lang bruin haar in een witte blouse kijkt glimlachend omlaag, met bomen op de achtergrond', + width: 848, + height: 1060, +}; + +// The portrait page (/soorten-fotoshoots/portret) until the CMS API exists. +// Drafted from the text in shootTypes.ts. Duration, number of photos, best +// period and locations are not known, so the texts do not name them +// (CON-ST-04). No package, so no price: the page shows "Prijs op aanvraag", +// decided by the data (FR-ST-07). +const portretPage: ShootPageContent = { + id: 'portret', + // DRAFT(CON-ST-03): awaiting Andrea's approval + intro: { + eyebrow: 'Portretfotograaf in Huizen', + title: 'Portretshoot in de natuur of zakelijk', + text: 'Van portretshoots in de natuur tot zakelijke shoots voor de branding van je bedrijf. Ik fotografeer in Huizen, Bussum, Hilversum en omgeving.', + }, + stories: [ + // DRAFT(CON-ST-03): awaiting Andrea's approval + { + id: 'verwachten', + eyebrow: 'Wat kun je verwachten', + title: 'Jij, zoals je bent', + paragraphs: [ + [ + "Mijn stijl is natuurlijk en ongedwongen. Geen ongemakkelijke poses, maar foto's waarop je jezelf herkent.", + ], + ], + image: mainPhoto, + }, + // DRAFT(CON-ST-03): awaiting Andrea's approval + { + id: 'natuur-zakelijk', + eyebrow: 'Natuur of zakelijk', + title: 'Persoonlijk of voor je bedrijf', + paragraphs: [ + [ + "Van portretshoots in de natuur tot zakelijke shoots voor de branding van je bedrijf. Vertel me waarvoor je de foto's wilt gebruiken, dan stemmen we de shoot daarop af.", + ], + ], + }, + // DRAFT(CON-ST-03): awaiting Andrea's approval + // OPEN(CON-ST-04): locations for the portrait shoot (natuur / zakelijk) + { + id: 'locatie', + eyebrow: 'De locatie', + title: 'Samen een plek kiezen', + paragraphs: [ + [ + 'We kiezen samen een plek die past bij jou of bij je bedrijf.', + ], + ], + }, + // DRAFT(CON-ST-03): awaiting Andrea's approval + { + id: 'ontspannen', + eyebrow: 'Gewoon jezelf', + title: 'Op je gemak voor de camera', + paragraphs: [ + [ + 'Niet gewend om op de foto te gaan? Geen zorgen. We nemen de tijd, zodat je je op je gemak voelt.', + ], + ], + }, + ], + process: { + // DRAFT(CON-ST-03): awaiting Andrea's approval + // OPEN(CON-ST-04): locations for the portrait shoot (natuur / zakelijk) + location: 'En een plek die bij jou past.', + // DRAFT(CON-ST-03): awaiting Andrea's approval + // OPEN(CON-ST-04): shoot duration for the portrait shoot + duration: 'We stemmen de duur samen af.', + // The same for every shoot (CON-ST-01) + deliveryTime: '2–3 weken', + }, + photos: { + // DRAFT(CON-ST-03): awaiting Andrea's approval + title: 'Uit eerdere portretshoots', + // Only the main and the detail photo for now. Story 1 and the package + // block use them, so the page view leaves the mosaic out (D14, D15); + // they are listed so that adding photos later is a data-only change. + images: [ + mainPhoto, + { + src: portretDetail, + alt: 'Een vrouw met lang blond haar in een jurk met bloemenprint houdt een takje heide vast op de heide', + width: 480, + height: 480, + }, + ], + }, + faq: { + // DRAFT(CON-ST-03): awaiting Andrea's approval + title: 'Vragen over de portretshoot', + items: [ + // DRAFT(CON-ST-03): awaiting Andrea's approval + { + id: 'zakelijk', + question: "Kan ik ook zakelijke foto's laten maken?", + answer: [ + 'Ja. Naast portretshoots in de natuur doe ik ook zakelijke shoots voor de branding van je bedrijf.', + ], + }, + // DRAFT(CON-ST-03): awaiting Andrea's approval + { + id: 'ontspannen', + question: 'Ik sta niet graag op de foto. Is dat erg?', + answer: [ + "Helemaal niet. We nemen de tijd, zodat je je op je gemak voelt. Geen ongemakkelijke poses, maar foto's waarop je jezelf herkent.", + ], + }, + bookingFaq, + deliveryFaq, + ], + }, + // DRAFT(CON-ST-03): awaiting Andrea's approval + offer: { + eyebrow: 'Portretshoot boeken', + title: 'Benieuwd naar de mogelijkheden?', + }, + // DRAFT(CON-ST-03): awaiting Andrea's approval + closing: { + title: 'Op zoek naar een portretfotograaf in Huizen?', + lead: [ + "Stuur gerust een berichtje voor de mogelijkheden. Vertel me waarvoor je de foto's wilt gebruiken.", + ], + buttonLabel: 'Boek je portretshoot', + }, +}; + +export default portretPage; diff --git a/web/src/content/shootPages/shootPages.test.ts b/web/src/content/shootPages/shootPages.test.ts new file mode 100644 index 0000000..c744713 --- /dev/null +++ b/web/src/content/shootPages/shootPages.test.ts @@ -0,0 +1,206 @@ +import { describe, expect, it } from 'vitest'; +import { shootPackage } from '../../lib/shootPackage'; +import { shootPageView, type ShootPageSources } from '../../lib/shootPageView'; +import packages from '../packages'; +import portfolioContent from '../portfolioContent'; +import siteContent from '../siteContent'; +import shootPageShared from '../shootPageShared'; +import shootTypes from '../shootTypes'; +import type { ContentImage, ShootPageContent, ShootTypeId } from '../types'; +import gezinPage from './gezin'; +import loveshootPage from './loveshoot'; +import newbornPage from './newborn'; +import portretPage from './portret'; +import zwangerschapPage from './zwangerschap'; + +// One entry per shoot type, so a missing page file is a type error +const pages: Record<ShootTypeId, ShootPageContent> = { + newborn: newbornPage, + zwangerschap: zwangerschapPage, + gezin: gezinPage, + loveshoot: loveshootPage, + portret: portretPage, +}; +const entries = Object.entries(pages) as [ShootTypeId, ShootPageContent][]; + +// The real sources, as the routes pass them +const sources: ShootPageSources = { + shootTypes, + packages, + shared: shootPageShared, + site: siteContent, + portfolioShoots: [], +}; + +// The placeholders the page view fills in (see ShootPageShared) +const knownPlaceholders = [ + 'reactietermijn', + 'aanbetaling', + 'locatie', + 'duur', + 'opleverduur', +]; + +// Every visitor-facing string in a content object: all strings except +// image file paths +function texts(value: unknown): string[] { + if (typeof value === 'string') return [value]; + if (Array.isArray(value)) return value.flatMap(texts); + if (typeof value === 'object' && value !== null) { + return Object.entries(value).flatMap(([key, item]) => + key === 'src' ? [] : texts(item), + ); + } + return []; +} + +function images(page: ShootPageContent): ContentImage[] { + return [ + ...page.stories.flatMap((story) => + story.image === undefined ? [] : [story.image], + ), + ...page.photos.images, + ]; +} + +// The photos as they are described elsewhere on the site, by file +const knownImages = new Map<string, ContentImage>( + [ + ...shootTypes.flatMap((shoot) => + shoot.detailImage === undefined + ? [shoot.image] + : [shoot.image, shoot.detailImage], + ), + ...portfolioContent.photos.map((photo) => photo.thumb), + ].map((image) => [image.src, image]), +); + +describe('shoot page content', () => { + it('has a page for every shoot type, with its own id', () => { + expect(Object.keys(pages).sort()).toEqual( + shootTypes.map((shoot) => shoot.id).sort(), + ); + for (const [id, page] of entries) { + expect(page.id).toBe(id); + } + }); + + it.each(entries)( + '%s has exactly four stories with unique ids', + (_, page) => { + expect(page.stories).toHaveLength(4); + const ids = page.stories.map((story) => story.id); + expect(new Set(ids).size).toBe(ids.length); + for (const story of page.stories) { + expect(story.paragraphs.length).toBeGreaterThan(0); + } + }, + ); + + it.each(entries)('%s has 3 to 5 FAQ items with unique ids', (_, page) => { + const ids = page.faq.items.map((item) => item.id); + expect(ids.length).toBeGreaterThanOrEqual(3); + expect(ids.length).toBeLessThanOrEqual(5); + expect(new Set(ids).size).toBe(ids.length); + }); + + it.each(entries)( + '%s describes every photo and gives it a size', + (_, page) => { + for (const image of images(page)) { + expect(image.alt.trim()).not.toBe(''); + expect(image.width).toBeGreaterThan(0); + expect(image.height).toBeGreaterThan(0); + } + }, + ); + + it.each(entries)( + '%s reuses the description and size a photo has elsewhere', + (_, page) => { + const reused = images(page).filter((image) => + knownImages.has(image.src), + ); + // At least the shoot's main photo + expect(reused.length).toBeGreaterThan(0); + for (const image of reused) { + expect(image).toEqual(knownImages.get(image.src)); + } + }, + ); + + it.each(entries)('%s has a page view', (id, page) => { + expect(shootPageView(id, page, sources)).toBeDefined(); + }); + + // D14: every photo once on the rendered page + it.each(entries)('%s shows no photo twice on the page', (id, page) => { + const view = shootPageView(id, page, sources); + expect(view).toBeDefined(); + const shown = [ + ...(view?.stories.flatMap((story) => + story.image === undefined ? [] : [story.image], + ) ?? []), + ...(view === undefined ? [] : [view.offer.image]), + ...(view?.photos?.images ?? []), + ]; + const shownSources = shown.map((image) => image.src); + expect(new Set(shownSources).size).toBe(shownSources.length); + }); + + // D6: one duration, the same as in the package + it.each(entries)( + '%s names the duration of its package, if it has one', + (_, page) => { + const shoot = shootTypes.find((item) => item.id === page.id); + expect(shoot).toBeDefined(); + const pkg = shoot && shootPackage(shoot, packages); + if (pkg === undefined) return; + const duration = pkg.features.find((feature) => + feature.endsWith('uur fotografie'), + ); + expect(duration).toBeDefined(); + expect(page.process.duration.startsWith(duration ?? '')).toBe(true); + }, + ); + + it.each(entries)('%s is delivered in 2–3 weken (CON-ST-01)', (_, page) => { + expect(page.process.deliveryTime).toBe('2–3 weken'); + }); + + describe.each([...entries, ['shared', shootPageShared] as const])( + 'the texts of %s', + (_, content) => { + const all = texts(content); + + it('contain no design placeholders in brackets', () => { + for (const text of all) { + expect(text).not.toMatch(/[[\]]/); + } + }); + + it('only use known placeholders', () => { + for (const text of all) { + for (const [, name] of text.matchAll(/\{([^}]*)\}/g)) { + expect(knownPlaceholders).toContain(name); + } + // No stray brace outside a placeholder + expect(text.replace(/\{[^{}]*\}/g, '')).not.toMatch(/[{}]/); + } + }); + + it('contain no e-mail address', () => { + for (const text of all) { + expect(text).not.toContain('@'); + } + }); + + // Clarification 2 = B: no cancellation or rescheduling terms + it('say nothing about cancelling or rescheduling', () => { + for (const text of all) { + expect(text.toLowerCase()).not.toMatch(/annuler|verzet/); + } + }); + }, + ); +}); diff --git a/web/src/content/shootPages/zwangerschap.ts b/web/src/content/shootPages/zwangerschap.ts new file mode 100644 index 0000000..cd802e8 --- /dev/null +++ b/web/src/content/shootPages/zwangerschap.ts @@ -0,0 +1,154 @@ +import type { ShootPageContent } from '../types'; +import { bookingFaq, deliveryFaq } from '../shootPageShared'; + +// Images: the shoot's main photo and the maternity photos from the +// portfolio, with the descriptions they have there. Provisional selection +// per slot; unit 2 finalises it in its functional design (CON-ST-05). The +// detail photo is shown by the package block, so it is not used here. +import zwangerschap from '../../assets/shoots/zwangerschap.jpg'; +import f41a7883 from '../../assets/portfolio/f41a7883.jpg'; +import f41a8206 from '../../assets/portfolio/f41a8206.jpg'; + +const belly = { + src: f41a8206, + alt: 'Zwangere buik in een zwarte jurk, omarmd door twee handen', + width: 800, + height: 534, +}; +const dunes = { + src: f41a7883, + alt: 'Aanstaande vader omarmt zijn zwangere partner op een zandvlakte in de avondzon', + width: 800, + height: 1200, +}; + +// The maternity page (/soorten-fotoshoots/zwangerschap) until the CMS API +// exists. Drafted from the texts in shootTypes.ts and packages.ts; no facts +// beyond them (CON-ST-04). +const zwangerschapPage: ShootPageContent = { + id: 'zwangerschap', + // DRAFT(CON-ST-03): awaiting Andrea's approval + intro: { + eyebrow: 'Zwangerschapsfotograaf in Huizen', + title: 'Je zwangerschap, voor altijd vastgelegd', + text: 'Met een zwangerschapsshoot leg je deze bijzondere periode vast voor altijd. Ik fotografeer in Huizen, Bussum, Hilversum en omgeving, op een plek die bij jullie past.', + }, + stories: [ + // DRAFT(CON-ST-03): awaiting Andrea's approval + { + id: 'verwachten', + eyebrow: 'Wat kun je verwachten', + title: 'Deze bijzondere periode, voor altijd bewaard', + paragraphs: [ + [ + 'Een zwangerschapsshoot is ontspannen en ongedwongen. Ik leg jullie vast zoals jullie zijn: geen ongemakkelijke poses, maar spontane momenten van jou, je buik en, als je wilt, je partner.', + ], + ], + image: { + src: zwangerschap, + alt: 'Een zwangere vrouw en haar partner kijken elkaar lachend aan op een zandvlakte, zijn hand op haar buik', + width: 848, + height: 1060, + }, + }, + // DRAFT(CON-ST-03): awaiting Andrea's approval + { + id: 'periode', + eyebrow: 'De beste periode', + title: 'Tussen 30 en 34 weken', + paragraphs: [ + [ + 'De mooiste periode voor een zwangerschapsshoot is tussen de 30 en 34 weken. Stuur gerust op tijd een berichtje, dan plannen we de shoot samen in die weken.', + ], + ], + image: belly, + }, + // DRAFT(CON-ST-03): awaiting Andrea's approval + { + id: 'locatie', + eyebrow: 'De locatie', + title: 'Op een plek die bij jullie past', + paragraphs: [ + [ + 'We kiezen samen een locatie uit die bij jullie past, denk aan de Soesterduinen of de heide.', + ], + ], + image: dunes, + }, + // DRAFT(CON-ST-03): awaiting Andrea's approval + { + id: 'duur', + eyebrow: 'Hoe lang duurt het', + title: 'Rustig de tijd', + paragraphs: [ + [ + 'We nemen de tijd, zodat jullie je op je gemak voelen. Zo ontstaan de mooiste, spontane momenten.', + ], + ], + }, + ], + process: { + // DRAFT(CON-ST-03): awaiting Andrea's approval + location: + 'En een plek die bij jullie past, zoals de Soesterduinen of de heide.', + // DRAFT(CON-ST-03): awaiting Andrea's approval + duration: '1 uur fotografie, zonder haast.', + // The same for every shoot (CON-ST-01) + deliveryTime: '2–3 weken', + }, + photos: { + // DRAFT(CON-ST-03): awaiting Andrea's approval + title: 'Uit eerdere zwangerschapsshoots', + // Both photos are used by the story blocks, so the page view leaves + // the mosaic out (D14, D15) until Andrea delivers more photos; adding + // them here is then a data-only change + images: [dunes, belly], + }, + faq: { + // DRAFT(CON-ST-03): awaiting Andrea's approval + title: 'Vragen over de zwangerschapsshoot', + items: [ + // DRAFT(CON-ST-03): awaiting Andrea's approval + { + id: 'periode', + question: 'Wanneer plan ik de zwangerschapsshoot?', + answer: [ + 'De mooiste periode is tussen de 30 en 34 weken. Stuur gerust al eerder een berichtje, dan zoeken we samen een moment in die weken.', + ], + }, + // DRAFT(CON-ST-03): awaiting Andrea's approval + { + id: 'partner', + question: 'Mag mijn partner ook op de foto?', + answer: [ + 'Ja, heel graag. Samen op de foto of alleen jij: we doen wat bij jullie past.', + ], + }, + // DRAFT(CON-ST-03): awaiting Andrea's approval + { + id: 'locatie', + question: 'Waar vindt de zwangerschapsshoot plaats?', + answer: [ + 'We kiezen samen een locatie uit die bij jullie past, denk aan de Soesterduinen of de heide.', + ], + }, + bookingFaq, + deliveryFaq, + ], + }, + // DRAFT(CON-ST-03): awaiting Andrea's approval + offer: { + eyebrow: 'Pakket zwangerschap', + title: 'Wat zit er in een zwangerschapsshoot', + }, + // DRAFT(CON-ST-03): awaiting Andrea's approval + closing: { + title: 'Op zoek naar een zwangerschapsfotograaf in Huizen?', + lead: [ + 'Stuur gerust een berichtje voor de mogelijkheden. Ik denk graag mee over een plek die bij jullie past.', + ], + buttonLabel: 'Boek je zwangerschapsshoot', + }, +}; + +export default zwangerschapPage; diff --git a/web/src/content/shootTypes.ts b/web/src/content/shootTypes.ts index f0b1191..74a2f0d 100644 --- a/web/src/content/shootTypes.ts +++ b/web/src/content/shootTypes.ts @@ -67,7 +67,7 @@ const shootTypes: ShootType[] = [ name: 'Gezin', shootLabel: 'Gezinsshoot', photosLabel: "gezinsfoto's", - // Draft text, still to be approved by Andrea (FR-SF-02) + // DRAFT(CON-ST-03): awaiting Andrea's approval paragraphs: [ 'Met een gezinsshoot leggen we vast hoe jullie nu samen zijn: spelen, knuffelen en lachen. Geen stijve poses, maar echte momenten die je later met plezier terugkijkt. We kiezen samen een plek die bij jullie past, bij jullie thuis of buiten in de natuur.', ], diff --git a/web/src/content/types.ts b/web/src/content/types.ts index eaa9df8..1c836f3 100644 --- a/web/src/content/types.ts +++ b/web/src/content/types.ts @@ -232,6 +232,109 @@ export interface ShootTypesPageContent { }; } +// One block of the story on a shoot page (FR-ST-03) +export interface StoryBlock { + // Stable slug, e.g. 'verwachten'; used in the heading id + id: string; + eyebrow: string; + title: string; + // One or more; RichText so a block can link inline + paragraphs: RichText[]; + // Without one the block is text only + image?: ContentImage; +} + +// One question of the FAQ on a shoot page (FR-ST-06). The answer may contain +// placeholders, see ShootPageShared. +export interface FaqItem { + // Stable slug, unique per page + id: string; + question: string; + answer: RichText; +} + +// The six fixed steps of the process timeline, in this order (FR-ST-04) +export type ProcessStepId = + | 'aanvragen' + | 'datum' + | 'aanbetaling' + | 'shoot' + | 'bewerking' + | 'oplevering'; + +// Title and text of one process step (FR-ST-04) +export interface ProcessStepContent { + title: string; + // May contain placeholders, see ShootPageShared + text: string; +} + +// The deposit that fixes the date (FR-ST-04, FR-ST-07) +export interface DepositInfo { + // Whole euros + amount: number; + // E.g. 'Aanbetaling {aanbetaling}, restbedrag na de shoot.' + note: string; +} + +// The text that is the same on every shoot page (FR-ST-11, shared part). +// Some texts contain placeholders, filled in per shoot when the page view is +// built. There are five, and they may appear in the step texts, the deposit +// note and the FAQ answers: +// {reactietermijn} siteContent.contactForm.replyTime +// {aanbetaling} the deposit amount as a price +// {locatie} ShootPageContent.process.location +// {duur} ShootPageContent.process.duration +// {opleverduur} ShootPageContent.process.deliveryTime +export interface ShootPageShared { + // E.g. 'Kruimelpad', 'Home', 'Soorten fotoshoots' + breadcrumb: { label: string; home: string; overview: string }; + process: { + // E.g. 'Zo werkt het' + eyebrow: string; + // E.g. 'Van aanvraag tot online galerij' + title: string; + lead: string; + steps: Record<ProcessStepId, ProcessStepContent>; + }; + deposit: DepositInfo; + // E.g. 'Impressie' + photos: { eyebrow: string }; + faq: { eyebrow: string; lead: RichText }; + offer: { + // E.g. 'Boek dit pakket' + bookLabel: string; + // E.g. 'Eerst een vraag stellen' + askLabel: string; + // Shown when the shoot has no visible package, e.g. 'Prijs op aanvraag' + onRequest: { price: string; text: string; linkLabel: string }; + }; +} + +// The content of one shoot page (FR-ST-11, per-shoot part); one file per shoot +export interface ShootPageContent { + // Must match the route that imports it (checked by a test) + id: ShootTypeId; + intro: { eyebrow: string; title: string; text: string }; + // Four per shoot (checked by a test) + stories: StoryBlock[]; + process: { + // Step 2, e.g. 'Een newbornshoot is bij jou thuis.' + location: string; + // Step 4, e.g. '1-2 uur fotografie, in het tempo van jullie baby.' + duration: string; + // Step 5 and the shared FAQ, e.g. '2–3 weken' + deliveryTime: string; + }; + // Ordered; adding a photo is a data-only change + photos: { title: string; images: ContentImage[] }; + // 3-5 items, shared ones mixed in + faq: { title: string; items: FaqItem[] }; + // E.g. 'Pakket newborn', 'Wat zit er in een newbornshoot' + offer: { eyebrow: string; title: string }; + closing: { title: string; lead: RichText; buttonLabel: string }; +} + export interface HeroSlide { id: string; src: string; diff --git a/web/src/lib/fillPlaceholders.test.ts b/web/src/lib/fillPlaceholders.test.ts new file mode 100644 index 0000000..9f3f48d --- /dev/null +++ b/web/src/lib/fillPlaceholders.test.ts @@ -0,0 +1,187 @@ +import fc from 'fast-check'; +import { describe, expect, it } from 'vitest'; +import { + knownPlaceholders, + placeholderName, + plainText, + richText, + textWithPlaceholders, +} from '../test/arbitraries'; +import { fillPlaceholders, fillRichText } from './fillPlaceholders'; + +const values = { + reactietermijn: '1-2 werkdagen', + aanbetaling: '€ 50', + locatie: 'Een newbornshoot is bij jou thuis.', + duur: '1-2 uur fotografie', + opleverduur: '2–3 weken', +}; + +// A value for every known placeholder; values never contain braces, as in +// the content +const allValues = fc + .tuple(...knownPlaceholders.map(() => plainText)) + .map((texts) => + Object.fromEntries( + knownPlaceholders.map((name, index) => [name, texts[index]]), + ), + ); + +// Values for some names, known or not +const someValues = fc.dictionary(placeholderName, plainText, { maxKeys: 6 }); + +// Text in which no {name} appears, stray braces included +const withoutPlaceholder = fc + .string() + .filter((text) => !/\{[^{}]*\}/.test(text)); + +const hasKnownPlaceholder = (text: string) => + knownPlaceholders.some((name) => text.includes(`{${name}}`)); + +describe('fillPlaceholders', () => { + it('fills in each placeholder', () => { + expect( + fillPlaceholders('Ik reageer binnen {reactietermijn}.', values), + ).toBe('Ik reageer binnen 1-2 werkdagen.'); + expect(fillPlaceholders('Aanbetaling {aanbetaling}.', values)).toBe( + 'Aanbetaling € 50.', + ); + expect(fillPlaceholders('{locatie}', values)).toBe(values.locatie); + expect(fillPlaceholders('{duur}', values)).toBe(values.duur); + expect(fillPlaceholders('Binnen {opleverduur}.', values)).toBe( + 'Binnen 2–3 weken.', + ); + }); + + it('fills in a repeated placeholder every time', () => { + expect(fillPlaceholders('{duur} en nog eens {duur}', values)).toBe( + '1-2 uur fotografie en nog eens 1-2 uur fotografie', + ); + }); + + it('keeps unknown placeholders, stray braces and inherited names', () => { + expect(fillPlaceholders('{onbekend}', values)).toBe('{onbekend}'); + expect(fillPlaceholders('{Duur} { duur}', values)).toBe( + '{Duur} { duur}', + ); + expect(fillPlaceholders('{ en }', values)).toBe('{ en }'); + expect(fillPlaceholders('}{', values)).toBe('}{'); + expect(fillPlaceholders('{}', values)).toBe('{}'); + expect(fillPlaceholders('{constructor} {toString}', values)).toBe( + '{constructor} {toString}', + ); + expect(fillPlaceholders('{{duur}}', values)).toBe( + '{1-2 uur fotografie}', + ); + }); + + it('inserts a value literally', () => { + expect(fillPlaceholders('{duur}', { duur: '$& $1 $$' })).toBe( + '$& $1 $$', + ); + }); + + it('returns text without placeholders as it is (invariant)', () => { + fc.assert( + fc.property( + withoutPlaceholder, + fc.dictionary(fc.string(), fc.string()), + (text, given) => { + expect(fillPlaceholders(text, given)).toBe(text); + }, + ), + ); + }); + + it('changes nothing when filled in a second time (idempotency)', () => { + fc.assert( + fc.property(textWithPlaceholders, someValues, (text, given) => { + const once = fillPlaceholders(text, given); + expect(fillPlaceholders(once, given)).toBe(once); + }), + ); + }); + + it('leaves no known placeholder behind (invariant)', () => { + fc.assert( + fc.property(textWithPlaceholders, allValues, (text, given) => { + expect(hasKnownPlaceholder(fillPlaceholders(text, given))).toBe( + false, + ); + }), + ); + }); +}); + +describe('fillRichText', () => { + it('fills in text pieces and link texts, and keeps the link target', () => { + expect( + fillRichText( + [ + 'Binnen {opleverduur}. ', + { + text: 'Vraag het binnen {reactietermijn}', + to: '/contact', + }, + { + text: '{duur}', + to: '/soorten-fotoshoots', + hash: 'newborn', + }, + ], + values, + ), + ).toEqual([ + 'Binnen 2–3 weken. ', + { text: 'Vraag het binnen 1-2 werkdagen', to: '/contact' }, + { + text: '1-2 uur fotografie', + to: '/soorten-fotoshoots', + hash: 'newborn', + }, + ]); + }); + + it('fills every piece in its place and keeps links as links with their target (invariant)', () => { + fc.assert( + fc.property(richText, someValues, (text, given) => { + const filled = fillRichText(text, given); + expect(filled).toHaveLength(text.length); + filled.forEach((piece, index) => { + const before = text[index]; + if (typeof before === 'string') { + expect(piece).toBe(fillPlaceholders(before, given)); + } else { + expect(piece).toEqual({ + ...before, + text: fillPlaceholders(before.text, given), + }); + } + }); + }), + ); + }); + + it('changes nothing when filled in a second time (idempotency)', () => { + fc.assert( + fc.property(richText, someValues, (text, given) => { + const once = fillRichText(text, given); + expect(fillRichText(once, given)).toEqual(once); + }), + ); + }); + + it('leaves no known placeholder behind (invariant)', () => { + fc.assert( + fc.property(richText, allValues, (text, given) => { + fillRichText(text, given).forEach((piece) => { + expect( + hasKnownPlaceholder( + typeof piece === 'string' ? piece : piece.text, + ), + ).toBe(false); + }); + }), + ); + }); +}); diff --git a/web/src/lib/fillPlaceholders.ts b/web/src/lib/fillPlaceholders.ts new file mode 100644 index 0000000..236669d --- /dev/null +++ b/web/src/lib/fillPlaceholders.ts @@ -0,0 +1,31 @@ +import type { RichText } from '../content/types.ts'; + +// A placeholder: a name between braces, with no brace inside +const PLACEHOLDER = /\{([^{}]*)\}/g; + +// Fills in every {name} whose name is one of the values, so a figure that +// is data (reply time, deposit, duration, ...) is written in one place only +// (D8, NFR-ST-04). Unknown placeholders and other text stay as they are; +// only own properties count, so {constructor} is no placeholder. The values +// are inserted literally ($& and the like mean nothing here). +export function fillPlaceholders( + text: string, + values: Readonly<Record<string, string>>, +): string { + return text.replace(PLACEHOLDER, (match, name: string) => + Object.hasOwn(values, name) ? values[name] : match, + ); +} + +// The same for running text: the text pieces and the link texts are filled +// in, link targets stay as they are +export function fillRichText( + text: RichText, + values: Readonly<Record<string, string>>, +): RichText { + return text.map((piece) => + typeof piece === 'string' + ? fillPlaceholders(piece, values) + : { ...piece, text: fillPlaceholders(piece.text, values) }, + ); +} diff --git a/web/src/lib/richTextToPlain.test.ts b/web/src/lib/richTextToPlain.test.ts new file mode 100644 index 0000000..d4d6afc --- /dev/null +++ b/web/src/lib/richTextToPlain.test.ts @@ -0,0 +1,33 @@ +import fc from 'fast-check'; +import { describe, expect, it } from 'vitest'; +import { richText } from '../test/arbitraries'; +import { richTextToPlain } from './richTextToPlain'; + +describe('richTextToPlain', () => { + it('reads links by their text, without adding spaces', () => { + expect( + richTextToPlain([ + 'Staat je vraag er niet tussen? ', + { text: 'Stuur gerust een berichtje', to: '/contact' }, + '.', + ]), + ).toBe('Staat je vraag er niet tussen? Stuur gerust een berichtje.'); + expect(richTextToPlain([])).toBe(''); + expect(richTextToPlain(['Alleen tekst'])).toBe('Alleen tekst'); + }); + + it('is the text pieces and link texts joined, as long as they are together (invariant)', () => { + fc.assert( + fc.property(richText, (text) => { + const pieces = text.map((piece) => + typeof piece === 'string' ? piece : piece.text, + ); + const plain = richTextToPlain(text); + expect(plain).toBe(pieces.join('')); + expect(plain.length).toBe( + pieces.reduce((sum, piece) => sum + piece.length, 0), + ); + }), + ); + }); +}); diff --git a/web/src/lib/richTextToPlain.ts b/web/src/lib/richTextToPlain.ts new file mode 100644 index 0000000..2437b0d --- /dev/null +++ b/web/src/lib/richTextToPlain.ts @@ -0,0 +1,10 @@ +import type { RichText } from '../content/types.ts'; + +// The text a visitor reads: text pieces as they are, links by their text, +// joined without anything in between (spaces belong to the text). For +// places that take plain text only, such as the FAQ in structured data. +export function richTextToPlain(text: RichText): string { + return text + .map((piece) => (typeof piece === 'string' ? piece : piece.text)) + .join(''); +} diff --git a/web/src/lib/shootLinks.test.ts b/web/src/lib/shootLinks.test.ts index 9f965f3..d7670bb 100644 --- a/web/src/lib/shootLinks.test.ts +++ b/web/src/lib/shootLinks.test.ts @@ -9,6 +9,7 @@ import { shootContactLink, shootPortfolioLink, } from './shootLinks'; +import { shootPackage } from './shootPackage'; import { visiblePackages } from './visiblePackages'; const shoot = (id: string) => shootTypes.find((item) => item.id === id)!; @@ -58,6 +59,15 @@ describe('shootContactLink', () => { }), ); }); + + it('agrees with shootPackage (invariant)', () => { + fc.assert( + fc.property(shootType, fc.array(anyPackage), (item, list) => { + const link = shootContactLink(item, list); + expect(link.search?.pakket).toBe(shootPackage(item, list)?.id); + }), + ); + }); }); describe('shootPortfolioLink', () => { diff --git a/web/src/lib/shootLinks.ts b/web/src/lib/shootLinks.ts index 9611997..ae54ee4 100644 --- a/web/src/lib/shootLinks.ts +++ b/web/src/lib/shootLinks.ts @@ -1,7 +1,7 @@ import type { PricingPackage, ShootType } from '../content/types.ts'; import type { RoutePath } from '../navigation.ts'; import type { PageMeta } from '../sitePages.ts'; -import { visiblePackages } from './visiblePackages.ts'; +import { shootPackage } from './shootPackage.ts'; // Where "Stuur een berichtje" goes: the contact page, with the shoot's // package preselected when that package is shown (BR-SF-01..03, FR-CP-09) @@ -9,11 +9,9 @@ export function shootContactLink( shoot: ShootType, packages: readonly PricingPackage[], ) { - const shown = visiblePackages(packages).some( - (pkg) => pkg.id === shoot.packageId, - ); - return shown && shoot.packageId !== undefined - ? { to: '/contact' as const, search: { pakket: shoot.packageId } } + const pkg = shootPackage(shoot, packages); + return pkg !== undefined + ? { to: '/contact' as const, search: { pakket: pkg.id } } : { to: '/contact' as const }; } diff --git a/web/src/lib/shootPackage.test.ts b/web/src/lib/shootPackage.test.ts new file mode 100644 index 0000000..e03039b --- /dev/null +++ b/web/src/lib/shootPackage.test.ts @@ -0,0 +1,63 @@ +import fc from 'fast-check'; +import { describe, expect, it } from 'vitest'; +import packages from '../content/packages'; +import shootTypes from '../content/shootTypes'; +import { anyPackage, shootType } from '../test/arbitraries'; +import { shootPackage } from './shootPackage'; +import { visiblePackages } from './visiblePackages'; + +const shoot = (id: string) => shootTypes.find((item) => item.id === id)!; + +describe('shootPackage', () => { + it('finds the package of the three shoots that have one', () => { + expect(shootPackage(shoot('newborn'), packages)).toMatchObject({ + id: 'newborn', + price: 185, + }); + expect(shootPackage(shoot('zwangerschap'), packages)).toMatchObject({ + id: 'zwangerschap', + price: 175, + }); + expect(shootPackage(shoot('gezin'), packages)).toMatchObject({ + id: 'gezin', + price: 175, + }); + }); + + it('finds none for Loveshoot and Portret', () => { + expect(shootPackage(shoot('loveshoot'), packages)).toBeUndefined(); + expect(shootPackage(shoot('portret'), packages)).toBeUndefined(); + }); + + it('finds none when the package is removed or invalid', () => { + expect( + shootPackage( + shoot('gezin'), + packages.filter((pkg) => pkg.id !== 'gezin'), + ), + ).toBeUndefined(); + expect( + shootPackage( + shoot('newborn'), + packages.map((pkg) => + pkg.id === 'newborn' ? { ...pkg, price: 0 } : pkg, + ), + ), + ).toBeUndefined(); + }); + + it('is undefined or a shown package with the id of the shoot (invariant)', () => { + fc.assert( + fc.property(shootType, fc.array(anyPackage), (item, list) => { + const result = shootPackage(item, list); + const shown = visiblePackages(list); + const expected = shown.some((pkg) => pkg.id === item.packageId); + expect(result !== undefined).toBe(expected); + if (result !== undefined) { + expect(result.id).toBe(item.packageId); + expect(shown).toContain(result); + } + }), + ); + }); +}); diff --git a/web/src/lib/shootPackage.ts b/web/src/lib/shootPackage.ts new file mode 100644 index 0000000..0aa55ea --- /dev/null +++ b/web/src/lib/shootPackage.ts @@ -0,0 +1,12 @@ +import type { PricingPackage, ShootType } from '../content/types.ts'; +import { visiblePackages } from './visiblePackages.ts'; + +// The package a shoot points to, if that package is shown; a removed or +// invalid package, or none, gives undefined, and the page then shows +// "Prijs op aanvraag" (FR-ST-07, SECURITY-15) +export function shootPackage( + shoot: ShootType, + packages: readonly PricingPackage[], +): PricingPackage | undefined { + return visiblePackages(packages).find((pkg) => pkg.id === shoot.packageId); +} diff --git a/web/src/lib/shootPageView.test.ts b/web/src/lib/shootPageView.test.ts new file mode 100644 index 0000000..ad6a974 --- /dev/null +++ b/web/src/lib/shootPageView.test.ts @@ -0,0 +1,369 @@ +import fc from 'fast-check'; +import { describe, expect, it } from 'vitest'; +import sleepingBaby from '../assets/portfolio/f41a8700.jpg'; +import packages from '../content/packages'; +import shootPageShared from '../content/shootPageShared'; +import loveshootPage from '../content/shootPages/loveshoot'; +import newbornPage from '../content/shootPages/newborn'; +import shootTypes from '../content/shootTypes'; +import siteContent from '../content/siteContent'; +import type { ContentImage, RichText } from '../content/types'; +import { + anyPackage, + anySiteContent, + contentImage, + knownPlaceholders, + plainText, + shootPageContent, + shootPageShared as anyShared, + shootType, + shootTypeId, +} from '../test/arbitraries'; +import { shootPackage } from './shootPackage'; +import { SHOOT_TYPE_IDS, shootPagePath } from './shootPages'; +import { + MOSAIC_MIN_PHOTOS, + PROCESS_STEP_ORDER, + shootPageView, + type ShootPageSources, + type ShootPageView, +} from './shootPageView'; +import { visiblePackages } from './visiblePackages'; + +const NBSP = ' '; + +const sources: ShootPageSources = { + shootTypes, + packages, + shared: shootPageShared, + site: siteContent, + portfolioShoots: ['newborn'], +}; + +// Shoot types with unique ids, some with a detail photo +const shoots = fc.uniqueArray( + fc + .tuple(shootType, fc.option(contentImage, { nil: undefined })) + .map(([shoot, detailImage]) => + detailImage === undefined ? shoot : { ...shoot, detailImage }, + ), + { selector: (shoot) => shoot.id, maxLength: 5 }, +); + +// The sources as the CMS could deliver them. The reply time has no braces, +// as in the content: it is filled in as a value. +const anySources: fc.Arbitrary<ShootPageSources> = fc.record({ + shootTypes: shoots, + packages: fc.array(anyPackage, { maxLength: 6 }), + shared: anyShared, + site: fc.tuple(anySiteContent, plainText).map(([site, replyTime]) => ({ + ...site, + contactForm: { ...site.contactForm, replyTime }, + })), + portfolioShoots: fc.subarray([...SHOOT_TYPE_IDS]), +}); + +// A shoot id (mostly one of the sources), the sources, and page content +// that mostly belongs to that shoot, its photos repeating the shoot's own +const viewCase = anySources.chain((given) => { + const ids = given.shootTypes.map((shoot) => shoot.id); + const id = + ids.length > 0 + ? fc.oneof( + { arbitrary: fc.constantFrom(...ids), weight: 4 }, + shootTypeId, + ) + : shootTypeId; + return id.chain((shootId) => { + const shoot = given.shootTypes.find((item) => item.id === shootId); + const reuse = + shoot === undefined + ? [] + : [ + shoot.image, + ...(shoot.detailImage ? [shoot.detailImage] : []), + ]; + return fc.record({ + id: fc.constant(shootId), + sources: fc.constant(given), + page: fc.oneof( + { arbitrary: shootPageContent(shootId, reuse), weight: 4 }, + shootPageContent(undefined, reuse), + ), + }); + }); +}); + +// A case for which the view exists +const resolvedCase = viewCase.filter( + ({ id, page, sources: given }) => + page.id === id && given.shootTypes.some((shoot) => shoot.id === id), +); + +const build = (c: { + id: Parameters<typeof shootPageView>[0]; + page: Parameters<typeof shootPageView>[1]; + sources: ShootPageSources; +}) => shootPageView(c.id, c.page, c.sources) as ShootPageView; + +const plain = (text: RichText) => + text.map((piece) => (typeof piece === 'string' ? piece : piece.text)); + +// Every text in which placeholders are filled in +const filledTexts = (view: ShootPageView) => [ + ...view.stories.flatMap((story) => [ + story.eyebrow, + story.title, + ...story.paragraphs.flatMap(plain), + ]), + ...view.process.steps.map((step) => step.text), + ...(view.faq?.items ?? []).flatMap((item) => [ + item.question, + ...plain(item.answer), + ]), + view.offer.depositNote, +]; + +// The photos the story blocks and the package block show +const usedElsewhere = (view: ShootPageView): ContentImage[] => [ + ...view.stories.flatMap((story) => + story.image === undefined ? [] : [story.image], + ), + view.offer.image, +]; + +describe('shootPageView with the real content', () => { + it('builds the newborn page with its package, filled texts and mosaic', () => { + const view = shootPageView('newborn', newbornPage, sources)!; + expect(view.path).toBe('/soorten-fotoshoots/newborn'); + expect(view.breadcrumb).toEqual({ + label: 'Kruimelpad', + items: [ + { label: 'Home', to: '/' }, + { label: 'Soorten fotoshoots', to: '/soorten-fotoshoots' }, + { label: 'Newborn', to: '/soorten-fotoshoots/newborn' }, + ], + }); + expect(view.offer.pkg?.price).toBe(185); + expect(view.offer.bookLink).toEqual({ + to: '/contact', + search: { pakket: 'newborn' }, + }); + expect(view.closing.link).toEqual(view.offer.bookLink); + expect(view.offer.askLink).toEqual({ to: '/contact' }); + expect(view.offer.depositNote).toBe( + `Aanbetaling €${NBSP}50, restbedrag na de shoot.`, + ); + expect(view.offer.image).toBe(shootTypes[0].detailImage); + expect(view.process.steps.map((step) => step.id)).toEqual( + PROCESS_STEP_ORDER, + ); + expect(view.process.steps[0].text).toBe( + 'Stuur een berichtje. Ik reageer binnen 1-2 werkdagen.', + ); + expect(view.process.steps[2].text).toBe( + `Met een aanbetaling van €${NBSP}50 staat je datum vast.`, + ); + expect(view.process.steps[3].text).toBe(newbornPage.process.duration); + // The sleeping baby is in a story block already (D14) + expect(view.photos?.images).toEqual( + newbornPage.photos.images.filter( + (image) => image.src !== sleepingBaby, + ), + ); + expect(view.photos?.images).toHaveLength(3); + expect(view.photos?.portfolioLink).toEqual({ + to: '/portfolio', + search: { shoot: 'newborn' }, + }); + expect(view.faq?.items.length).toBe(newbornPage.faq.items.length); + }); + + it('builds the loveshoot page without package and without mosaic', () => { + const view = shootPageView('loveshoot', loveshootPage, sources)!; + expect(view.offer.pkg).toBeUndefined(); + expect(view).not.toHaveProperty('offer.pkg'); + expect(view.offer.bookLink).toEqual({ to: '/contact' }); + expect(view.closing.link).toEqual({ to: '/contact' }); + expect(view.offer.onRequest.price).toBe('Prijs op aanvraag'); + expect(view.photos).toBeUndefined(); + expect(view.breadcrumb.items.at(-1)).toEqual({ + label: 'Loveshoot', + to: '/soorten-fotoshoots/loveshoot', + }); + }); + + it('gives undefined for a missing shoot type or content of another shoot', () => { + expect( + shootPageView('newborn', newbornPage, { + ...sources, + shootTypes: shootTypes.filter( + (shoot) => shoot.id !== 'newborn', + ), + }), + ).toBeUndefined(); + expect( + shootPageView('loveshoot', newbornPage, sources), + ).toBeUndefined(); + }); + + it('leaves out the FAQ without questions and the portfolio link when the portfolio does not show the shoot', () => { + const view = shootPageView( + 'newborn', + { ...newbornPage, faq: { ...newbornPage.faq, items: [] } }, + { ...sources, portfolioShoots: [] }, + )!; + expect(view.faq).toBeUndefined(); + expect(view.photos).toBeDefined(); + expect(view.photos).not.toHaveProperty('portfolioLink'); + }); +}); + +describe('shootPageView', () => { + it('is undefined exactly when the shoot type is missing or the content is of another shoot (invariant)', () => { + fc.assert( + fc.property(viewCase, ({ id, page, sources: given }) => { + const view = shootPageView(id, page, given); + const exists = + page.id === id && + given.shootTypes.some((shoot) => shoot.id === id); + expect(view !== undefined).toBe(exists); + if (view !== undefined) { + expect(view.id).toBe(id); + expect(view.shoot.id).toBe(id); + expect(view.path).toBe(shootPagePath(id)); + } + }), + ); + }); + + it('always has the six steps in their fixed order, whatever the content order (invariant)', () => { + fc.assert( + fc.property(resolvedCase, (c) => { + const view = build(c); + expect(view.process.steps.map((step) => step.id)).toEqual( + PROCESS_STEP_ORDER, + ); + view.process.steps.forEach((step) => { + expect(step.title).toBe( + c.sources.shared.process.steps[step.id].title, + ); + }); + }), + ); + }); + + it('leaves no known placeholder in any text (invariant)', () => { + fc.assert( + fc.property(resolvedCase, (c) => { + for (const text of filledTexts(build(c))) { + for (const name of knownPlaceholders) { + expect(text).not.toContain(`{${name}}`); + } + } + }), + ); + }); + + it('shows each remaining page photo once, in order, never one used elsewhere, or no photos below the minimum (invariant)', () => { + fc.assert( + fc.property(resolvedCase, (c) => { + const view = build(c); + const used = new Set(usedElsewhere(view).map((i) => i.src)); + const remaining = new Set( + c.page.photos.images + .map((image) => image.src) + .filter((src) => !used.has(src)), + ); + if (remaining.size < MOSAIC_MIN_PHOTOS) { + expect(view.photos).toBeUndefined(); + return; + } + const images = view.photos!.images; + const srcs = images.map((image) => image.src); + expect(new Set(srcs).size).toBe(srcs.length); + expect(new Set(srcs)).toEqual(remaining); + expect(srcs.some((src) => used.has(src))).toBe(false); + // An ordered subset: each photo is a page photo, found + // after the one before it + let from = 0; + for (const image of images) { + const at = c.page.photos.images.indexOf(image, from); + expect(at).toBeGreaterThanOrEqual(from); + from = at + 1; + } + }), + ); + }); + + it('shows the package exactly when shootPackage finds one (invariant)', () => { + fc.assert( + fc.property(resolvedCase, (c) => { + const view = build(c); + expect(view.offer.pkg).toBe( + shootPackage(view.shoot, c.sources.packages), + ); + }), + ); + }); + + it('only ever preselects a shown package (invariant)', () => { + fc.assert( + fc.property(resolvedCase, (c) => { + const view = build(c); + const shown = visiblePackages(c.sources.packages).map( + (pkg) => pkg.id, + ); + for (const link of [view.offer.bookLink, view.closing.link]) { + expect(link.to).toBe('/contact'); + if (link.search !== undefined) { + expect(shown).toContain(link.search.pakket); + expect(link.search.pakket).toBe(view.offer.pkg?.id); + } + } + }), + ); + }); + + it('ends the breadcrumb with this page, after Home and the overview (invariant)', () => { + fc.assert( + fc.property(resolvedCase, (c) => { + const view = build(c); + expect(view.breadcrumb.items.map((item) => item.to)).toEqual([ + '/', + '/soorten-fotoshoots', + view.path, + ]); + expect(view.breadcrumb.items.at(-1)?.label).toBe( + view.shoot.name, + ); + }), + ); + }); + + it('links the photos to the portfolio exactly when the portfolio shows the shoot (invariant)', () => { + fc.assert( + fc.property(resolvedCase, (c) => { + const view = build(c); + if (view.photos === undefined) return; + expect(view.photos.portfolioLink !== undefined).toBe( + c.sources.portfolioShoots.includes(c.id), + ); + }), + ); + }); + + it('has a FAQ exactly when there are questions, all of them in order (invariant)', () => { + fc.assert( + fc.property(resolvedCase, (c) => { + const view = build(c); + expect(view.faq !== undefined).toBe( + c.page.faq.items.length > 0, + ); + expect((view.faq?.items ?? []).map((item) => item.id)).toEqual( + c.page.faq.items.map((item) => item.id), + ); + }), + ); + }); +}); diff --git a/web/src/lib/shootPageView.ts b/web/src/lib/shootPageView.ts new file mode 100644 index 0000000..439d707 --- /dev/null +++ b/web/src/lib/shootPageView.ts @@ -0,0 +1,232 @@ +import type { + ContentImage, + FaqItem, + PricingPackage, + ProcessStepId, + RichText, + ShootPageContent, + ShootPageShared, + ShootType, + ShootTypeId, + SiteContent, + StoryBlock, +} from '../content/types.ts'; +import type { RoutePath } from '../navigation.ts'; +import { fillPlaceholders, fillRichText } from './fillPlaceholders.ts'; +import { formatPrice } from './formatPrice.ts'; +import { shootContactLink, shootPortfolioLink } from './shootLinks.ts'; +import { shootPackage } from './shootPackage.ts'; +import { + SHOOT_TYPES_PATH, + shootPagePath, + type ShootPagePath, +} from './shootPages.ts'; + +// The six steps of the process timeline, always in this order (FR-ST-04) +export const PROCESS_STEP_ORDER: readonly ProcessStepId[] = [ + 'aanvragen', + 'datum', + 'aanbetaling', + 'shoot', + 'bewerking', + 'oplevering', +]; + +// The fewest photos the photo section needs; with fewer left it is not +// shown (D15). Proposed 2, confirmed in Functional Design of unit 2. +export const MOSAIC_MIN_PHOTOS = 2; + +export interface BreadcrumbItem { + label: string; + to: RoutePath; +} + +export interface ProcessStep { + id: ProcessStepId; + title: string; + text: string; +} + +// Everything a shoot page is built from besides its own content +export interface ShootPageSources { + shootTypes: readonly ShootType[]; + packages: readonly PricingPackage[]; + shared: ShootPageShared; + site: SiteContent; + // The shoot types that link to the portfolio (live and with photos) + portfolioShoots: readonly ShootTypeId[]; +} + +// A shoot page with everything decided: placeholders filled, steps in +// order, photos chosen, package and links resolved. The sections and the +// structured data are both built from it, so they cannot disagree (D9). +export interface ShootPageView { + id: ShootTypeId; + path: ShootPagePath; + shoot: ShootType; + // The last item is this page + breadcrumb: { label: string; items: BreadcrumbItem[] }; + intro: ShootPageContent['intro']; + stories: StoryBlock[]; + // Always six, in PROCESS_STEP_ORDER + process: { + eyebrow: string; + title: string; + lead: string; + steps: ProcessStep[]; + }; + // Left out below MOSAIC_MIN_PHOTOS; no photo that is used elsewhere on + // the page + photos?: { + eyebrow: string; + title: string; + images: ContentImage[]; + portfolioLink?: ReturnType<typeof shootPortfolioLink>; + }; + // Left out when there are no questions + faq?: { eyebrow: string; title: string; lead: RichText; items: FaqItem[] }; + offer: { + eyebrow: string; + title: string; + // The shoot's detail photo, else its main photo + image: ContentImage; + // Present exactly when the shoot's package is shown + pkg?: PricingPackage; + onRequest: ShootPageShared['offer']['onRequest']; + bookLabel: string; + askLabel: string; + bookLink: ReturnType<typeof shootContactLink>; + askLink: { to: '/contact' }; + depositNote: string; + }; + closing: { + title: string; + lead: RichText; + buttonLabel: string; + link: ReturnType<typeof shootContactLink>; + }; +} + +// The page photos left for the photo section: without the photos the story +// blocks and the package block already show, each photo once, in their own +// order (D14) +function remainingPhotos( + photos: readonly ContentImage[], + usedElsewhere: readonly ContentImage[], +): ContentImage[] { + const taken = new Set(usedElsewhere.map((image) => image.src)); + return photos.filter((image) => { + if (taken.has(image.src)) return false; + taken.add(image.src); + return true; + }); +} + +// The view of one shoot page, or undefined when the shoot type is missing +// or the content belongs to another shoot; the route then shows the +// not-found page (SECURITY-15) +export function shootPageView( + id: ShootTypeId, + page: ShootPageContent, + sources: ShootPageSources, +): ShootPageView | undefined { + const shoot = sources.shootTypes.find((item) => item.id === id); + if (shoot === undefined || page.id !== id) return undefined; + + const { shared, site, packages } = sources; + const path = shootPagePath(id); + + // Every figure that is data comes from its own source (D8, NFR-ST-04) + const values = { + reactietermijn: site.contactForm.replyTime, + aanbetaling: formatPrice(shared.deposit.amount), + locatie: page.process.location, + duur: page.process.duration, + opleverduur: page.process.deliveryTime, + }; + const fill = (text: string) => fillPlaceholders(text, values); + + const stories = page.stories.map((story) => ({ + ...story, + eyebrow: fill(story.eyebrow), + title: fill(story.title), + paragraphs: story.paragraphs.map((text) => fillRichText(text, values)), + })); + const faqItems = page.faq.items.map((item) => ({ + ...item, + question: fill(item.question), + answer: fillRichText(item.answer, values), + })); + + const offerImage = shoot.detailImage ?? shoot.image; + const photos = remainingPhotos(page.photos.images, [ + ...stories.flatMap((story) => + story.image === undefined ? [] : [story.image], + ), + offerImage, + ]); + + const pkg = shootPackage(shoot, packages); + const contactLink = shootContactLink(shoot, packages); + + return { + id, + path, + shoot, + breadcrumb: { + label: shared.breadcrumb.label, + items: [ + { label: shared.breadcrumb.home, to: '/' }, + { label: shared.breadcrumb.overview, to: SHOOT_TYPES_PATH }, + { label: shoot.name, to: path }, + ], + }, + intro: page.intro, + stories, + process: { + eyebrow: shared.process.eyebrow, + title: shared.process.title, + lead: shared.process.lead, + steps: PROCESS_STEP_ORDER.map((stepId) => ({ + id: stepId, + title: shared.process.steps[stepId].title, + text: fill(shared.process.steps[stepId].text), + })), + }, + ...(photos.length >= MOSAIC_MIN_PHOTOS + ? { + photos: { + eyebrow: shared.photos.eyebrow, + title: page.photos.title, + images: photos, + ...(sources.portfolioShoots.includes(id) + ? { portfolioLink: shootPortfolioLink(shoot) } + : {}), + }, + } + : {}), + ...(faqItems.length > 0 + ? { + faq: { + eyebrow: shared.faq.eyebrow, + title: page.faq.title, + lead: shared.faq.lead, + items: faqItems, + }, + } + : {}), + offer: { + eyebrow: page.offer.eyebrow, + title: page.offer.title, + image: offerImage, + ...(pkg !== undefined ? { pkg } : {}), + onRequest: shared.offer.onRequest, + bookLabel: shared.offer.bookLabel, + askLabel: shared.offer.askLabel, + bookLink: contactLink, + askLink: { to: '/contact' }, + depositNote: fill(shared.deposit.note), + }, + closing: { ...page.closing, link: contactLink }, + }; +} diff --git a/web/src/lib/shootPages.test.ts b/web/src/lib/shootPages.test.ts new file mode 100644 index 0000000..cfba395 --- /dev/null +++ b/web/src/lib/shootPages.test.ts @@ -0,0 +1,131 @@ +import fc from 'fast-check'; +import { describe, expect, it } from 'vitest'; +import { shootTypeId, slugInput } from '../test/arbitraries'; +import { + SHOOT_TYPE_IDS, + SHOOT_TYPES_PATH, + shootIdFromPath, + shootIdFromSlug, + shootPagePath, +} from './shootPages'; + +// Paths as they could reach the app: a slug below the overview, with or +// without slashes after it, the overview itself, or anything else +const pathInput = fc.oneof( + fc + .tuple( + slugInput.filter((slug) => typeof slug === 'string'), + fc.constantFrom('', '/', '//'), + ) + .map(([slug, end]) => `${SHOOT_TYPES_PATH}/${slug as string}${end}`), + fc.constantFrom(SHOOT_TYPES_PATH, `${SHOOT_TYPES_PATH}/`, '/', ''), + fc.string(), +); + +describe('shootPagePath and SHOOT_TYPE_IDS', () => { + it('lists the five shoot types, each with a page below the overview', () => { + expect(SHOOT_TYPE_IDS).toEqual([ + 'newborn', + 'zwangerschap', + 'gezin', + 'loveshoot', + 'portret', + ]); + expect(SHOOT_TYPE_IDS.map(shootPagePath)).toEqual([ + '/soorten-fotoshoots/newborn', + '/soorten-fotoshoots/zwangerschap', + '/soorten-fotoshoots/gezin', + '/soorten-fotoshoots/loveshoot', + '/soorten-fotoshoots/portret', + ]); + }); +}); + +describe('shootIdFromSlug', () => { + it('knows every shoot type by its exact id', () => { + for (const id of SHOOT_TYPE_IDS) { + expect(shootIdFromSlug(id)).toBe(id); + } + }); + + it('ignores other cases, padding, slashes and non-text values', () => { + expect(shootIdFromSlug('Newborn')).toBeUndefined(); + expect(shootIdFromSlug(' newborn')).toBeUndefined(); + expect(shootIdFromSlug('newborn/')).toBeUndefined(); + expect(shootIdFromSlug('onzin')).toBeUndefined(); + expect(shootIdFromSlug('constructor')).toBeUndefined(); + expect(shootIdFromSlug(['newborn'])).toBeUndefined(); + expect(shootIdFromSlug(undefined)).toBeUndefined(); + }); + + it('gives back the id it was given (round trip)', () => { + fc.assert( + fc.property(shootTypeId, (id) => { + expect(shootIdFromSlug(id)).toBe(id); + }), + ); + }); + + it('gives a known id for exactly that slug, or undefined, and never throws (invariant)', () => { + fc.assert( + fc.property(slugInput, (slug) => { + const result = shootIdFromSlug(slug); + if (result !== undefined) { + expect(SHOOT_TYPE_IDS).toContain(result); + expect(result).toBe(slug); + } + }), + ); + }); +}); + +describe('shootIdFromPath', () => { + it('finds the shoot type of its page, with one trailing slash tolerated', () => { + expect(shootIdFromPath('/soorten-fotoshoots/newborn')).toBe('newborn'); + expect(shootIdFromPath('/soorten-fotoshoots/portret')).toBe('portret'); + expect(shootIdFromPath('/soorten-fotoshoots/newborn/')).toBe('newborn'); + }); + + it('gives undefined for any other path', () => { + expect(shootIdFromPath('/soorten-fotoshoots/onzin')).toBeUndefined(); + expect(shootIdFromPath('/soorten-fotoshoots')).toBeUndefined(); + expect(shootIdFromPath('/soorten-fotoshoots/')).toBeUndefined(); + expect(shootIdFromPath('/soorten-fotoshoots/Newborn')).toBeUndefined(); + expect( + shootIdFromPath('/soorten-fotoshoots/newborn/extra'), + ).toBeUndefined(); + expect( + shootIdFromPath('/soorten-fotoshoots/newborn//'), + ).toBeUndefined(); + expect( + shootIdFromPath('/soorten-fotoshoots%2Fnewborn'), + ).toBeUndefined(); + expect( + shootIdFromPath('/soorten-fotoshoots/newborn%2Fextra'), + ).toBeUndefined(); + expect(shootIdFromPath('/newborn')).toBeUndefined(); + expect(shootIdFromPath('')).toBeUndefined(); + }); + + it('gives back the id of every shoot page path (round trip)', () => { + fc.assert( + fc.property(shootTypeId, (id) => { + expect(shootIdFromPath(shootPagePath(id))).toBe(id); + }), + ); + }); + + it('gives a known id only for its exact page path, or undefined, and never throws (invariant)', () => { + fc.assert( + fc.property(pathInput, (path) => { + const result = shootIdFromPath(path); + if (result !== undefined) { + expect(SHOOT_TYPE_IDS).toContain(result); + expect(shootPagePath(result)).toBe( + path.endsWith('/') ? path.slice(0, -1) : path, + ); + } + }), + ); + }); +}); diff --git a/web/src/lib/shootPages.ts b/web/src/lib/shootPages.ts new file mode 100644 index 0000000..9821106 --- /dev/null +++ b/web/src/lib/shootPages.ts @@ -0,0 +1,51 @@ +import type { ShootTypeId } from '../content/types.ts'; +import type { RoutePath } from '../navigation.ts'; +import { isShootTypeId } from './portfolioFilters.ts'; + +// The overview of all shoot types; each shoot page is one level below it +export const SHOOT_TYPES_PATH = '/soorten-fotoshoots'; + +// Every shoot type id once. As a record, a new id in ShootTypeId is a type +// error until it is listed here. +const everyShootTypeId: Record<ShootTypeId, true> = { + newborn: true, + zwangerschap: true, + gezin: true, + loveshoot: true, + portret: true, +}; + +export const SHOOT_TYPE_IDS: readonly ShootTypeId[] = Object.keys( + everyShootTypeId, +) as ShootTypeId[]; + +export type ShootPagePath = `${typeof SHOOT_TYPES_PATH}/${ShootTypeId}`; + +// The page of one shoot type, e.g. '/soorten-fotoshoots/newborn' (FR-ST-01) +export function shootPagePath(id: ShootTypeId): ShootPagePath { + return `${SHOOT_TYPES_PATH}/${id}`; +} + +// The inverse: a known id for exactly a known slug (letter case, spaces and +// slashes count), anything else gives undefined; never throws (SECURITY-05) +export function shootIdFromSlug(slug: unknown): ShootTypeId | undefined { + return isShootTypeId(slug, SHOOT_TYPE_IDS) ? slug : undefined; +} + +// The shoot type of a shoot page path: exactly '/soorten-fotoshoots/<id>', +// with one trailing slash tolerated; any other path gives undefined +export function shootIdFromPath(pathname: string): ShootTypeId | undefined { + const prefix = `${SHOOT_TYPES_PATH}/`; + if (!pathname.startsWith(prefix)) return undefined; + const rest = pathname.slice(prefix.length); + return shootIdFromSlug(rest.endsWith('/') ? rest.slice(0, -1) : rest); +} + +type Assert<T extends true> = T; + +// Compile-time guard: every shoot page path is a route. A new shoot type +// without a route file is a type error here. Exported only because +// noUnusedLocals rejects an unused local type. +export type EveryShootHasARoute = Assert< + ShootPagePath extends RoutePath ? true : false +>; diff --git a/web/src/routeTree.gen.ts b/web/src/routeTree.gen.ts index f336be9..55c6803 100644 --- a/web/src/routeTree.gen.ts +++ b/web/src/routeTree.gen.ts @@ -14,7 +14,12 @@ import { Route as ContactRouteImport } from './routes/contact' import { Route as OverMijRouteImport } from './routes/over-mij' import { Route as PortfolioRouteImport } from './routes/portfolio' import { Route as PrivacyverklaringRouteImport } from './routes/privacyverklaring' -import { Route as SoortenFotoshootsRouteImport } from './routes/soorten-fotoshoots' +import { Route as SoortenFotoshootsIndexRouteImport } from './routes/soorten-fotoshoots/index' +import { Route as SoortenFotoshootsGezinRouteImport } from './routes/soorten-fotoshoots/gezin' +import { Route as SoortenFotoshootsLoveshootRouteImport } from './routes/soorten-fotoshoots/loveshoot' +import { Route as SoortenFotoshootsNewbornRouteImport } from './routes/soorten-fotoshoots/newborn' +import { Route as SoortenFotoshootsPortretRouteImport } from './routes/soorten-fotoshoots/portret' +import { Route as SoortenFotoshootsZwangerschapRouteImport } from './routes/soorten-fotoshoots/zwangerschap' const IndexRoute = IndexRouteImport.update({ id: '/', @@ -41,11 +46,40 @@ const PrivacyverklaringRoute = PrivacyverklaringRouteImport.update({ path: '/privacyverklaring', getParentRoute: () => rootRouteImport, } as any) -const SoortenFotoshootsRoute = SoortenFotoshootsRouteImport.update({ - id: '/soorten-fotoshoots', - path: '/soorten-fotoshoots', +const SoortenFotoshootsIndexRoute = SoortenFotoshootsIndexRouteImport.update({ + id: '/soorten-fotoshoots/', + path: '/soorten-fotoshoots/', getParentRoute: () => rootRouteImport, } as any) +const SoortenFotoshootsGezinRoute = SoortenFotoshootsGezinRouteImport.update({ + id: '/soorten-fotoshoots/gezin', + path: '/soorten-fotoshoots/gezin', + getParentRoute: () => rootRouteImport, +} as any) +const SoortenFotoshootsLoveshootRoute = + SoortenFotoshootsLoveshootRouteImport.update({ + id: '/soorten-fotoshoots/loveshoot', + path: '/soorten-fotoshoots/loveshoot', + getParentRoute: () => rootRouteImport, + } as any) +const SoortenFotoshootsNewbornRoute = + SoortenFotoshootsNewbornRouteImport.update({ + id: '/soorten-fotoshoots/newborn', + path: '/soorten-fotoshoots/newborn', + getParentRoute: () => rootRouteImport, + } as any) +const SoortenFotoshootsPortretRoute = + SoortenFotoshootsPortretRouteImport.update({ + id: '/soorten-fotoshoots/portret', + path: '/soorten-fotoshoots/portret', + getParentRoute: () => rootRouteImport, + } as any) +const SoortenFotoshootsZwangerschapRoute = + SoortenFotoshootsZwangerschapRouteImport.update({ + id: '/soorten-fotoshoots/zwangerschap', + path: '/soorten-fotoshoots/zwangerschap', + getParentRoute: () => rootRouteImport, + } as any) export interface FileRoutesByFullPath { '/': typeof IndexRoute @@ -53,7 +87,12 @@ export interface FileRoutesByFullPath { '/over-mij': typeof OverMijRoute '/portfolio': typeof PortfolioRoute '/privacyverklaring': typeof PrivacyverklaringRoute - '/soorten-fotoshoots': typeof SoortenFotoshootsRoute + '/soorten-fotoshoots/gezin': typeof SoortenFotoshootsGezinRoute + '/soorten-fotoshoots/loveshoot': typeof SoortenFotoshootsLoveshootRoute + '/soorten-fotoshoots/newborn': typeof SoortenFotoshootsNewbornRoute + '/soorten-fotoshoots/portret': typeof SoortenFotoshootsPortretRoute + '/soorten-fotoshoots/zwangerschap': typeof SoortenFotoshootsZwangerschapRoute + '/soorten-fotoshoots/': typeof SoortenFotoshootsIndexRoute } export interface FileRoutesByTo { '/': typeof IndexRoute @@ -61,7 +100,12 @@ export interface FileRoutesByTo { '/over-mij': typeof OverMijRoute '/portfolio': typeof PortfolioRoute '/privacyverklaring': typeof PrivacyverklaringRoute - '/soorten-fotoshoots': typeof SoortenFotoshootsRoute + '/soorten-fotoshoots/gezin': typeof SoortenFotoshootsGezinRoute + '/soorten-fotoshoots/loveshoot': typeof SoortenFotoshootsLoveshootRoute + '/soorten-fotoshoots/newborn': typeof SoortenFotoshootsNewbornRoute + '/soorten-fotoshoots/portret': typeof SoortenFotoshootsPortretRoute + '/soorten-fotoshoots/zwangerschap': typeof SoortenFotoshootsZwangerschapRoute + '/soorten-fotoshoots': typeof SoortenFotoshootsIndexRoute } export interface FileRoutesById { __root__: typeof rootRouteImport @@ -70,7 +114,12 @@ export interface FileRoutesById { '/over-mij': typeof OverMijRoute '/portfolio': typeof PortfolioRoute '/privacyverklaring': typeof PrivacyverklaringRoute - '/soorten-fotoshoots': typeof SoortenFotoshootsRoute + '/soorten-fotoshoots/gezin': typeof SoortenFotoshootsGezinRoute + '/soorten-fotoshoots/loveshoot': typeof SoortenFotoshootsLoveshootRoute + '/soorten-fotoshoots/newborn': typeof SoortenFotoshootsNewbornRoute + '/soorten-fotoshoots/portret': typeof SoortenFotoshootsPortretRoute + '/soorten-fotoshoots/zwangerschap': typeof SoortenFotoshootsZwangerschapRoute + '/soorten-fotoshoots/': typeof SoortenFotoshootsIndexRoute } export interface FileRouteTypes { fileRoutesByFullPath: FileRoutesByFullPath @@ -80,7 +129,12 @@ export interface FileRouteTypes { | '/over-mij' | '/portfolio' | '/privacyverklaring' - | '/soorten-fotoshoots' + | '/soorten-fotoshoots/gezin' + | '/soorten-fotoshoots/loveshoot' + | '/soorten-fotoshoots/newborn' + | '/soorten-fotoshoots/portret' + | '/soorten-fotoshoots/zwangerschap' + | '/soorten-fotoshoots/' fileRoutesByTo: FileRoutesByTo to: | '/' @@ -88,6 +142,11 @@ export interface FileRouteTypes { | '/over-mij' | '/portfolio' | '/privacyverklaring' + | '/soorten-fotoshoots/gezin' + | '/soorten-fotoshoots/loveshoot' + | '/soorten-fotoshoots/newborn' + | '/soorten-fotoshoots/portret' + | '/soorten-fotoshoots/zwangerschap' | '/soorten-fotoshoots' id: | '__root__' @@ -96,7 +155,12 @@ export interface FileRouteTypes { | '/over-mij' | '/portfolio' | '/privacyverklaring' - | '/soorten-fotoshoots' + | '/soorten-fotoshoots/gezin' + | '/soorten-fotoshoots/loveshoot' + | '/soorten-fotoshoots/newborn' + | '/soorten-fotoshoots/portret' + | '/soorten-fotoshoots/zwangerschap' + | '/soorten-fotoshoots/' fileRoutesById: FileRoutesById } export interface RootRouteChildren { @@ -105,7 +169,12 @@ export interface RootRouteChildren { OverMijRoute: typeof OverMijRoute PortfolioRoute: typeof PortfolioRoute PrivacyverklaringRoute: typeof PrivacyverklaringRoute - SoortenFotoshootsRoute: typeof SoortenFotoshootsRoute + SoortenFotoshootsGezinRoute: typeof SoortenFotoshootsGezinRoute + SoortenFotoshootsLoveshootRoute: typeof SoortenFotoshootsLoveshootRoute + SoortenFotoshootsNewbornRoute: typeof SoortenFotoshootsNewbornRoute + SoortenFotoshootsPortretRoute: typeof SoortenFotoshootsPortretRoute + SoortenFotoshootsZwangerschapRoute: typeof SoortenFotoshootsZwangerschapRoute + SoortenFotoshootsIndexRoute: typeof SoortenFotoshootsIndexRoute } declare module '@tanstack/react-router' { @@ -145,11 +214,46 @@ declare module '@tanstack/react-router' { preLoaderRoute: typeof PrivacyverklaringRouteImport parentRoute: typeof rootRouteImport } - '/soorten-fotoshoots': { - id: '/soorten-fotoshoots' + '/soorten-fotoshoots/': { + id: '/soorten-fotoshoots/' path: '/soorten-fotoshoots' - fullPath: '/soorten-fotoshoots' - preLoaderRoute: typeof SoortenFotoshootsRouteImport + fullPath: '/soorten-fotoshoots/' + preLoaderRoute: typeof SoortenFotoshootsIndexRouteImport + parentRoute: typeof rootRouteImport + } + '/soorten-fotoshoots/gezin': { + id: '/soorten-fotoshoots/gezin' + path: '/soorten-fotoshoots/gezin' + fullPath: '/soorten-fotoshoots/gezin' + preLoaderRoute: typeof SoortenFotoshootsGezinRouteImport + parentRoute: typeof rootRouteImport + } + '/soorten-fotoshoots/loveshoot': { + id: '/soorten-fotoshoots/loveshoot' + path: '/soorten-fotoshoots/loveshoot' + fullPath: '/soorten-fotoshoots/loveshoot' + preLoaderRoute: typeof SoortenFotoshootsLoveshootRouteImport + parentRoute: typeof rootRouteImport + } + '/soorten-fotoshoots/newborn': { + id: '/soorten-fotoshoots/newborn' + path: '/soorten-fotoshoots/newborn' + fullPath: '/soorten-fotoshoots/newborn' + preLoaderRoute: typeof SoortenFotoshootsNewbornRouteImport + parentRoute: typeof rootRouteImport + } + '/soorten-fotoshoots/portret': { + id: '/soorten-fotoshoots/portret' + path: '/soorten-fotoshoots/portret' + fullPath: '/soorten-fotoshoots/portret' + preLoaderRoute: typeof SoortenFotoshootsPortretRouteImport + parentRoute: typeof rootRouteImport + } + '/soorten-fotoshoots/zwangerschap': { + id: '/soorten-fotoshoots/zwangerschap' + path: '/soorten-fotoshoots/zwangerschap' + fullPath: '/soorten-fotoshoots/zwangerschap' + preLoaderRoute: typeof SoortenFotoshootsZwangerschapRouteImport parentRoute: typeof rootRouteImport } } @@ -161,7 +265,12 @@ const rootRouteChildren: RootRouteChildren = { OverMijRoute: OverMijRoute, PortfolioRoute: PortfolioRoute, PrivacyverklaringRoute: PrivacyverklaringRoute, - SoortenFotoshootsRoute: SoortenFotoshootsRoute, + SoortenFotoshootsGezinRoute: SoortenFotoshootsGezinRoute, + SoortenFotoshootsLoveshootRoute: SoortenFotoshootsLoveshootRoute, + SoortenFotoshootsNewbornRoute: SoortenFotoshootsNewbornRoute, + SoortenFotoshootsPortretRoute: SoortenFotoshootsPortretRoute, + SoortenFotoshootsZwangerschapRoute: SoortenFotoshootsZwangerschapRoute, + SoortenFotoshootsIndexRoute: SoortenFotoshootsIndexRoute, } export const routeTree = rootRouteImport ._addFileChildren(rootRouteChildren) diff --git a/web/src/routes/soorten-fotoshoots/-shootPageSources.ts b/web/src/routes/soorten-fotoshoots/-shootPageSources.ts new file mode 100644 index 0000000..9a7b007 --- /dev/null +++ b/web/src/routes/soorten-fotoshoots/-shootPageSources.ts @@ -0,0 +1,24 @@ +import packages from '../../content/packages'; +import portfolioContent from '../../content/portfolioContent'; +import shootPageShared from '../../content/shootPageShared'; +import shootTypes from '../../content/shootTypes'; +import siteContent from '../../content/siteContent'; +import { shootTypesWithPhotos } from '../../lib/portfolioFilters'; +import type { ShootPageSources } from '../../lib/shootPageView'; +import { isPortfolioLive } from '../../lib/shootLinks'; +import sitePages from '../../sitePages'; + +// What every shoot page is built from besides its own content. The file +// name starts with '-' so the router does not take it for a route. +export const shootPageSources: ShootPageSources = { + shootTypes, + packages, + shared: shootPageShared, + site: siteContent, + // Same as on the overview: only shoots with photos in a live portfolio + portfolioShoots: isPortfolioLive(sitePages) + ? shootTypesWithPhotos(shootTypes, portfolioContent.photos).map( + (type) => type.id, + ) + : [], +}; diff --git a/web/src/routes/soorten-fotoshoots/gezin.tsx b/web/src/routes/soorten-fotoshoots/gezin.tsx new file mode 100644 index 0000000..9cc9251 --- /dev/null +++ b/web/src/routes/soorten-fotoshoots/gezin.tsx @@ -0,0 +1,30 @@ +import { createFileRoute } from '@tanstack/react-router'; +import NotFound from '../../components/StatusPage/NotFound'; +import ShootPage from '../../components/shoots/ShootPage/ShootPage'; +import StructuredData from '../../components/StructuredData/StructuredData'; +import gezinPage from '../../content/shootPages/gezin'; +import siteContent from '../../content/siteContent'; +import { shootPageView } from '../../lib/shootPageView'; +import { pageHead, shootPageGraph } from '../../seo'; +import { shootPageSources } from './-shootPageSources'; + +export const Route = createFileRoute('/soorten-fotoshoots/gezin')({ + head: () => pageHead('/soorten-fotoshoots/gezin'), + component: GezinPage, +}); + +// The gezin page. The structured data lives here, not in head(): head() is +// part of the main bundle, the component is split off, so the page texts +// only load with this page. +function GezinPage() { + const view = shootPageView('gezin', gezinPage, shootPageSources); + if (view === undefined) return <NotFound />; + return ( + <> + {shootPageGraph(view, siteContent).map((data) => ( + <StructuredData key={data['@type']} data={data} /> + ))} + <ShootPage view={view} /> + </> + ); +} diff --git a/web/src/routes/soorten-fotoshoots.tsx b/web/src/routes/soorten-fotoshoots/index.tsx similarity index 57% rename from web/src/routes/soorten-fotoshoots.tsx rename to web/src/routes/soorten-fotoshoots/index.tsx index 83acbe2..2e00b29 100644 --- a/web/src/routes/soorten-fotoshoots.tsx +++ b/web/src/routes/soorten-fotoshoots/index.tsx @@ -1,20 +1,21 @@ import { createFileRoute } from '@tanstack/react-router'; -import CallToAction from '../components/CallToAction/CallToAction'; -import LinkButton from '../components/LinkButton'; -import PageIntro from '../components/PageIntro/PageIntro'; -import RichParagraph from '../components/RichParagraph/RichParagraph'; -import ShootList from '../components/shoots/ShootList/ShootList'; -import packages from '../content/packages'; -import portfolioContent from '../content/portfolioContent'; -import shootTypes from '../content/shootTypes'; -import shootTypesPageContent from '../content/shootTypesPageContent'; -import siteContent from '../content/siteContent'; -import { shootTypesWithPhotos } from '../lib/portfolioFilters'; -import { isPortfolioLive } from '../lib/shootLinks'; -import { jsonLdScript, pageHead, shootServices, webPage } from '../seo'; -import sitePages from '../sitePages'; +import CallToAction from '../../components/CallToAction/CallToAction'; +import LinkButton from '../../components/LinkButton'; +import PageIntro from '../../components/PageIntro/PageIntro'; +import RichParagraph from '../../components/RichParagraph/RichParagraph'; +import ShootList from '../../components/shoots/ShootList/ShootList'; +import StructuredData from '../../components/StructuredData/StructuredData'; +import packages from '../../content/packages'; +import portfolioContent from '../../content/portfolioContent'; +import shootTypes from '../../content/shootTypes'; +import shootTypesPageContent from '../../content/shootTypesPageContent'; +import siteContent from '../../content/siteContent'; +import { shootTypesWithPhotos } from '../../lib/portfolioFilters'; +import { isPortfolioLive } from '../../lib/shootLinks'; +import { pageHead, shootServices, webPage } from '../../seo'; +import sitePages from '../../sitePages'; -export const Route = createFileRoute('/soorten-fotoshoots')({ +export const Route = createFileRoute('/soorten-fotoshoots/')({ head: () => pageHead('/soorten-fotoshoots'), component: PhotoshootTypes, }); @@ -28,16 +29,11 @@ function PhotoshootTypes() { {/* The structured data lives here, not in head(): head() is part of the main bundle, the component is split off, so the shoot texts only load with this page. Google reads JSON-LD anywhere - in the page; jsonLdScript escapes <, > and &. */} - <script - type="application/ld+json" - dangerouslySetInnerHTML={{ - __html: jsonLdScript( - webPage('WebPage', '/soorten-fotoshoots', { - mainEntity: shootServices(shootTypes, siteContent), - }), - ), - }} + in the page; StructuredData escapes <, > and &. */} + <StructuredData + data={webPage('WebPage', '/soorten-fotoshoots', { + mainEntity: shootServices(shootTypes, siteContent), + })} /> <PageIntro eyebrow={head.eyebrow} title={head.title}> {head.intro} diff --git a/web/src/routes/soorten-fotoshoots/loveshoot.tsx b/web/src/routes/soorten-fotoshoots/loveshoot.tsx new file mode 100644 index 0000000..c86f5f6 --- /dev/null +++ b/web/src/routes/soorten-fotoshoots/loveshoot.tsx @@ -0,0 +1,30 @@ +import { createFileRoute } from '@tanstack/react-router'; +import NotFound from '../../components/StatusPage/NotFound'; +import ShootPage from '../../components/shoots/ShootPage/ShootPage'; +import StructuredData from '../../components/StructuredData/StructuredData'; +import loveshootPage from '../../content/shootPages/loveshoot'; +import siteContent from '../../content/siteContent'; +import { shootPageView } from '../../lib/shootPageView'; +import { pageHead, shootPageGraph } from '../../seo'; +import { shootPageSources } from './-shootPageSources'; + +export const Route = createFileRoute('/soorten-fotoshoots/loveshoot')({ + head: () => pageHead('/soorten-fotoshoots/loveshoot'), + component: LoveshootPage, +}); + +// The loveshoot page. The structured data lives here, not in head(): head() is +// part of the main bundle, the component is split off, so the page texts +// only load with this page. +function LoveshootPage() { + const view = shootPageView('loveshoot', loveshootPage, shootPageSources); + if (view === undefined) return <NotFound />; + return ( + <> + {shootPageGraph(view, siteContent).map((data) => ( + <StructuredData key={data['@type']} data={data} /> + ))} + <ShootPage view={view} /> + </> + ); +} diff --git a/web/src/routes/soorten-fotoshoots/newborn.tsx b/web/src/routes/soorten-fotoshoots/newborn.tsx new file mode 100644 index 0000000..863694e --- /dev/null +++ b/web/src/routes/soorten-fotoshoots/newborn.tsx @@ -0,0 +1,30 @@ +import { createFileRoute } from '@tanstack/react-router'; +import NotFound from '../../components/StatusPage/NotFound'; +import ShootPage from '../../components/shoots/ShootPage/ShootPage'; +import StructuredData from '../../components/StructuredData/StructuredData'; +import newbornPage from '../../content/shootPages/newborn'; +import siteContent from '../../content/siteContent'; +import { shootPageView } from '../../lib/shootPageView'; +import { pageHead, shootPageGraph } from '../../seo'; +import { shootPageSources } from './-shootPageSources'; + +export const Route = createFileRoute('/soorten-fotoshoots/newborn')({ + head: () => pageHead('/soorten-fotoshoots/newborn'), + component: NewbornPage, +}); + +// The newborn page. The structured data lives here, not in head(): head() is +// part of the main bundle, the component is split off, so the page texts +// only load with this page. +function NewbornPage() { + const view = shootPageView('newborn', newbornPage, shootPageSources); + if (view === undefined) return <NotFound />; + return ( + <> + {shootPageGraph(view, siteContent).map((data) => ( + <StructuredData key={data['@type']} data={data} /> + ))} + <ShootPage view={view} /> + </> + ); +} diff --git a/web/src/routes/soorten-fotoshoots/portret.tsx b/web/src/routes/soorten-fotoshoots/portret.tsx new file mode 100644 index 0000000..607c3b2 --- /dev/null +++ b/web/src/routes/soorten-fotoshoots/portret.tsx @@ -0,0 +1,30 @@ +import { createFileRoute } from '@tanstack/react-router'; +import NotFound from '../../components/StatusPage/NotFound'; +import ShootPage from '../../components/shoots/ShootPage/ShootPage'; +import StructuredData from '../../components/StructuredData/StructuredData'; +import portretPage from '../../content/shootPages/portret'; +import siteContent from '../../content/siteContent'; +import { shootPageView } from '../../lib/shootPageView'; +import { pageHead, shootPageGraph } from '../../seo'; +import { shootPageSources } from './-shootPageSources'; + +export const Route = createFileRoute('/soorten-fotoshoots/portret')({ + head: () => pageHead('/soorten-fotoshoots/portret'), + component: PortretPage, +}); + +// The portret page. The structured data lives here, not in head(): head() is +// part of the main bundle, the component is split off, so the page texts +// only load with this page. +function PortretPage() { + const view = shootPageView('portret', portretPage, shootPageSources); + if (view === undefined) return <NotFound />; + return ( + <> + {shootPageGraph(view, siteContent).map((data) => ( + <StructuredData key={data['@type']} data={data} /> + ))} + <ShootPage view={view} /> + </> + ); +} diff --git a/web/src/routes/soorten-fotoshoots/zwangerschap.tsx b/web/src/routes/soorten-fotoshoots/zwangerschap.tsx new file mode 100644 index 0000000..754ecbe --- /dev/null +++ b/web/src/routes/soorten-fotoshoots/zwangerschap.tsx @@ -0,0 +1,34 @@ +import { createFileRoute } from '@tanstack/react-router'; +import NotFound from '../../components/StatusPage/NotFound'; +import ShootPage from '../../components/shoots/ShootPage/ShootPage'; +import StructuredData from '../../components/StructuredData/StructuredData'; +import zwangerschapPage from '../../content/shootPages/zwangerschap'; +import siteContent from '../../content/siteContent'; +import { shootPageView } from '../../lib/shootPageView'; +import { pageHead, shootPageGraph } from '../../seo'; +import { shootPageSources } from './-shootPageSources'; + +export const Route = createFileRoute('/soorten-fotoshoots/zwangerschap')({ + head: () => pageHead('/soorten-fotoshoots/zwangerschap'), + component: ZwangerschapPage, +}); + +// The zwangerschap page. The structured data lives here, not in head(): head() is +// part of the main bundle, the component is split off, so the page texts +// only load with this page. +function ZwangerschapPage() { + const view = shootPageView( + 'zwangerschap', + zwangerschapPage, + shootPageSources, + ); + if (view === undefined) return <NotFound />; + return ( + <> + {shootPageGraph(view, siteContent).map((data) => ( + <StructuredData key={data['@type']} data={data} /> + ))} + <ShootPage view={view} /> + </> + ); +} diff --git a/web/src/seo.test.ts b/web/src/seo.test.ts index b2e7a12..5026580 100644 --- a/web/src/seo.test.ts +++ b/web/src/seo.test.ts @@ -1,26 +1,38 @@ import fc from 'fast-check'; import { describe, expect, it } from 'vitest'; import aboutContent from './content/aboutContent'; +import packages from './content/packages'; import portfolioContent from './content/portfolioContent'; +import shootPageShared from './content/shootPageShared'; +import loveshootPage from './content/shootPages/loveshoot'; +import newbornPage from './content/shootPages/newborn'; import shootTypes from './content/shootTypes'; import siteContent from './content/siteContent'; import { emailAddress } from './lib/emailAddress'; +import { richTextToPlain } from './lib/richTextToPlain'; +import { shootPagePath } from './lib/shootPages'; +import { shootPageView, type ShootPageView } from './lib/shootPageView'; import { visibleSocials } from './lib/visibleSocials'; import type { RoutePath } from './navigation'; import { aboutPage, absoluteUrl, areaServed, + breadcrumbList, businessId, canonicalUrl, contactPage, defaultOgImage, + faqPage, galleryImages, jsonLdScript, pageHead, person, personId, professionalService, + shootPageGraph, + shootService, + shootServiceId, shootServices, siteHead, siteUrl, @@ -31,9 +43,17 @@ import { import sitePages from './sitePages'; import { anySiteContent, + faqItems, + knownRoutePath, knowsAboutEntries, + plainText, portfolioPhotos, + pricingPackage, routePath, + shootPageContent, + shootPageShared as anyShared, + shootType, + shootTypeId, uniqueShootTypes, } from './test/arbitraries'; @@ -487,11 +507,18 @@ describe('shootServices', () => { expect(list.numberOfItems).toBe(5); const services = list.itemListElement.map((element) => element.item); expect(services.map((service) => service['@id'])).toEqual([ - `${page}#newborn`, - `${page}#zwangerschap`, - `${page}#gezin`, - `${page}#loveshoot`, - `${page}#portret`, + `${page}/newborn#service`, + `${page}/zwangerschap#service`, + `${page}/gezin#service`, + `${page}/loveshoot#service`, + `${page}/portret#service`, + ]); + expect(services.map((service) => service.url)).toEqual([ + `${page}/newborn`, + `${page}/zwangerschap`, + `${page}/gezin`, + `${page}/loveshoot`, + `${page}/portret`, ]); expect(services[0]).toMatchObject({ '@type': 'Service', @@ -532,16 +559,21 @@ describe('shootServices', () => { ); }); - it('gives every service its own anchor as @id (invariant)', () => { + it('gives every service the id and URL of its own shoot page (invariant)', () => { fc.assert( fc.property(uniqueShootTypes, anySiteContent, (shoots, site) => { - const ids = shootServices(shoots, site).itemListElement.map( - (element) => element.item['@id'], - ); + const services = shootServices( + shoots, + site, + ).itemListElement.map((element) => element.item); + const ids = services.map((service) => service['@id']); expect(new Set(ids).size).toBe(ids.length); - ids.forEach((id, index) => - expect(id).toBe(`${page}#${shoots[index].id}`), - ); + services.forEach((service, index) => { + expect(service['@id']).toBe( + `${page}/${shoots[index].id}#service`, + ); + expect(service.url).toBe(`${page}/${shoots[index].id}`); + }); }), ); }); @@ -578,6 +610,275 @@ describe('shootServices', () => { }); }); +// A shoot type with hostile text where the structured data shows it +const hostileShoot = fc + .tuple(shootType, plainText, plainText) + .map(([shoot, label, description]) => ({ + ...shoot, + shootLabel: label, + paragraphs: [description, ...shoot.paragraphs], + })); + +// Breadcrumb items as a page could have them: known routes, hostile labels +const breadcrumbItems = fc.array( + fc.record({ label: plainText, to: knownRoutePath }), + { maxLength: 5 }, +); + +// The view of a shoot page from the real shoot types and packages, with +// any shared texts, site content and page content +const anyView = fc + .tuple(shootTypeId, anyShared, anySiteContent) + .chain(([id, shared, site]) => + shootPageContent(id).map( + (page) => + shootPageView(id, page, { + shootTypes, + packages, + shared, + site, + portfolioShoots: [], + }) as ShootPageView, + ), + ); + +const realView = (id: 'newborn' | 'loveshoot') => + shootPageView(id, id === 'newborn' ? newbornPage : loveshootPage, { + shootTypes, + packages, + shared: shootPageShared, + site: siteContent, + portfolioShoots: [], + })!; + +// Survives the script tag unchanged, and never writes a markup character +// or the e-mail address +const expectSafeScript = (data: unknown, site: typeof siteContent) => { + const script = jsonLdScript(data); + expect(JSON.parse(script)).toEqual(data); + expect(/[<>&]/.test(script)).toBe(false); + const address = emailAddress(site.email); + if (address !== null) expect(script).not.toContain(address); +}; + +describe('shootService', () => { + it('describes the newborn shoot with the offer of its package', () => { + const newbornPackage = packages.find((pkg) => pkg.id === 'newborn'); + expect( + shootService(shootTypes[0], siteContent, newbornPackage), + ).toMatchObject({ + '@type': 'Service', + '@id': `${siteUrl}/soorten-fotoshoots/newborn#service`, + url: `${siteUrl}/soorten-fotoshoots/newborn`, + name: 'Newbornshoot', + offers: { '@type': 'Offer', price: 185, priceCurrency: 'EUR' }, + }); + expect(shootServiceId('portret')).toBe( + `${siteUrl}/soorten-fotoshoots/portret#service`, + ); + }); + + it('is the same service on the overview and on the shoot page, with an offer only for a package (invariant)', () => { + fc.assert( + fc.property( + uniqueShootTypes, + anySiteContent, + fc.option(pricingPackage, { nil: undefined }), + (shoots, site, pkg) => { + const overview = shootServices( + shoots, + site, + ).itemListElement; + shoots.forEach((shoot, index) => { + const service = shootService(shoot, site, pkg); + expect(overview[index].item['@id']).toBe( + service['@id'], + ); + expect(service['@id']).toBe(shootServiceId(shoot.id)); + expect(service.url).toBe( + canonicalUrl(shootPagePath(shoot.id)), + ); + expect('offers' in service).toBe(pkg !== undefined); + if (pkg !== undefined) { + expect(service.offers).toEqual({ + '@type': 'Offer', + price: pkg.price, + priceCurrency: 'EUR', + }); + } + }); + }, + ), + ); + }); + + it('survives the script tag, without markup characters or e-mail address (round trip, invariant)', () => { + fc.assert( + fc.property( + hostileShoot, + anySiteContent, + fc.option(pricingPackage, { nil: undefined }), + (shoot, site, pkg) => { + expectSafeScript(shootService(shoot, site, pkg), site); + expectSafeScript(shootServices([shoot], site), site); + }, + ), + ); + }); +}); + +describe('breadcrumbList', () => { + it('numbers the items from 1, with absolute URLs and the labels in order (invariant)', () => { + fc.assert( + fc.property(breadcrumbItems, (items) => { + const list = breadcrumbList(items); + expect(list['@type']).toBe('BreadcrumbList'); + expect( + list.itemListElement.map((element) => element.position), + ).toEqual(items.map((_, index) => index + 1)); + expect( + list.itemListElement.map((element) => element.name), + ).toEqual(items.map((item) => item.label)); + list.itemListElement.forEach((element, index) => { + expect(element.item.startsWith(`${siteUrl}/`)).toBe(true); + expect(element.item).toBe(canonicalUrl(items[index].to)); + }); + }), + ); + }); + + it('survives the script tag, without markup characters (round trip, invariant)', () => { + fc.assert( + fc.property(breadcrumbItems, (items) => { + expectSafeScript(breadcrumbList(items), siteContent); + }), + ); + }); +}); + +describe('faqPage', () => { + it('is left out without questions', () => { + expect(faqPage('/contact', [])).toBeUndefined(); + }); + + it('has one question per item in order, answered by its visible text (invariant)', () => { + fc.assert( + fc.property(knownRoutePath, faqItems, (path, items) => { + const data = faqPage(path, items); + if (data === undefined) { + expect(items).toHaveLength(0); + return; + } + expect(data.isPartOf).toEqual({ '@id': canonicalUrl(path) }); + expect(data.mainEntity).toEqual( + items.map((item) => ({ + '@type': 'Question', + name: item.question, + acceptedAnswer: { + '@type': 'Answer', + text: richTextToPlain(item.answer), + }, + })), + ); + }), + ); + }); + + it('survives the script tag, without markup characters (round trip, invariant)', () => { + fc.assert( + fc.property(knownRoutePath, faqItems, (path, items) => { + expectSafeScript(faqPage(path, items) ?? null, siteContent); + }), + ); + }); +}); + +describe('shootPageGraph', () => { + it('describes the newborn page: its service with the package price, the breadcrumb and the FAQ', () => { + const [page, faq] = shootPageGraph(realView('newborn'), siteContent); + expect(page).toMatchObject({ + '@type': 'WebPage', + '@id': `${siteUrl}/soorten-fotoshoots/newborn`, + mainEntity: { + '@type': 'Service', + '@id': `${siteUrl}/soorten-fotoshoots/newborn#service`, + url: `${siteUrl}/soorten-fotoshoots/newborn`, + offers: { '@type': 'Offer', price: 185, priceCurrency: 'EUR' }, + }, + breadcrumb: { + '@type': 'BreadcrumbList', + itemListElement: [ + { position: 1, name: 'Home', item: `${siteUrl}/` }, + { + position: 2, + name: 'Soorten fotoshoots', + item: `${siteUrl}/soorten-fotoshoots`, + }, + { + position: 3, + name: 'Newborn', + item: `${siteUrl}/soorten-fotoshoots/newborn`, + }, + ], + }, + }); + expect(faq).toMatchObject({ + '@type': 'FAQPage', + isPartOf: { '@id': `${siteUrl}/soorten-fotoshoots/newborn` }, + }); + expect(faq).toHaveProperty( + 'mainEntity.length', + newbornPage.faq.items.length, + ); + }); + + it('describes the loveshoot page without an offer', () => { + const graph = shootPageGraph(realView('loveshoot'), siteContent); + expect(graph.map((data) => data['@type'])).toEqual([ + 'WebPage', + 'FAQPage', + ]); + expect(graph[0]).not.toHaveProperty('mainEntity.offers'); + expect(JSON.stringify(graph)).not.toMatch(/"(offers|price)"/); + }); + + it('has the page, and the FAQPage exactly when the page has questions (invariant)', () => { + fc.assert( + fc.property(anyView, anySiteContent, (view, site) => { + const [page, ...rest] = shootPageGraph(view, site); + expect(rest).toHaveLength(view.faq === undefined ? 0 : 1); + expect(page).toHaveProperty(['@id'], canonicalUrl(view.path)); + expect(page).toHaveProperty( + ['mainEntity', '@id'], + shootServiceId(view.id), + ); + expect(page).toHaveProperty( + 'breadcrumb', + breadcrumbList(view.breadcrumb.items), + ); + if (view.offer.pkg === undefined) { + expect(page).not.toHaveProperty('mainEntity.offers'); + } else { + expect(page).toHaveProperty( + 'mainEntity.offers.price', + view.offer.pkg.price, + ); + } + }), + ); + }); + + it('survives the script tag, without markup characters or e-mail address (round trip, invariant)', () => { + fc.assert( + fc.property(anyView, anySiteContent, (view, site) => { + for (const data of shootPageGraph(view, site)) { + expectSafeScript(data, site); + } + }), + ); + }); +}); + describe('the contact page', () => { it('is indexed, with its own title, description and preview image', () => { const head = pageHead('/contact'); diff --git a/web/src/seo.ts b/web/src/seo.ts index da1ebc8..c849853 100644 --- a/web/src/seo.ts +++ b/web/src/seo.ts @@ -2,12 +2,18 @@ // Titels en beschrijvingen staan in het pagina-register (sitePages.ts). import type { AboutPageContent, + FaqItem, PortfolioPhoto, + PricingPackage, ServiceArea, ShootType, + ShootTypeId, SiteContent, } from './content/types.ts'; import { knowsAboutList } from './lib/knowsAboutList.ts'; +import { richTextToPlain } from './lib/richTextToPlain.ts'; +import { shootPagePath } from './lib/shootPages.ts'; +import type { BreadcrumbItem, ShootPageView } from './lib/shootPageView.ts'; import { visibleSocials } from './lib/visibleSocials.ts'; import type { RoutePath } from './navigation.ts'; import sitePages from './sitePages.ts'; @@ -182,33 +188,105 @@ export function absoluteUrl(src: string): string { : siteUrl + (src.startsWith('/') ? src : `/${src}`); } +// One stable id per shoot service, used by the overview's list and by the +// shoot page itself, so search engines see one entity (SEO-ST-03, D2) +export function shootServiceId(id: ShootTypeId): string { + return `${canonicalUrl(shootPagePath(id))}#service`; +} + +// A shoot type as a service of the business; its page is the shoot page. +// The offer with its price only when the page shows that package (pkg), so +// "Prijs op aanvraag" never gets one (SEO-ST-03). +export function shootService( + shoot: ShootType, + site: SiteContent, + pkg?: PricingPackage, +) { + return { + '@type': 'Service', + '@id': shootServiceId(shoot.id), + url: canonicalUrl(shootPagePath(shoot.id)), + name: shoot.shootLabel, + serviceType: shoot.shootLabel, + description: shoot.paragraphs[0], + image: absoluteUrl(shoot.image.src), + provider: { '@id': businessId }, + areaServed: areaServed(site.serviceArea), + ...(pkg !== undefined + ? { + offers: { + '@type': 'Offer', + price: pkg.price, + priceCurrency: 'EUR', + }, + } + : {}), + }; +} + // The shoot types as a list of services offered by the business, in page -// order (BR-SF-10..15). Each service points to its own anchor on the page; -// no prices, since the page does not show them. +// order (BR-SF-10..15). Each service is the one of its shoot page; no +// prices, since the overview does not show them. export function shootServices(shoots: readonly ShootType[], site: SiteContent) { - const page = canonicalUrl('/soorten-fotoshoots'); - const area = areaServed(site.serviceArea); return { '@type': 'ItemList', numberOfItems: shoots.length, itemListElement: shoots.map((shoot, index) => ({ '@type': 'ListItem', position: index + 1, - item: { - '@type': 'Service', - '@id': `${page}#${shoot.id}`, - url: `${page}#${shoot.id}`, - name: shoot.shootLabel, - serviceType: shoot.shootLabel, - description: shoot.paragraphs[0], - image: absoluteUrl(shoot.image.src), - provider: { '@id': businessId }, - areaServed: area, + item: shootService(shoot, site), + })), + }; +} + +// The visible breadcrumb as schema.org data: positions from 1, each page as +// an absolute URL (SEO-ST-03) +export function breadcrumbList(items: readonly BreadcrumbItem[]) { + return { + '@type': 'BreadcrumbList', + itemListElement: items.map((item, index) => ({ + '@type': 'ListItem', + position: index + 1, + name: item.label, + item: canonicalUrl(item.to), + })), + }; +} + +// The visible questions as a FAQPage, part of the page they are on; the +// answers as plain text, links by their text (SEO-ST-03). Without +// questions there is no FAQPage. +export function faqPage(path: RoutePath, items: readonly FaqItem[]) { + if (items.length === 0) return undefined; + return { + '@context': 'https://schema.org', + '@type': 'FAQPage', + isPartOf: { '@id': canonicalUrl(path) }, + inLanguage: 'nl-NL', + mainEntity: items.map((item) => ({ + '@type': 'Question', + name: item.question, + acceptedAnswer: { + '@type': 'Answer', + text: richTextToPlain(item.answer), }, })), }; } +// The structured data of a shoot page, one object per script (D13): the +// page with the shoot's service and the breadcrumb, and the FAQPage when +// there are questions. Built from the same view as the visible page, so +// the two cannot disagree. +export function shootPageGraph(view: ShootPageView, site: SiteContent) { + const page = webPage('WebPage', view.path, { + mainEntity: shootService(view.shoot, site, view.offer.pkg), + breadcrumb: breadcrumbList(view.breadcrumb.items), + }); + const faq = faqPage(view.path, view.faq?.items ?? []); + return faq === undefined ? [page] : [page, faq]; +} + // A head script tag with structured data, escaped by jsonLdScript (BR-SD-07) export function structuredDataScript(data: unknown) { return { diff --git a/web/src/sitePages.ts b/web/src/sitePages.ts index 60f395d..c7cc3b4 100644 --- a/web/src/sitePages.ts +++ b/web/src/sitePages.ts @@ -61,6 +61,46 @@ const sitePages: Record<RoutePath, PageMeta> = { alt: 'Een pasgeboren baby slaapt in een gestreept pakje', }, }, + '/soorten-fotoshoots/newborn': { + // DRAFT(CON-ST-03): awaiting Andrea's approval + title: 'Newbornshoot in Huizen', + // DRAFT(CON-ST-03): awaiting Andrea's approval + description: + "Newbornshoot in Huizen en omgeving, bij jou thuis in het rustige ritme van je baby. Warme, spontane foto's van Andrea Slop Fotografie.", + indexed: true, + }, + '/soorten-fotoshoots/zwangerschap': { + // DRAFT(CON-ST-03): awaiting Andrea's approval + title: 'Zwangerschapsshoot in Huizen', + // DRAFT(CON-ST-03): awaiting Andrea's approval + description: + "Zwangerschapsshoot in Huizen en omgeving: leg deze bijzondere periode vast in spontane foto's. Ontdek de mogelijkheden van Andrea Slop Fotografie.", + indexed: true, + }, + '/soorten-fotoshoots/gezin': { + // DRAFT(CON-ST-03): awaiting Andrea's approval + title: 'Gezinsshoot in Huizen', + // DRAFT(CON-ST-03): awaiting Andrea's approval + description: + 'Gezinsshoot in Huizen en omgeving: echte momenten die laten zien hoe jullie nu samen zijn. Ontdek de mogelijkheden van Andrea Slop Fotografie.', + indexed: true, + }, + '/soorten-fotoshoots/loveshoot': { + // DRAFT(CON-ST-03): awaiting Andrea's approval + title: 'Loveshoot in Huizen', + // DRAFT(CON-ST-03): awaiting Andrea's approval + description: + "Loveshoot in Huizen en omgeving: leg jullie liefde vast in spontane, kleurrijke foto's. Ontdek de mogelijkheden van Andrea Slop Fotografie.", + indexed: true, + }, + '/soorten-fotoshoots/portret': { + // DRAFT(CON-ST-03): awaiting Andrea's approval + title: 'Portretshoot in Huizen', + // DRAFT(CON-ST-03): awaiting Andrea's approval + description: + "Portretshoot in Huizen en omgeving, in de natuur of zakelijk. Spontane portretfoto's van Andrea Slop Fotografie.", + indexed: true, + }, '/contact': { title: 'Contact – fotoshoot boeken in Huizen', description: diff --git a/web/src/sitemap.test.ts b/web/src/sitemap.test.ts index 6fa375f..849f20c 100644 --- a/web/src/sitemap.test.ts +++ b/web/src/sitemap.test.ts @@ -23,6 +23,11 @@ describe('sitemapXml', () => { `${base}/over-mij`, `${base}/portfolio`, `${base}/soorten-fotoshoots`, + `${base}/soorten-fotoshoots/newborn`, + `${base}/soorten-fotoshoots/zwangerschap`, + `${base}/soorten-fotoshoots/gezin`, + `${base}/soorten-fotoshoots/loveshoot`, + `${base}/soorten-fotoshoots/portret`, `${base}/contact`, ]); }); diff --git a/web/src/test/arbitraries.ts b/web/src/test/arbitraries.ts index a1ceb57..2dcc4a0 100644 --- a/web/src/test/arbitraries.ts +++ b/web/src/test/arbitraries.ts @@ -4,17 +4,28 @@ import type { ContactFormEvent } from '../lib/contactFormReducer'; import type { LightboxEvent } from '../lib/lightboxReducer'; import type { Point } from '../lib/swipeDirection'; import type { + ContentImage, EmailAddress, + FaqItem, GalleryItem, + InlineLink, PortfolioPhoto, FrameColor, PricingPackage, + ProcessStepContent, + ProcessStepId, + RichText, + ShootPageContent, + ShootPageShared, ShootType, ShootTypeId, SiteContent, SocialLink, + StoryBlock, Testimonial, } from '../content/types'; +import type { RoutePath } from '../navigation'; +import sitePages from '../sitePages'; // Gedeelde generators voor de property-based tests (fast-check) @@ -403,3 +414,262 @@ export const portfolioPhotos = fc.uniqueArray(portfolioPhoto, { selector: (photo) => photo.id, maxLength: 15, }); + +// --- Shoot pages --- + +// The image shape of the content, as the shoot types and testimonials use it +export const contentImage: fc.Arbitrary<ContentImage> = image; + +// The placeholders the shoot pages fill in (see ShootPageShared) +export const knownPlaceholders = [ + 'reactietermijn', + 'aanbetaling', + 'locatie', + 'duur', + 'opleverduur', +] as const; + +// Known placeholder names and unknown ones, including names that exist on +// every object (an own-property check must leave those alone) +export const placeholderName = fc.oneof( + fc.constantFrom(...knownPlaceholders), + fc.constantFrom('constructor', 'toString', '__proto__', 'Duur', ' duur'), + fc + .stringMatching(/^[a-z]{1,12}$/) + .filter( + (name) => !(knownPlaceholders as readonly string[]).includes(name), + ), +); + +// Text without braces, with the characters that matter in a script tag or +// JSON: </script>, <, >, &, quotes, backslashes and line separators +export const plainText = fc.oneof( + fc.string({ maxLength: 20 }).filter((text) => !/[{}]/.test(text)), + fc.constantFrom('</script>', '<', '>', '&', '"', '\\', '
', ' '), +); + +// Text with placeholders in it, as an editor might write it. A stray brace +// is only ever an opening one: an opening and a closing brace around a +// filled placeholder could otherwise form a new one, which content never +// contains. +export const textWithPlaceholders = fc + .array( + fc.oneof( + plainText, + placeholderName.map((name) => `{${name}}`), + fc.constant('{'), + ), + { maxLength: 6 }, + ) + .map((pieces) => pieces.join('')); + +// Every route of the site +export const knownRoutePath = fc.constantFrom( + ...(Object.keys(sitePages) as RoutePath[]), +); + +// A link inside running text: a known route, optionally an anchor +export const inlineLink: fc.Arbitrary<InlineLink> = fc.record( + { to: knownRoutePath, hash: pathSegment, text: textWithPlaceholders }, + { requiredKeys: ['to', 'text'] }, +); + +// Running text as text pieces and links, hostile characters included +export const richText: fc.Arbitrary<RichText> = fc.array( + fc.oneof(textWithPlaceholders, inlineLink), + { maxLength: 5 }, +); + +const slug = fc.stringMatching(/^[a-z0-9-]{1,12}$/); + +// A story block, with or without an image +export const storyBlock: fc.Arbitrary<StoryBlock> = fc.record( + { + id: slug, + eyebrow: textWithPlaceholders, + title: textWithPlaceholders, + paragraphs: fc.array(richText, { minLength: 1, maxLength: 3 }), + image: contentImage, + }, + { requiredKeys: ['id', 'eyebrow', 'title', 'paragraphs'] }, +); + +export const faqItem: fc.Arbitrary<FaqItem> = fc.record({ + id: slug, + question: textWithPlaceholders, + answer: richText, +}); + +// FAQ items with unique ids, as one page has them +export const faqItems = fc.uniqueArray(faqItem, { + selector: (item) => item.id, + maxLength: 6, +}); + +const processStepIds: ProcessStepId[] = [ + 'aanvragen', + 'datum', + 'aanbetaling', + 'shoot', + 'bewerking', + 'oplevering', +]; + +const processStepContent: fc.Arbitrary<ProcessStepContent> = fc.record({ + title: plainText, + text: textWithPlaceholders, +}); + +// All six steps, with the keys in a random order: the content's key order +// must not decide the order on the page +const processSteps: fc.Arbitrary<Record<ProcessStepId, ProcessStepContent>> = fc + .tuple( + fc.shuffledSubarray(processStepIds, { + minLength: processStepIds.length, + maxLength: processStepIds.length, + }), + fc.array(processStepContent, { + minLength: processStepIds.length, + maxLength: processStepIds.length, + }), + ) + .map( + ([order, steps]) => + Object.fromEntries( + order.map((id, index) => [id, steps[index]]), + ) as Record<ProcessStepId, ProcessStepContent>, + ); + +// The shared shoot page texts as the CMS could deliver them +export const shootPageShared: fc.Arbitrary<ShootPageShared> = fc.record({ + breadcrumb: fc.record({ + label: plainText, + home: plainText, + overview: plainText, + }), + process: fc.record({ + eyebrow: plainText, + title: plainText, + lead: plainText, + steps: processSteps, + }), + deposit: fc.record({ + amount: fc.integer({ min: 1, max: 999 }), + note: textWithPlaceholders, + }), + photos: fc.record({ eyebrow: plainText }), + faq: fc.record({ eyebrow: plainText, lead: richText }), + offer: fc.record({ + bookLabel: plainText, + askLabel: plainText, + onRequest: fc.record({ + price: plainText, + text: plainText, + linkLabel: plainText, + }), + }), +}); + +// One shoot page as the CMS could deliver it, for the given shoot or any. +// The photos deliberately repeat each other, the story images and the +// images in `reuse` (pass the shoot's main and detail photo), so the rule +// that a photo appears once per page is put to the test. +export function shootPageContent( + id?: ShootTypeId, + reuse: readonly ContentImage[] = [], +): fc.Arbitrary<ShootPageContent> { + const stories = fc.uniqueArray(storyBlock, { + selector: (story) => story.id, + maxLength: 6, + }); + return stories.chain((storyList) => { + const used = [ + ...storyList.flatMap((story) => + story.image === undefined ? [] : [story.image], + ), + ...reuse, + ]; + const photo = + used.length > 0 + ? fc.oneof(contentImage, fc.constantFrom(...used)) + : contentImage; + const photos = fc + .tuple( + fc.array(photo, { maxLength: 6 }), + fc.array(fc.nat(), { maxLength: 2 }), + ) + .map(([list, repeats]) => + list.length === 0 + ? list + : [...list, ...repeats.map((n) => list[n % list.length])], + ); + return fc.record({ + id: id === undefined ? shootTypeId : fc.constant(id), + intro: fc.record({ + eyebrow: plainText, + title: plainText, + text: plainText, + }), + stories: fc.constant(storyList), + // The values of {locatie}, {duur} and {opleverduur} + process: fc.record({ + location: plainText, + duration: plainText, + deliveryTime: plainText, + }), + photos: fc.record({ title: plainText, images: photos }), + faq: fc.record({ title: plainText, items: faqItems }), + offer: fc.record({ eyebrow: plainText, title: plainText }), + closing: fc.record({ + title: plainText, + lead: richText, + buttonLabel: plainText, + }), + }); + }); +} + +// What could end up where a shoot slug is expected: the known ids, other +// letter cases, slashes, '..', an encoded slash, whitespace, markup, any +// string, and values that are no string at all +export const slugInput: fc.Arbitrary<unknown> = fc.oneof( + shootTypeId, + shootTypeId.map((id) => id.toUpperCase()), + shootTypeId.map((id) => id[0].toUpperCase() + id.slice(1)), + fc + .tuple( + fc.constantFrom('', '/', '//', ' ', '\t', '..', '../', '%2F'), + shootTypeId, + fc.constantFrom( + '', + '/', + '//', + ' ', + '\n', + '/..', + '%2F', + '</script>', + ), + ) + .map((parts) => parts.join('')), + fc.constantFrom( + '', + '..', + '%2F', + '</script>', + 'newborn/extra', + 'newborn%2Fextra', + 'onzin', + 'constructor', + '__proto__', + ), + fc.string(), + fc.oneof( + fc.integer(), + fc.boolean(), + fc.constant(null), + fc.constant(undefined), + fc.array(shootTypeId, { maxLength: 2 }), + fc.object(), + ), +); diff --git a/web/src/test/renderApp.tsx b/web/src/test/renderApp.tsx new file mode 100644 index 0000000..63eaef7 --- /dev/null +++ b/web/src/test/renderApp.tsx @@ -0,0 +1,33 @@ +import { ChakraProvider } from '@chakra-ui/react'; +import { + createMemoryHistory, + createRouter, + RouterProvider, +} from '@tanstack/react-router'; +import { render, screen } from '@testing-library/react'; +import { expect } from 'vitest'; +import ErrorPage from '../components/StatusPage/ErrorPage'; +import { routeTree } from '../routeTree.gen'; +import system from '../theme'; + +// De echte app: route tree, router-opties en thema zoals in main.tsx +export async function renderApp(path: string) { + const router = createRouter({ + routeTree, + history: createMemoryHistory({ initialEntries: [path] }), + scrollRestoration: true, + defaultErrorComponent: ErrorPage, + }); + await router.load(); + const result = render( + <ChakraProvider value={system}> + <RouterProvider router={router} /> + </ChakraProvider>, + ); + return { ...result, router }; +} + +export const expectShell = () => { + expect(screen.getByRole('banner')).toBeInTheDocument(); + expect(screen.getByRole('contentinfo')).toBeInTheDocument(); +};