# Code Summary — Unit 2: Shared contact blocks ## Created - `web/src/lib/contactChannels.ts` (+ `.test.ts`) — `ContactChannel` and `contactChannels(email, socials)` (BR-CD-01..05) - `web/src/components/PrivacyNote/PrivacyNote.tsx` (+ test) — the privacy line (BR-PR-01, 04) - `web/src/components/ContactPanel/ContactPanel.tsx` (+ test) — gate, form loading (`lazy` / `eager`), shoot options, preselect, mail subject (BR-CPN-01..06) - `web/src/components/ContactDetails/ContactDetails.tsx` (+ test) — the "Direct contact" card (BR-CD-06..08) ## Modified - `web/src/content/types.ts` — `SocialLink.label?`, `SiteContent.contactForm.replyTime` - `web/src/content/siteContent.ts` — socials Instagram first, with labels; `replyTime: '1-2 werkdagen'` - `web/src/test/arbitraries.ts` — `socialLink` with optional label; `anySiteContent` with `replyTime` - `web/src/components/ContactForm/ContactForm.tsx` (+ test) — `replyTime` prop for the thank-you; `PrivacyNote` under the submit button - `web/src/components/ContactForm/ContactFormGate.tsx` (+ test) — `PrivacyNote` under the notice - `web/src/components/home/ContactSection/ContactSection.tsx` (+ test) — uses `ContactPanel load="lazy"`; keeps heading, URL clean-up, scroll and focus - `web/src/routes/index.tsx` — passes `replyTime` - `web/src/components/Footer/Footer.test.tsx`, `web/src/components/Hero/Hero.test.tsx` — find socials by platform / new order instead of assuming Facebook first ## Deviation from the functional design - **BR-CPN-05 (eager)**: the form is always its own chunk, also when `eager`. Importing it directly in `ContactPanel` would have put it in the homepage bundle and undone the lazy split (±0.03 mobile performance). `eager` now starts loading at once and keeps the measured space with the placeholder until it arrives, so nothing shifts. This also keeps the contact route chunk small (the Lighthouse risk noted for unit 3). - **Hero socials** also follow the new content order (Instagram first), next to the footer; not listed in the functional design. ## Measurements - Form height with the privacy line (production build, Chrome): 649 px below `sm` (480 px), 546.6 px from `sm` → placeholder `{ base: '649px', sm: '547px' }` (was 604 / 502). - `ContactForm` chunk: 14.9 kB (5.6 kB gzip), still separate from the main bundle. ## Verification - `pnpm test`: 69 files, 354 tests passed (seed 2106747721), coverage thresholds met; run without the rtk filter. - `pnpm lint`, `pnpm format:check`, `pnpm build`: clean (existing accepted >500 kB main chunk warning). - `pnpm lighthouse` (mobile + desktop, port 4173 claimed and released): all assertions passed; desktop `/` 0.99/1/1/1, `/over-mij` and `/soorten-fotoshoots` 1/1/1/1. ## Tests added | Area | Tests | |---|---| | `contactChannels` | 4 examples + 6 properties (e-mail first ⇔ valid, socials = visibleSocials in order, labels, only mailto:/https:, external = social, length bound) | | `PrivacyNote` | text, link, axe | | `ContactForm` / gate | reply time from content, privacy line in form and outside the inert part of the gate | | `ContactPanel` | eager, options, lazy placeholder → load near screen, lazy load on package, valid/unknown/repeated package, gate off | | `ContactDetails` | order and labels, mailto, new tab and hint, hidden icons, nothing without channels, portrait, rendered twice |