Plans the Contact page and records unit 1 as generated

Workspace detection, a reverse engineering delta, requirements with the
approved layout mockups, the execution plan and the application design
for the Contact page, plus the code generation plan and summary of the
webPage helper. Corrects the contact payload in the shared API notes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-25 08:50:48 +01:00
co-authored by Claude Opus 5.5
parent 790495d700
commit 9127eba776
23 changed files with 1766 additions and 1 deletions
@@ -0,0 +1,51 @@
# Application Design — Contact Page
Consolidates [components.md](components.md), [component-methods.md](component-methods.md), [services.md](services.md) and [component-dependency.md](component-dependency.md). Decisions: [application-design-plan.md](../plans/application-design-plan.md).
## Design decisions
| # | Decision |
|---|---|
| Q1 | `ContactPanel` = gate + form loading (`lazy` / `eager`) + shoot options + preselect + mail subject. The heading and the URL clean-up, scroll and focus stay with each page |
| Q2 | The contact card is rendered twice: one per screen width, the other `display: none`, each with its own heading id. The DOM order always matches the visual order |
| Q3 | Optional `label` per social link in the content; without a label the platform name is shown |
| Q4 | `ContactAside` (photo with an overlapping card) is a page component in `components/contact/` |
| — | `webPage()` / `WebPageType` / `contactPage()` in `seo.ts`; `aboutPage()` rebuilt with identical output |
| — | Privacy line inside `ContactForm`; reply time as `siteContent.contactForm.replyTime` |
## Units and what they touch
| Unit | New | Changed |
|---|---|---|
| 1 webPage helper | `webPage`, `WebPageType` | `aboutPage` (internals), `seo.test.ts` |
| 2 Shared contact blocks | `ContactPanel`, `ContactDetails` | `ContactForm`, `home/ContactSection`, `routes/index.tsx` (prop pass-through), `content/types.ts`, `siteContent.ts` |
| 3 Contact page | `contact/ContactAside`, `contactContent.ts`, `contactPage()`, photos | `routes/contact.tsx`, `aboutContent.ts`, `sitePages.ts`, `lighthouserc*.cjs`, LAYOUT.md |
## Page composition (`/contact`)
```mermaid
graph TD
Intro["PageIntro: eyebrow, h1 Contact, intro"]
Section["PageSection flushTop"]
Narrow["ContactDetails with portrait (narrow only)"]
FormCol["Form column: hidden h2 + ContactPanel eager"]
Aside["ContactAside: photo + ContactDetails (wide only)"]
Intro --> Section
Section --> Narrow
Section --> FormCol
Section --> Aside
classDef head fill:#e76f51,stroke:#ad533d,color:#000;
classDef block fill:#2a9d8f,stroke:#20766b,color:#000;
classDef card fill:#f4a261,stroke:#b77a49,color:#000;
class Intro head;
class Section,FormCol block;
class Narrow,Aside card;
```
Text alternative: the page has the intro and one section; inside it, in DOM order, the narrow-screen card, the form column and the wide-screen aside with photo and card.
## Coordination
- Unit 1 is a separate commit (only `seo.ts` + `seo.test.ts`); its hash goes to portfolio-page and soorten-fotoshoots-page.
- `content/types.ts` and `siteContent.ts` are also changed by soorten-fotoshoots-page (`serviceArea`); different fields, small rebase at most.
## Extension compliance (design level)
- **Security**: no new endpoints or third parties; e-mail only assembled in the browser (`ContactDetails` reuses `emailAddress`); `?pakket=` validated against package ids inside `ContactPanel` and never rendered; structured data through `jsonLdScript`. Compliant / N/A as in requirements.
- **PBT-01**: properties identified now for unit 1: `webPage()` `@id` = `url` = canonical URL of the path, `@type` preserved, `inLanguage` fixed, `extra` keys present in the output; `aboutPage()` equals the previous implementation for generated content (oracle); `jsonLdScript` round-trip. Unit 2 and 3 properties follow in their Functional Design.
@@ -0,0 +1,51 @@
# Component Dependencies — Contact Page
## Dependency graph
```mermaid
graph TD
ContactRoute["routes/contact.tsx"] --> PageIntro["PageIntro"]
ContactRoute --> PageSection["PageSection"]
ContactRoute --> Panel["ContactPanel"]
ContactRoute --> Details["ContactDetails"]
ContactRoute --> Aside["contact/ContactAside"]
ContactRoute --> ContactContent["contactContent"]
ContactRoute --> Seo["seo.ts: contactPage, webPage"]
HomeSection["home/ContactSection"] --> Panel
Panel --> Gate["ContactFormGate"]
Panel --> Form["ContactForm"]
Panel --> Lib["lib: shootOptions, packageFromSearch, visiblePackages, mailSubject"]
Details --> Platforms["socialPlatforms"]
Details --> Lib2["lib: emailAddress, visibleSocials, mailtoLink"]
Aside --> Img["DeferredImage or eager image"]
Form --> Router["RouterLink to privacyverklaring"]
ContactRoute --> SiteContent["siteContent: email, socials, contactForm"]
AboutRoute["routes/over-mij.tsx"] --> Seo
classDef newpart 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 ContactRoute,Panel,Details,Aside,ContactContent newpart;
class HomeSection,Form,Seo,SiteContent,AboutRoute changed;
class PageIntro,PageSection,Gate,Lib,Lib2,Platforms,Img,Router existing;
```
Text alternative: the contact route uses PageIntro, PageSection, the new ContactPanel, ContactDetails and ContactAside, new content and the SEO helpers; the homepage contact section also uses ContactPanel; ContactPanel wraps the gate and the form and uses the existing package helpers; ContactDetails uses the platform registry and the e-mail and social helpers; the form links to the privacy page; the about route uses the rebuilt SEO helper.
## Dependency matrix
| Component | Depends on | Used by |
|---|---|---|
| `webPage()` | `sitePages`, `canonicalUrl` | `aboutPage`, `contactPage`, portfolio-page, soorten-fotoshoots-page |
| `ContactPanel` | `ContactFormGate`, `ContactForm` (lazy or eager), `shootOptions`, `packageFromSearch`, `visiblePackages`, `mailSubject`, `useInView` | `home/ContactSection`, `routes/contact.tsx` |
| `ContactForm` | reducer and validation helpers, `RouterLink` (privacy) | `ContactPanel` |
| `ContactDetails` | `emailAddress`, `mailtoLink`, `mailSubject`, `visibleSocials`, `socialPlatforms`, `Eyebrow` | `routes/contact.tsx` (twice) |
| `ContactAside` | image component | `routes/contact.tsx` |
| `contactContent` | `ContactPageContent`, assets | `routes/contact.tsx` |
## Communication patterns
- Props down only; no context, store or events beyond what exists (the form's reducer stays internal).
- The URL is the only input from outside the content: `?pakket=` read by the route, validated in `ContactPanel`, removed by the route.
- No new cycles: `ContactPanel` does not import routes; `ContactDetails` does not know the page.
## Data flow
`siteContent` + `packages` + `contactContent` → route → components. Nothing flows back except the form submit, which goes to `submitContactForm` (unchanged, gated).
@@ -0,0 +1,127 @@
# Component Methods — Contact Page
Signatures and props only; business rules follow in Functional Design (units 2 and 3).
## `seo.ts`
```ts
export type WebPageType =
| 'WebPage'
| 'AboutPage'
| 'ContactPage'
| 'ImageGallery'
| 'CollectionPage';
// Unit 1. @id = url = canonicalUrl(path); name/description from sitePages[path];
// inLanguage 'nl-NL'; extra spread last.
export function webPage(
type: WebPageType,
path: RoutePath,
extra?: Record<string, unknown>,
): Record<string, unknown>;
// Unit 1. Signature unchanged; output identical to today.
export function aboutPage(
path: RoutePath,
content: AboutPageContent['person'],
site: SiteContent,
): Record<string, unknown>;
// Unit 3. webPage('ContactPage', path, { about: { '@id': businessId } })
export function contactPage(path: RoutePath): Record<string, unknown>;
```
## `ContactPanel` (unit 2)
```ts
type ContactPanelProps = {
// Prefix for the form's field ids (unique per page)
idPrefix: string;
packages: PricingPackage[];
enabled: boolean; // siteContent.contactForm.enabled
email: EmailAddress;
replyTime: string; // siteContent.contactForm.replyTime
// Raw ?pakket= value from the page; validated inside (packageFromSearch)
pakket?: string;
// 'lazy': load the form near the screen, with a placeholder (homepage)
// 'eager': load it with the page (contact page)
load: 'lazy' | 'eager';
};
```
## `ContactForm` (changed, unit 2)
```ts
type ContactFormProps = {
idPrefix: string;
options: ShootOption[];
preselect?: { shoot: string; key: number };
mailSubject: string;
email: EmailAddress;
replyTime: string; // new: used in the thank-you message
submit?: (payload: ContactPayload) => Promise<void>;
};
```
## `home/ContactSection` (changed, unit 2)
Props unchanged: `{ content, packages, enabled, email, pakket? }`, plus `replyTime` passed through to `ContactPanel`.
## `ContactDetails` (unit 2)
```ts
type ContactDetailsProps = {
// Id of the h2, unique on the page (the card can appear twice)
titleId: string;
title: string; // "Direct contact"
email: EmailAddress;
socials: SocialLink[];
// Small round portrait next to the heading (narrow screens)
portrait?: ContentImage;
'data-testid'?: string;
};
// Renders null when no channel is valid.
```
## `contact/ContactAside` (unit 3)
```ts
type ContactAsideProps = {
image: ContentImage; // the 4:5 contact photo
children: ReactNode; // the card that overlaps the photo
};
```
## Content types (`content/types.ts`)
```ts
export interface SocialLink {
platform: SocialPlatform;
href: string;
label?: string; // new (unit 2), e.g. '@andreaslopfotografie'
}
export interface SiteContent {
// ...
contactForm: { enabled: boolean; replyTime: string }; // replyTime new (unit 2)
}
// Unit 3
export interface ContactPageContent {
head: { eyebrow: string; title: string; intro: string };
formTitle: string; // "Stuur me een bericht" (visually hidden h2)
detailsTitle: string; // "Direct contact"
image: ContentImage; // 4:5 photo (wide screens)
portrait: ContentImage; // small round face crop (narrow screens, decorative)
}
```
The intro and the reply time are combined in Functional Design (unit 3), so the reply time stays a single value.
## Route `routes/contact.tsx` (unit 3)
```ts
type ContactSearch = { pakket?: string };
// validateSearch: keeps pakket only when it is a string (same as routes/index.tsx)
// head: pageHead('/contact') + structuredDataScript(contactPage('/contact'))
```
@@ -0,0 +1,49 @@
# Components — Contact Page
Decisions: [application-design-plan.md](../plans/application-design-plan.md) (Q1–Q4 = A). Requirements: [requirements.md](../requirements/requirements.md).
## New shared components (`web/src/components/`)
### `ContactPanel` (unit 2)
- **Purpose**: the contact form as a ready-to-place block, used by the homepage section and the contact page.
- **Responsibilities**: the "Binnenkort" gate (`ContactFormGate`); loading the form either with the page (`eager`) or when it comes near the screen (`lazy`, with the reserved placeholder height); the shoot options from the packages; the preselect from a `pakket` value and the mail subject that follows from it. *Q1 = A*
- **Not its job**: the section heading, removing `?pakket=` from the address bar, scrolling and focus — those stay with the page.
### `ContactDetails` (unit 2)
- **Purpose**: the "Direct contact" card: a small h2 in eyebrow style and a list of channels (icon + link text).
- **Responsibilities**: show e-mail (assembled in the browser, left out when invalid), then the valid social links (`visibleSocials`), each with the platform icon and its label (or the platform name when there is no label, *Q3 = A*); render nothing when no channel is valid; optional small round portrait next to the heading.
- **Interface**: plain props (data in, no fetching); the heading id comes from the caller so the card can appear twice on one page without duplicate ids. *Q2 = A*
## Changed shared components
### `ContactForm`
- Privacy line under the submit button ("Lees in de privacyverklaring wat ik met je gegevens doe.", link to `/privacyverklaring`).
- Thank-you message takes the reply time from a prop instead of a hard-coded "1-2 werkdagen".
### `home/ContactSection`
- Keeps the heading, the `?pakket=` clean-up, scroll to `#contact` and focus move; delegates gate, form, options, preselect and mail subject to `ContactPanel` with `load="lazy"`. Output and behaviour unchanged apart from the privacy line.
## New page components (`web/src/components/contact/`)
### `ContactAside` (unit 3)
- **Purpose**: the right column on wide screens: the contact photo (4:5) with a card overlapping its bottom edge. *Q4 = A*
- **Responsibilities**: photo and overlap layout only; the card is passed in as `children` (the page passes `ContactDetails`). Hidden on narrow screens (and the photo not downloaded there — mechanism in Functional Design unit 3).
## Route
### `routes/contact.tsx` (unit 3)
- Validates the `pakket` search parameter (text only), renders `PageIntro`, then one `PageSection` (`flushTop`) with: the narrow-screen `ContactDetails` (with portrait), the form column (visually hidden h2 + `ContactPanel load="eager"`) and `ContactAside` with the wide-screen `ContactDetails`. Removes `?pakket=` from the address bar after it has been applied, without a focus move. Head: `pageHead('/contact')` plus the `ContactPage` JSON-LD.
## SEO (`web/src/seo.ts`, unit 1 and 3)
- **`webPage()`** + **`WebPageType`** (unit 1): generic page structured data, shared with portfolio-page and soorten-fotoshoots-page.
- **`aboutPage()`** (unit 1): rebuilt on `webPage()`, identical output.
- **`contactPage()`** (unit 3): `ContactPage` about the business.
## Content (`web/src/content/`)
- `types.ts`: `SocialLink.label?` (unit 2), `SiteContent.contactForm.replyTime` (unit 2), `ContactPageContent` (unit 3).
- `siteContent.ts`: labels for Instagram and Facebook, `replyTime: '1-2 werkdagen'` (unit 2).
- `contactContent.ts` (unit 3): page head, form and card headings, photo and portrait.
- `aboutContent.ts` (unit 3): "neem contact op" and "Boek je shoot" → `/contact`.
## Reused unchanged
`PageIntro`, `PageSection`, `Reveal`, `DeferredImage`, `Eyebrow`, `ContactFormGate`, `RouterLink`, `Link` (`underline`), `linkButton` recipe, `socialPlatforms`, `emailAddress`, `mailtoLink`/`mailSubject`, `visibleSocials`, `shootOptions`, `packageFromSearch`, `visiblePackages`, `contactFormReducer`.
@@ -0,0 +1,38 @@
# Services — Contact Page
There is no service layer in this SPA: routes compose components from static content, and pure helpers in `lib/` and `seo.ts` hold the logic. The only "service" is the existing `submitContactForm` (always fails until the API exists), reached through `ContactForm`; it is unchanged.
## Composition per route
### `/contact` (unit 3)
```mermaid
sequenceDiagram
box rgba(99,179,237,0.4) Routing
participant R as Router
participant P as contact route
end
box rgba(255,167,38,0.4) Shared components
participant Pn as ContactPanel
participant D as ContactDetails
end
R->>P: render with search pakket
P->>D: narrow card (portrait, titleId A)
P->>Pn: load eager, pakket
Pn->>Pn: validate pakket, preselect, mail subject
P->>D: wide card in ContactAside (titleId B)
P->>R: replace URL without pakket, no focus move
```
Text alternative: the router renders the contact route with the search parameter; the route renders the narrow-screen card, the panel (which validates the package and preselects it) and the wide-screen card inside ContactAside, then removes the parameter from the URL without moving focus.
### `/` (unit 2, behaviour unchanged)
`ContactSection` renders its heading, `ContactPanel` with `load="lazy"`, and keeps its own effect that removes `?pakket=`, scrolls to `#contact` and focuses the heading.
### `/over-mij` (unit 3)
Content change only: two link targets become `/contact`.
## Head (SEO)
- Every route: `pageHead(path)` from the page registry.
- `/over-mij`: `aboutPage()` (now on `webPage()`); `/contact`: `contactPage()`; both through `structuredDataScript` (escaped by `jsonLdScript`).
- Portfolio-page and soorten-fotoshoots-page add their own page types on `webPage()` in their branches.