diff --git a/LAYOUT.md b/LAYOUT.md index 23f929a..0e83a9f 100644 --- a/LAYOUT.md +++ b/LAYOUT.md @@ -41,13 +41,17 @@ columns 1 ```mermaid block-beta columns 1 - A["About Me"] - B["Background"] - C["Personal"] + A["Intro"] + B["About Me"] + C["Background"] + D["Photos"] + E["Personal"] 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 ``` ## Portfolio diff --git a/aidlc-docs/_shared/reverse-engineering/api-documentation.md b/aidlc-docs/_shared/reverse-engineering/api-documentation.md index df71a8a..e2e5078 100644 --- a/aidlc-docs/_shared/reverse-engineering/api-documentation.md +++ b/aidlc-docs/_shared/reverse-engineering/api-documentation.md @@ -12,7 +12,7 @@ None. There is no back-end yet (`api/` is empty). The static design README antic |------|------|------|-----------|---------| | (root) | `routes/__root.tsx` | `siteHead(siteContent)` | `AppShell` | — | | `/` | `routes/index.tsx` | `pageHead('/')` | `Hero` + six home sections; search `?pakket=` | yes | -| `/over-mij` | `routes/over-mij.tsx` | `pageHead(...)` | `PageIntro` placeholder | no | +| `/over-mij` | `routes/over-mij.tsx` | `pageHead('/over-mij')` + `AboutPage` JSON-LD | `PageIntro`, `AboutIntro`, `StorySection` ×2, `PhotoDuo`, `LinkButton` | yes | | `/portfolio` | `routes/portfolio.tsx` | `pageHead(...)` | `PageIntro` placeholder | no | | `/soorten-fotoshoots` | `routes/soorten-fotoshoots.tsx` | `pageHead(...)` | `PageIntro` placeholder | no | | `/contact` | `routes/contact.tsx` | `pageHead(...)` | `PageIntro` placeholder | no | @@ -22,7 +22,7 @@ None. There is no back-end yet (`api/` is empty). The static design README antic ### seo.ts / sitePages.ts / sitemap.ts - `pageHead(path: RoutePath)` → `{ meta, links }` (title, description, robots noindex if not indexed, OG tags, canonical) - `siteHead(content: SiteContent)` → `{ meta, scripts }` (OG basics, JSON-LD ProfessionalService) -- `canonicalUrl(path, base?)`, `jsonLdScript(data)`, `professionalService(content)` +- `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` @@ -39,6 +39,8 @@ None. There is no back-end yet (`api/` is empty). The static design README antic - `FramedImage({ image: ContentImage, aspectRatio })`, `DeferredImage(ImageProps & { image, near? })`, `Reveal(BoxProps & { delay? })` - `IntroGallery({ content })`, `AboutBlock({ content })`, `Pricing({ content, packages })`, `PriceCard(...)`, `Testimonials({ content, testimonials })`, `ContactSection({ content, packages, enabled, email, pakket? })`, `InstagramGrid({ content, profileUrl })` - `ContactForm(...)`, `ContactFormGate({ enabled, email, ... })` +- `PhotoDuo({ photos: [ContentImage, ContentImage], label, 'data-testid'? })` +- `about/AboutIntro({ content })`, `about/StorySection({ content, titleId, tone?, spacing?, children? })`, `about/RichParagraph({ paragraph: RichText })` - `StatusPage({ title, children, actions? })`, `ErrorPage({ error, reset })` - `LinkButton(RouterLink props & { variant?: 'outline' | 'accent' | 'light' })` - `UmamiAnalytics({ hostname? })` @@ -67,6 +69,10 @@ None. There is no back-end yet (`api/` is empty). The static design README antic - **Fields**: `src`, `alt`, `width`, `height` (intrinsic size, reserves space) ### HomeContent - **Fields**: `intro`, `about` (`eyebrow`, `title`, `paragraphs[]`, `image`, `link: { label, to: RoutePath }`), `pricing`, `testimonials`, `contact`, `instagram` +### LinkTarget / InlineLink / RichText +- **Fields**: `{ to: RoutePath; hash? }`; `InlineLink` adds `text`; `RichText = (string | InlineLink)[]` +### AboutPageContent +- **Fields**: `head`, `intro` (eyebrow, title, `paragraphs: RichText[]`, image), `background`, `photos`, `personal`, `booking` (label + LinkTarget), `person` (name, jobTitle, knowsAbout) ### PricingPackage / Testimonial - **Fields**: `id`, `name`, `price`, `features[]` / `id`, `shoot`, `quote`, `author`, `image` ### SocialLink diff --git a/aidlc-docs/_shared/reverse-engineering/architecture.md b/aidlc-docs/_shared/reverse-engineering/architecture.md index 83f51fd..5444516 100644 --- a/aidlc-docs/_shared/reverse-engineering/architecture.md +++ b/aidlc-docs/_shared/reverse-engineering/architecture.md @@ -16,7 +16,8 @@ graph TD Shell --> ToTop["BackToTop"] Shell --> Umami["UmamiAnalytics"] Outlet --> Home["routes/index.tsx: Hero + six sections"] - Outlet --> Placeholders["over-mij, portfolio, soorten-fotoshoots, contact, privacyverklaring: PageIntro"] + Outlet --> About["routes/over-mij.tsx: about page"] + Outlet --> Placeholders["portfolio, soorten-fotoshoots, contact, privacyverklaring: PageIntro"] Home --> Hero["Hero (HeroArrows, HeroPauseButton, HeroSocials, useHeroSlider)"] Home --> Sections["components/home/: IntroGallery, AboutBlock, Pricing, Testimonials, ContactSection, InstagramGrid"] Sections --> Blocks["Shared blocks: PageSection, MediaText, Eyebrow, SectionHeading, FramedImage, DeferredImage, Reveal"] @@ -34,11 +35,11 @@ graph TD classDef support fill:#e2e8f0,stroke:#4a5568,stroke-width:1px,color:#000; class Main,Root entry; class Shell,Skip,Nav,Footer,ToTop,Umami,Outlet shell; - class Home,Placeholders,Hero,Sections,Form page; + class Home,About,Placeholders,Hero,Sections,Form page; class Content,NavData,Seo,Theme,Blocks support; ``` -Text alternative: main.tsx starts Sentry and mounts the router; the root route renders AppShell (skip link, NavigationBar, the page via Outlet, Footer, BackToTop, Umami); the home route renders the Hero and six sections built from shared blocks (one of them lazily loads the contact form); the other routes render placeholder PageIntros; content, navigation, SEO and theme modules support all of it. +Text alternative: main.tsx starts Sentry and mounts the router; the root route renders AppShell (skip link, NavigationBar, the page via Outlet, Footer, BackToTop, Umami); the home route renders the Hero and six sections built from shared blocks (one of them lazily loads the contact form); the about route renders the Over mij page; the other routes render placeholder PageIntros; content, navigation, SEO and theme modules support all of it. ## Component Descriptions ### main.tsx diff --git a/aidlc-docs/_shared/reverse-engineering/business-overview.md b/aidlc-docs/_shared/reverse-engineering/business-overview.md index ee98368..4cd8886 100644 --- a/aidlc-docs/_shared/reverse-engineering/business-overview.md +++ b/aidlc-docs/_shared/reverse-engineering/business-overview.md @@ -35,8 +35,9 @@ Text alternative: visitors and crawlers use the website, which links out to soci - **E-mail the photographer** — mailto link in the footer - **Share / discover pages** — per-page title, description, canonical URL, Open Graph tags, JSON-LD (ProfessionalService), sitemap.xml, robots.txt - **Recover from errors** — 404 page inside the shell, error page with retry - - *Placeholder pages (noindex)*: Over mij, Portfolio, Soorten fotoshoots, Contact, Privacyverklaring - - *Planned (static design only)*: Over mij page (intro with portrait, "Hoe het begon", photo duo, "Buiten de camera om", booking button), portfolio with lightbox, shoot types and pricing page, contact page + - **Read about the photographer** — Over mij page: introduction with portrait, how it started, two photos, life outside photography, links to the portfolio and contact, "Boek je shoot" + - *Placeholder pages (noindex)*: Portfolio, Soorten fotoshoots, Contact, Privacyverklaring + - *Planned (static design only)*: portfolio with lightbox, shoot types and pricing page, contact page - **Business Dictionary**: - **Shell** — the Header / page content / Footer frame shared by every page (see LAYOUT.md) - **Hero** — full-screen photo slider at the top of the homepage diff --git a/aidlc-docs/_shared/reverse-engineering/code-quality-assessment.md b/aidlc-docs/_shared/reverse-engineering/code-quality-assessment.md index 44967a5..9399e18 100644 --- a/aidlc-docs/_shared/reverse-engineering/code-quality-assessment.md +++ b/aidlc-docs/_shared/reverse-engineering/code-quality-assessment.md @@ -14,10 +14,9 @@ ## Technical Debt - Homepage mobile Lighthouse performance target is lowered to 0.8 (images not responsive, title after JavaScript); back to 0.9 is planned with responsive images from the API and prerendering -- Five routes are placeholders (`noindex`); `lighthouserc.cjs` keeps its own list of indexed/noindex paths, guarded by a test against `sitePages.ts` +- Four routes are placeholders (`noindex`); `lighthouserc.cjs` keeps its own list of indexed/noindex paths, guarded by a test against `sitePages.ts` - No responsive image pipeline (srcset/sizes); photos are single JPEGs - Comment language is mixed: older code is commented in Dutch, homepage-sections code in English -- Over mij page images (`andrea-portret.jpg`, `about-1.jpg`, `about-2.jpg`) exist only in the static design, not yet in `web/src/assets` ## Patterns and Anti-patterns - **Good Patterns**: API-shaped content; pure, property-tested helpers; tokens and recipes as single source of truth; configuration as code for headers; strong accessibility baseline (axe in tests, Lighthouse accessibility 1.0) diff --git a/aidlc-docs/_shared/reverse-engineering/code-structure.md b/aidlc-docs/_shared/reverse-engineering/code-structure.md index bec3ccf..f71dc65 100644 --- a/aidlc-docs/_shared/reverse-engineering/code-structure.md +++ b/aidlc-docs/_shared/reverse-engineering/code-structure.md @@ -56,7 +56,10 @@ Candidates for modification are marked with ★ for the over-mij-page feature. - `web/src/routeTree.gen.ts` — generated (do not edit) - `web/src/routes/__root.tsx` — root layout, site head, 404/error - `web/src/routes/index.tsx` — home (`/`): Hero + six sections, `?pakket=` search param -- ★ `web/src/routes/over-mij.tsx` — placeholder with `PageIntro` (to become the real page) +- `web/src/routes/over-mij.tsx` — the about page (indexed; `AboutPage` JSON-LD) +- `web/src/components/about/*` — `AboutIntro`, `StorySection`, `RichParagraph` +- `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/{portfolio,soorten-fotoshoots,contact,privacyverklaring}.tsx` — placeholders with `PageIntro` - `web/src/components/AppShell.tsx` — shell - `web/src/components/NavigationBar/*` — header, NavLink, MobileNav diff --git a/aidlc-docs/active-features.md b/aidlc-docs/active-features.md index 3c3a6a6..a692719 100644 --- a/aidlc-docs/active-features.md +++ b/aidlc-docs/active-features.md @@ -5,4 +5,4 @@ | Bug | [hero-carousel-announce-and-pause](bugs/hero-carousel-announce-and-pause/bug-fix.md) | ✅ Complete | fix/hero-carousel-announce-and-pause | web/src/components/Hero (Hero, HeroArrows, useHeroSlider) | 2026-10-19 | | Feature | frontend-shell | ✅ Complete | feature/frontend-shell | web/src (AppShell, NavigationBar, Footer, Hero socials, new BackToTop/SkipLink/404/error pages, routes, theme.ts, main.tsx), web/vite.config.js, web/package.json | 2026-10-14 | | Feature | homepage-sections | ✅ Complete | feature/homepage-sections | web/src/routes/index.tsx, new homepage section components, web/src/content (types + static content), possibly web/config/securityHeaders.ts (contact form) | 2026-10-19 | -| Feature | over-mij-page | 🔵 Inception | feature/over-mij-page | web/src/routes/over-mij.tsx, web/src/content, possibly shared components (PageIntro, FramedImage, SectionHeading) and web/src/seo.ts | 2026-10-22 | +| Feature | over-mij-page | 🟢 Construction | feature/over-mij-page | web/src/routes/over-mij.tsx, web/src/content, possibly shared components (PageIntro, FramedImage, SectionHeading) and web/src/seo.ts | 2026-10-22 | diff --git a/aidlc-docs/features/over-mij-page/aidlc-state.md b/aidlc-docs/features/over-mij-page/aidlc-state.md index 1f628b6..8c830b5 100644 --- a/aidlc-docs/features/over-mij-page/aidlc-state.md +++ b/aidlc-docs/features/over-mij-page/aidlc-state.md @@ -5,7 +5,7 @@ - **Feature Slug**: over-mij-page - **Project Type**: Brownfield - **Start Date**: 2026-10-22T16:58:52Z -- **Current Stage**: CONSTRUCTION - Code Generation (Unit 1 Shared blocks, review) +- **Current Stage**: CONSTRUCTION - Code Generation (Unit 2 Over mij page, review on test) - **Branch**: feature/over-mij-page ## Workspace State @@ -55,11 +55,11 @@ - [x] Units Generation - SKIP ### 🟢 CONSTRUCTION PHASE -- [ ] Functional Design - EXECUTE (unit 2) / SKIP (unit 1) +- [x] Functional Design - EXECUTE (unit 2 ✅) / SKIP (unit 1) - [ ] NFR Requirements - SKIP - [ ] NFR Design - SKIP - [ ] Infrastructure Design - SKIP -- [~] Code Generation - EXECUTE (per unit) — Unit 1 Shared blocks: generated, awaiting approval +- [~] Code Generation - EXECUTE (per unit) — Unit 1 Shared blocks ✅, Unit 2 Over mij page: generated, deployed to test, awaiting approval - [ ] Build and Test - EXECUTE ### 🟡 OPERATIONS PHASE @@ -67,8 +67,8 @@ ## Current Status - **Lifecycle Phase**: CONSTRUCTION -- **Current Stage**: Code Generation — Unit 1 Shared blocks (review) -- **Next Stage**: Functional Design — Unit 2 Over mij page +- **Current Stage**: Code Generation — Unit 2 Over mij page (review on test) +- **Next Stage**: Build and Test ## Reverse Engineering Status - [x] Reverse Engineering - Artifacts refreshed on 2026-10-22T17:10:00Z at commit 99d4610 (approved 2026-10-22T17:19:39Z) diff --git a/aidlc-docs/features/over-mij-page/audit.md b/aidlc-docs/features/over-mij-page/audit.md index 88b3e39..72f9ea0 100644 --- a/aidlc-docs/features/over-mij-page/audit.md +++ b/aidlc-docs/features/over-mij-page/audit.md @@ -218,3 +218,75 @@ De tweede zin di ejij had bedacht lijkt namelijk midden in een zin te beginnen." **Context**: CONSTRUCTION - Code Generation Unit 1 (awaiting approval) --- + +## Code Generation — Unit 1 Shared blocks — Approval, Push and Deploy + +**Timestamp**: 2026-10-22T22:41:05Z + +**User Input**: "key weer toegevoegd. ga verder. push en deploy naar test" + +**AI Response**: "Unit 1 approved. Pushed feature/over-mij-page (first push failed earlier because the ssh-agent had been started with -t 4h, which expired the owner's key; agent restarted without a default lifetime). Dispatched CI run 563 on feature/over-mij-page with deploy_test=true. Feature status in active-features.md → 🟢 Construction. Started Functional Design for unit 2." + +**Context**: CONSTRUCTION - Code Generation Unit 1 (approved) → Functional Design Unit 2 + +--- + +## Functional Design — Unit 2 Over mij page — Questions + +**Timestamp**: 2026-10-22T22:50:00Z + +**User Input**: (none) + +**AI Response**: "Created construction/plans/over-mij-page-functional-design-plan.md and over-mij-page-fd-questions.md (4 questions: inline link model, link target type, Person fields, Person–business linking; recorded decisions on sameAs source, no e-mail, Person image, /#contact targets, alt texts)." + +**Context**: CONSTRUCTION - Functional Design Unit 2 (awaiting answers) + +--- + +## Functional Design — Unit 2 Over mij page — Answers and Artifacts + +**Timestamp**: 2026-10-22T22:54:37Z + +**User Input**: "1a, 2a, 3b, 4b" + +**AI Response**: "Recorded answers in over-mij-page-fd-questions.md (Q1 A segments, Q2 A route + hash, Q3 B Person with knowsAbout, Q4 B two-way link business.founder ↔ Person.worksFor). No ambiguities. Wrote construction/over-mij-page/functional-design/ domain-entities.md, business-rules.md, business-logic-model.md, frontend-components.md. Added decisions: person data lives in AboutPageContent.person; the photo block is not a named region (PageSection.labelledBy becomes optional); knowsAbout cleaned by a pure lib helper. CI run 563 (feature/over-mij-page, deploy_test): check success, deploy-test success; test.andreaslop.nl serves the branch build (verified flushTop in the routes chunk). Presented completion message." + +**Context**: CONSTRUCTION - Functional Design Unit 2 (awaiting approval) + +--- + +## Functional Design — Unit 2 — Approval + +**Timestamp**: 2026-10-22T22:57:45Z + +**User Input**: "Ga verder" + +**AI Response**: "Functional design approved. Created construction/plans/over-mij-page-code-generation-plan.md (22 steps: images, content, SEO + PBT, components, route, LAYOUT.md, RE docs, pnpm check, visual check, summary, commit). Asked for plan approval." + +**Context**: CONSTRUCTION - Code Generation Unit 2 (awaiting plan approval) + +--- + +## Code Generation — Unit 2 — Plan Approval + +**Timestamp**: 2026-10-22T23:00:00Z + +**User Input**: "Approve plan. Zodra je klaar bent mag je de changes comitten, pushen en een deploy naar test doen. Ik test het daarna eerst op test" + +**AI Response**: "Plan approved; generation started. Commit, push and deploy to test authorised for when unit 2 is done." + +**Context**: CONSTRUCTION - Code Generation Unit 2 (generation) + +--- + +## Code Generation — Unit 2 Over mij page — Generated + +**Timestamp**: 2026-10-22T23:55:00Z + +**User Input**: (none) + +**AI Response**: "Executed all 22 plan steps. Extra changes found necessary while generating: lighthouserc home exception (0.8) narrowed to '/' so /over-mij is held to 0.9; FramedImage/MediaText `priority` for the portrait (it is the mobile LCP). pnpm check passed (273 tests; Lighthouse /over-mij mobile perf 0.90, a11y/bp/SEO 1; desktop 1). Mobile LCP 3.2 s explained (client-side rendering 2.1 s + Reveal fade 0.5 s); design kept, option reported to the user. Homepage layout unchanged vs master; visual check against the static design at 3 widths. Committing, pushing and dispatching a deploy to test as authorised by the user." + +**Context**: CONSTRUCTION - Code Generation Unit 2 (review on test) + +--- diff --git a/aidlc-docs/features/over-mij-page/construction/over-mij-page/code/code-summary.md b/aidlc-docs/features/over-mij-page/construction/over-mij-page/code/code-summary.md new file mode 100644 index 0000000..5707d6d --- /dev/null +++ b/aidlc-docs/features/over-mij-page/construction/over-mij-page/code/code-summary.md @@ -0,0 +1,65 @@ +# Code Summary — Unit 2: Over mij page + +Plan: [over-mij-page-code-generation-plan.md](../../plans/over-mij-page-code-generation-plan.md). Functional design: [../functional-design/](../functional-design/business-rules.md). + +## Created +- `web/src/routes/over-mij.tsx` — replaced the placeholder: head (`pageHead` + `AboutPage` JSON-LD) and the page composition +- `web/src/content/aboutContent.ts` — live texts, photos, booking link, person data +- `web/src/components/about/AboutIntro/*`, `about/StorySection/*`, `about/RichParagraph/*` (+ tests) +- `web/src/components/PhotoDuo/*` (+ test) +- `web/src/lib/knowsAboutList.ts` (+ test, PBT invariants and idempotency) +- `web/src/assets/about/andrea-portret.jpg` (1200×800, 83 KB), `about-1.jpg` (1200×798, 97 KB), `about-2.jpg` (1200×800, 86 KB) +- `web/public/og-over-mij.jpg` (1200×630, 68 KB, crop of the portrait) + +## Modified +- `web/src/content/types.ts` — `LinkTarget`, `InlineLink`, `RichText`, `AboutPageContent` +- `web/src/seo.ts` — `businessId`, `personId`; `professionalService` gains `@id` and `founder`; new `person`, `aboutPage`, `structuredDataScript` (also used by `siteHead`) +- `web/src/sitePages.ts` — `/over-mij`: new title/description, `indexed: true`, `ogImage` +- `web/lighthouserc.cjs` — `/over-mij` indexed; the home page's lower mobile performance target (0.8) now applies to `/` only, other indexed pages need 0.9 (before, it applied to every indexed page) +- `web/src/components/PageSection/PageSection.tsx` — `labelledBy` optional (+ test) +- `web/src/components/FramedImage/FramedImage.tsx`, `MediaText/MediaText.tsx` — `priority` option: load at once with `fetchpriority="high"` instead of deferred (+ test); used for the portrait at the top of the page +- `web/src/seo.test.ts`, `web/src/sitemap.test.ts`, `web/src/app.test.tsx`, `web/src/test/arbitraries.ts` — new and updated tests, `anySiteContent` and `knowsAboutEntries` generators +- `LAYOUT.md` — About me: Intro → About Me → Background → Photos → Personal +- `aidlc-docs/_shared/reverse-engineering/*.md` — routes, components, content model, SEO functions, debt + +## Image script +One-off, outside the project (`scratchpad/resize-image.ps1`): the homepage-sections script extended with EXIF orientation and an optional cover crop (`-Height`, `-FocusY`). Commands: + +```powershell +& .\resize-image.ps1 -Source portret.jpg -Target web\src\assets\about\andrea-portret.jpg -Width 1200 +& .\resize-image.ps1 -Source about-1.jpg -Target web\src\assets\about\about-1.jpg -Width 1200 +& .\resize-image.ps1 -Source about-2.jpg -Target web\src\assets\about\about-2.jpg -Width 1200 +& .\resize-image.ps1 -Source portret.jpg -Target web\public\og-over-mij.jpg -Width 1200 -Height 630 -FocusY 0.4 +``` + +Originals from andreaslop.nl: `2024/10/WhatsApp-Image-2024-10-27-at-14.31.41.jpeg` (1600×1067), `2025/08/slide-1.jpg` (1920×1277), `2025/08/IMG_1718.jpg` (6000×4000). + +## Alt texts (for Andrea to review) +- Portrait: "Andrea Slop in een groene trui met haar camera in de handen, glimlachend in het bos" +- Concert: "Concert vanaf het podium: de zanger steekt zijn microfoon omhoog voor een volle zaal in blauw licht" +- Cat: "Een grijze langharige kat slaapt met een uitgestrekte poot op de bank" +- Preview image: "Andrea Slop met haar camera in het bos" + +## Verification +- **`pnpm check`**: lint, format, 60 test files / 273 tests (coverage thresholds met), build, `audit:deps` clean, Lighthouse passed. Two earlier runs stopped on an outdated sitemap expectation ("only the homepage") and on Prettier formatting of that fix; both corrected. +- **Lighthouse `/over-mij`**: mobile performance 0.90, accessibility 1, best practices 1, SEO 1; desktop 1 everywhere. Home unchanged (mobile 0.82, desktop 1). +- **LCP on mobile**: the portrait, 3.2 s. Breakdown: 2.1 s before the request can start, because the page is rendered by JavaScript (FCP 2.3 s, same as the placeholders), and 0.5 s render delay from the design's fade-in (`Reveal`). `priority` shortened the request delay by 0.3 s. Not changed further: removing the fade-in on the first block would deviate from the design; prerendering is the known fix for the JavaScript-first paint. +- **Homepage unchanged**: layout comparison against master at 1440/768/390 px — identical except React's generated carousel ids, which also differ between two runs of master. +- **Visual**: `/over-mij` compared with `design/andreaslop-static/over-mij.html` at 1440, 820 and 390 px — same structure, order, backgrounds, frame and button; differences are agreed ones (30 px section heading, wider content column as on the homepage, live texts). + +## Extension Compliance +| Rule | Status | Rationale | +|---|---|---| +| SECURITY-04 | Compliant | CSP unchanged; only self-hosted images | +| SECURITY-10 | Compliant | No new dependencies | +| SECURITY-11 | Compliant | JSON-LD via `jsonLdScript`; e-mail never in output (PBT) | +| SECURITY-13 | Compliant | No external resources | +| Other SECURITY rules | N/A | No data stores, endpoints, auth or infrastructure | +| PBT-01 | Compliant | Properties from business-logic-model.md implemented | +| PBT-02 | Compliant | `jsonLdScript` round-trip (existing) + `structuredDataScript` example | +| PBT-03 | Compliant | Two-way ids, sameAs = valid socials, no e-mail, registry match, knowsAbout invariants | +| PBT-04 | Compliant | `knowsAboutList` idempotency | +| PBT-05, PBT-06 | N/A | No oracle, no stateful logic | +| PBT-07 | Compliant | `anySiteContent`, `knowsAboutEntries` generators | +| PBT-08, PBT-09 | Compliant | Existing seed logging, fast-check | +| PBT-10 | Compliant | Example-based component and route tests alongside PBT | diff --git a/aidlc-docs/features/over-mij-page/construction/plans/over-mij-page-code-generation-plan.md b/aidlc-docs/features/over-mij-page/construction/plans/over-mij-page-code-generation-plan.md new file mode 100644 index 0000000..90c73b9 --- /dev/null +++ b/aidlc-docs/features/over-mij-page/construction/plans/over-mij-page-code-generation-plan.md @@ -0,0 +1,64 @@ +# Code Generation Plan — Unit 2: Over mij page + +Single source of truth for code generation of this unit. Workspace root: `K:\Development\SlpSoftware\Projects\AndreaSlopFotografie`; code in `web/`. Branch `feature/over-mij-page`. + +## Unit Context +- **Requirements**: FR-OM-01..08, SEO-OM-01..05, NFR-OM-01, 03..06 +- **Design**: [application-design.md](../../inception/application-design/application-design.md); functional design in [construction/over-mij-page/functional-design/](../over-mij-page/functional-design/) (BR-OM-*, BR-SD-*, BR-SEO-OM-*) +- **Depends on**: unit 1 (`PageSection`, `MediaText`, `Eyebrow`) — done +- **Behavioural contract for existing pages**: the homepage and other pages only change in their head: the business JSON-LD gains `@id` and `founder` + +## Steps + +### Images +- [x] **Step 1** — Download the originals from andreaslop.nl: portrait `2024/10/WhatsApp-Image-2024-10-27-at-14.31.41.jpeg`, `2025/08/slide-1.jpg`, `2025/08/IMG_1718.jpg` (into the scratchpad, not the repo). +- [x] **Step 2** — Resize once with the same one-off PowerShell/System.Drawing approach as homepage-sections (quality 80): portrait and duo photos to 1200 px wide → `web/src/assets/about/andrea-portret.jpg`, `about-1.jpg`, `about-2.jpg`; a 1200×630 centre-weighted crop of the portrait → `web/public/og-over-mij.jpg`. Record exact sizes for `width`/`height`. +- [x] **Step 3** — Look at each photo and write descriptive Dutch alt texts (BR-OM-04), plus the preview image alt. + +### Content +- [x] **Step 4** — `content/types.ts`: add `LinkTarget`, `InlineLink`, `RichText`, `AboutPageContent` (domain-entities.md). +- [x] **Step 5** — Create `content/aboutContent.ts` with the live texts, photos, booking link and person data. + +### SEO and pure helpers +- [x] **Step 6** — `lib/knowsAboutList.ts` + test: trim, drop empties, dedupe keeping first (example + PBT: invariants, idempotency). +- [x] **Step 7** — `seo.ts`: `businessId`, `personId`; `professionalService` gains `@id` + `founder`; new `person(...)`, `aboutPage(...)`, `structuredDataScript(...)`; `siteHead` uses `structuredDataScript`. Comments in English for new code. +- [x] **Step 8** — `seo.test.ts`: example tests for the real content and PBT properties from business-logic-model.md (ids, sameAs, no e-mail, registry match); add a `siteContent` and `knowsAbout` arbitrary to `test/arbitraries.ts`. +- [x] **Step 9** — `sitePages.ts`: `/over-mij` title, description, `indexed: true`, `ogImage`. `lighthouserc.cjs`: move `/over-mij` to `indexedPaths` (desktop config builds on it). Existing sync and sitemap tests updated where they list noindex pages. + +### Components +- [x] **Step 10** — `PageSection`: `labelledBy` optional (BR-OM-11) + test case (no region role without it). +- [x] **Step 11** — `components/PhotoDuo/PhotoDuo.tsx` + test (two images with alt, list named by `label`, axe). +- [x] **Step 12** — `components/about/RichParagraph.tsx` + test (text and links in order, link targets incl. hash). +- [x] **Step 13** — `components/about/AboutIntro.tsx` + test (h2, eyebrow, paragraphs, two links, portrait, region name, axe). +- [x] **Step 14** — `components/about/StorySection.tsx` + test (h3 label names the region, paragraphs, children, tone, axe). + +### Route +- [x] **Step 15** — `routes/over-mij.tsx`: head (`pageHead` + AboutPage script) and composition (PageIntro → AboutIntro → StorySection background → PhotoDuo in an unnamed PageSection → StorySection personal with `LinkButton accent`). +- [x] **Step 16** — Route tests in `app.test.tsx`: `/over-mij` renders in the shell with the heading outline h1/h2/h3/h3, links `/portfolio`, `/#contact` (×2), no `noindex`, the AboutPage script; axe on the whole page. + +### Documentation +- [x] **Step 17** — `LAYOUT.md`: About me diagram → Intro, About Me, Background, Photos, Personal (letters/colours A–E per `.ai/layout-conventions.md`). +- [x] **Step 18** — Update the shared reverse engineering docs (routes table, new components, content model, `/over-mij` indexed, debt item about Over mij images resolved). + +### Verification and summary +- [x] **Step 19** — `pnpm check` (lint, format, tests incl. coverage thresholds, build, audits, Lighthouse incl. `/over-mij` as indexed page) — nothing else running on the machine during Lighthouse. +- [x] **Step 20** — Visual check of `/over-mij` against `design/andreaslop-static/over-mij.html` in the browser at desktop, tablet and phone widths (screenshots); homepage layout comparison against the unit 1 build (only head changes expected). +- [x] **Step 21** — Write `construction/over-mij-page/code/code-summary.md` incl. the resize command and image sizes. +- [x] **Step 22** — Commit on `feature/over-mij-page` (push/deploy only when asked). + +## Extension Compliance (unit 2) +| Rule | Status | Rationale | +|---|---|---| +| SECURITY-04 | Compliant | CSP unchanged; only self-hosted images | +| SECURITY-10 | Compliant | No new dependencies; image resizing is a one-off local step | +| SECURITY-11 | Compliant | JSON-LD through `jsonLdScript`; e-mail excluded (BR-SD-01, PBT) | +| SECURITY-13 | Compliant | No external resources at runtime | +| Other SECURITY rules | N/A | No data stores, endpoints, auth or infrastructure | +| PBT-01 | Compliant | Properties identified in business-logic-model.md | +| PBT-02 | Compliant | `jsonLdScript` round-trip already tested | +| PBT-03 | Planned | Invariants for ids, sameAs, no e-mail, knowsAbout (Steps 6, 8) | +| PBT-04 | Planned | `knowsAboutList` idempotency (Step 6) | +| PBT-05, PBT-06 | N/A | No oracle, no stateful logic | +| PBT-07 | Planned | `siteContent` and `knowsAbout` arbitraries (Step 8) | +| PBT-08, PBT-09 | Compliant | Existing seed logging and fast-check setup | +| PBT-10 | Planned | Example-based component and route tests alongside PBT | diff --git a/web/lighthouserc.cjs b/web/lighthouserc.cjs index 2f9c109..e30a8a9 100644 --- a/web/lighthouserc.cjs +++ b/web/lighthouserc.cjs @@ -6,9 +6,8 @@ const origin = 'http://localhost:4173'; // Moet gelijk lopen met src/sitePages.ts (een test bewaakt dat) -const indexedPaths = ['/']; +const indexedPaths = ['/', '/over-mij']; const noindexPaths = [ - '/over-mij', '/portfolio', '/soorten-fotoshoots', '/contact', @@ -68,9 +67,12 @@ module.exports = { }, }, assert: { + // Home first: lighthouserc.desktop.cjs raises its performance + // target back to 0.9. Every URL matching an entry must pass it, + // so the home exception may only match the home page itself. assertMatrix: [ { - matchingUrlPattern: exact(indexedPaths), + matchingUrlPattern: exact(['/']), assertions: { ...quality, 'categories:performance': [ @@ -80,6 +82,15 @@ module.exports = { 'categories:seo': ['error', { minScore: 1 }], }, }, + { + matchingUrlPattern: exact( + indexedPaths.filter((path) => path !== '/'), + ), + assertions: { + ...quality, + 'categories:seo': ['error', { minScore: 1 }], + }, + }, { matchingUrlPattern: exact(noindexPaths), assertions: { diff --git a/web/public/og-over-mij.jpg b/web/public/og-over-mij.jpg new file mode 100644 index 0000000..0a96b00 Binary files /dev/null and b/web/public/og-over-mij.jpg differ diff --git a/web/src/app.test.tsx b/web/src/app.test.tsx index 5f2d727..2737a42 100644 --- a/web/src/app.test.tsx +++ b/web/src/app.test.tsx @@ -125,6 +125,44 @@ describe('app', () => { ); }); + it('shows the about page with its outline, links and structured data', async () => { + const { container } = await renderApp('/over-mij'); + await screen.findByRole('heading', { level: 1, name: 'Over mij' }); + // The page's own outline; the footer adds its own column headings + expect( + within(screen.getByRole('main')) + .getAllByRole('heading') + .map((h) => `${h.tagName} ${h.textContent}`), + ).toEqual([ + 'H1 Over mij', + 'H2 Hoi! Ik ben Andrea', + 'H3 Hoe het begon', + 'H3 Buiten de camera om', + ]); + expect( + screen.getByRole('link', { name: 'mijn portfolio' }), + ).toHaveAttribute('href', '/portfolio'); + expect( + screen.getByRole('link', { name: 'neem contact op' }), + ).toHaveAttribute('href', '/#contact'); + expect( + screen.getByRole('link', { name: 'Boek je shoot' }), + ).toHaveAttribute('href', '/#contact'); + expect( + screen.getByRole('list', { name: "Foto's" }), + ).toBeInTheDocument(); + + expect(document.title).toBe( + 'Over mij – fotograaf in Huizen | Andrea Slop Fotografie', + ); + expect(document.head.querySelector('meta[name="robots"]')).toBeNull(); + const types = [ + ...document.querySelectorAll('script[type="application/ld+json"]'), + ].map((script) => JSON.parse(script.textContent!)['@type']); + expect(types.sort()).toEqual(['AboutPage', 'ProfessionalService']); + expect(await axeResults(container)).toHaveNoViolations(); + }); + it('toont een onbekende URL als 404 binnen de shell', async () => { const { container } = await renderApp('/bestaat-niet'); expect( diff --git a/web/src/assets/about/about-1.jpg b/web/src/assets/about/about-1.jpg new file mode 100644 index 0000000..9a1ebd4 Binary files /dev/null and b/web/src/assets/about/about-1.jpg differ diff --git a/web/src/assets/about/about-2.jpg b/web/src/assets/about/about-2.jpg new file mode 100644 index 0000000..3bbe052 Binary files /dev/null and b/web/src/assets/about/about-2.jpg differ diff --git a/web/src/assets/about/andrea-portret.jpg b/web/src/assets/about/andrea-portret.jpg new file mode 100644 index 0000000..a94fb14 Binary files /dev/null and b/web/src/assets/about/andrea-portret.jpg differ diff --git a/web/src/components/FramedImage/FramedImage.test.tsx b/web/src/components/FramedImage/FramedImage.test.tsx index 3d0e158..a87751d 100644 --- a/web/src/components/FramedImage/FramedImage.test.tsx +++ b/web/src/components/FramedImage/FramedImage.test.tsx @@ -24,4 +24,15 @@ describe('FramedImage', () => { expect(img).toHaveAttribute('loading', 'lazy'); expect(await axeResults(container)).toHaveNoViolations(); }); + + it('loads a priority photo straight away, not lazily', async () => { + await renderWithProviders( + , + ); + const img = screen.getByRole('img'); + expect(img).toHaveAttribute('src', '/andrea.jpg'); + expect(img).not.toHaveAttribute('loading', 'lazy'); + expect(img).toHaveAttribute('fetchpriority', 'high'); + expect(img).toHaveAttribute('width', '1200'); + }); }); diff --git a/web/src/components/FramedImage/FramedImage.tsx b/web/src/components/FramedImage/FramedImage.tsx index 1748dc0..44a53d8 100644 --- a/web/src/components/FramedImage/FramedImage.tsx +++ b/web/src/components/FramedImage/FramedImage.tsx @@ -1,4 +1,4 @@ -import { Box } from '@chakra-ui/react'; +import { Box, Image, type ImageProps } from '@chakra-ui/react'; import DeferredImage from '@/components/DeferredImage/DeferredImage'; import type { ContentImage } from '@/content/types'; @@ -6,13 +6,30 @@ type FramedImageProps = { image: ContentImage; // CSS aspect ratio of the visible crop, e.g. '4 / 3' aspectRatio: string; + // For a photo at the top of a page, likely the largest paint: load it + // straight away with high priority instead of after the page has loaded + priority?: boolean; }; // A photo with a soft sand-coloured block offset behind its lower left // corner (design .about__media). The block is pure decoration (a CSS // pseudo-element), so assistive technology never announces it. On phones it // is left out, since it would stick out past the page edge. -export default function FramedImage({ image, aspectRatio }: FramedImageProps) { +export default function FramedImage({ + image, + aspectRatio, + priority = false, +}: FramedImageProps) { + const style: ImageProps = { + display: 'block', + w: '100%', + h: 'auto', + aspectRatio, + objectFit: 'cover', + // Shown until the photo arrives + bg: 'paper.deep', + }; + return ( - + {priority ? ( + {image.alt} + ) : ( + + )} ); } diff --git a/web/src/components/MediaText/MediaText.tsx b/web/src/components/MediaText/MediaText.tsx index b5b3fce..f40c7b9 100644 --- a/web/src/components/MediaText/MediaText.tsx +++ b/web/src/components/MediaText/MediaText.tsx @@ -8,6 +8,8 @@ type MediaTextProps = { image: ContentImage; // CSS aspect ratio of the visible crop, e.g. '4 / 3' aspectRatio: string; + // The photo is at the top of the page and should not wait (FramedImage) + priority?: boolean; 'data-testid'?: string; // The text column; each page fills in its own heading and text children: ReactNode; @@ -19,6 +21,7 @@ type MediaTextProps = { export default function MediaText({ image, aspectRatio, + priority, 'data-testid': testId, children, }: MediaTextProps) { @@ -30,7 +33,11 @@ export default function MediaText({ data-testid={testId} > - + {children} diff --git a/web/src/components/PageSection/PageSection.test.tsx b/web/src/components/PageSection/PageSection.test.tsx index a4da787..1446831 100644 --- a/web/src/components/PageSection/PageSection.test.tsx +++ b/web/src/components/PageSection/PageSection.test.tsx @@ -57,6 +57,17 @@ describe('PageSection', () => { expect(regular.paddingTop).not.toBe('0px'); }); + it('is no landmark without a heading to name it', async () => { + const { container } = await renderWithProviders( + +

Foto's

+
, + ); + expect(screen.getByTestId('photos').tagName).toBe('SECTION'); + expect(screen.queryByRole('region')).not.toBeInTheDocument(); + expect(await axeResults(container)).toHaveNoViolations(); + }); + it('leaves out the content column at full width', async () => { await renderWithProviders( diff --git a/web/src/components/PageSection/PageSection.tsx b/web/src/components/PageSection/PageSection.tsx index ed13b67..fa0c148 100644 --- a/web/src/components/PageSection/PageSection.tsx +++ b/web/src/components/PageSection/PageSection.tsx @@ -2,8 +2,9 @@ import type { ReactNode } from 'react'; import { Box, Container } from '@chakra-ui/react'; type PageSectionProps = { - // Id of the heading that names this section for assistive technology - labelledBy: string; + // Id of the heading that names this section for assistive technology. + // Without it (a block without a heading) the section is no landmark. + labelledBy?: string; id?: string; tone?: 'paper' | 'alt'; // full: no content column, for edge-to-edge content; the section then diff --git a/web/src/components/PhotoDuo/PhotoDuo.test.tsx b/web/src/components/PhotoDuo/PhotoDuo.test.tsx new file mode 100644 index 0000000..2fd6b2c --- /dev/null +++ b/web/src/components/PhotoDuo/PhotoDuo.test.tsx @@ -0,0 +1,32 @@ +import { screen, within } from '@testing-library/react'; +import { describe, expect, it } from 'vitest'; +import type { ContentImage } from '@/content/types'; +import { axeResults } from '@/test/axe'; +import { renderWithProviders } from '@/test/renderWithProviders'; +import PhotoDuo from './PhotoDuo'; + +const photos: [ContentImage, ContentImage] = [ + { + src: '/concert.jpg', + alt: 'Concert vanaf het podium', + width: 1200, + height: 798, + }, + { src: '/kat.jpg', alt: 'Slapende grijze kat', width: 1200, height: 800 }, +]; + +describe('PhotoDuo', () => { + it('shows both photos in a named list', async () => { + const { container } = await renderWithProviders( + , + ); + const list = screen.getByRole('list', { name: "Foto's" }); + const images = within(list).getAllByRole('img'); + expect(images).toHaveLength(2); + expect(images[0]).toHaveAccessibleName('Concert vanaf het podium'); + expect(images[1]).toHaveAccessibleName('Slapende grijze kat'); + expect(images[0]).toHaveAttribute('width', '1200'); + expect(images[0]).toHaveAttribute('height', '798'); + expect(await axeResults(container)).toHaveNoViolations(); + }); +}); diff --git a/web/src/components/PhotoDuo/PhotoDuo.tsx b/web/src/components/PhotoDuo/PhotoDuo.tsx new file mode 100644 index 0000000..9a43bc3 --- /dev/null +++ b/web/src/components/PhotoDuo/PhotoDuo.tsx @@ -0,0 +1,59 @@ +import { chakra } from '@chakra-ui/react'; +import DeferredImage from '@/components/DeferredImage/DeferredImage'; +import Reveal from '@/components/Reveal/Reveal'; +import type { ContentImage } from '@/content/types'; + +type PhotoDuoProps = { + photos: [ContentImage, ContentImage]; + // Accessible name of the photo list, e.g. "Foto's" + label: string; + 'data-testid'?: string; +}; + +// Two landscape photos side by side (design .intro-gallery--duo), one below +// the other on phones. Each zooms in gently on hover, as in the homepage +// gallery, except with reduced motion. +export default function PhotoDuo({ + photos, + label, + 'data-testid': testId, +}: PhotoDuoProps) { + return ( + + + {photos.map((photo) => ( + + + + + + ))} + + + ); +} diff --git a/web/src/components/about/AboutIntro/AboutIntro.test.tsx b/web/src/components/about/AboutIntro/AboutIntro.test.tsx new file mode 100644 index 0000000..822ce5b --- /dev/null +++ b/web/src/components/about/AboutIntro/AboutIntro.test.tsx @@ -0,0 +1,34 @@ +import { screen, within } from '@testing-library/react'; +import { describe, expect, it } from 'vitest'; +import aboutContent from '@/content/aboutContent'; +import { axeResults } from '@/test/axe'; +import { renderWithProviders } from '@/test/renderWithProviders'; +import AboutIntro from './AboutIntro'; + +const intro = aboutContent.intro; + +describe('AboutIntro', () => { + it('shows the label, heading, text, portrait and links', async () => { + const { container } = await renderWithProviders( + , + ); + const section = screen.getByRole('region', { name: intro.title }); + expect( + within(section).getByRole('heading', { level: 2 }), + ).toHaveTextContent(intro.title); + expect(within(section).getByText(intro.eyebrow)).toBeInTheDocument(); + expect(within(section).getByRole('img')).toHaveAccessibleName( + intro.image.alt, + ); + expect(section).toHaveTextContent( + 'Bekijk mijn portfolio of neem contact op voor een fotoshoot!', + ); + expect( + within(section).getByRole('link', { name: 'mijn portfolio' }), + ).toHaveAttribute('href', '/portfolio'); + expect( + within(section).getByRole('link', { name: 'neem contact op' }), + ).toHaveAttribute('href', '/#contact'); + expect(await axeResults(container)).toHaveNoViolations(); + }); +}); diff --git a/web/src/components/about/AboutIntro/AboutIntro.tsx b/web/src/components/about/AboutIntro/AboutIntro.tsx new file mode 100644 index 0000000..0754610 --- /dev/null +++ b/web/src/components/about/AboutIntro/AboutIntro.tsx @@ -0,0 +1,41 @@ +import { Stack } from '@chakra-ui/react'; +import RichParagraph from '@/components/about/RichParagraph/RichParagraph'; +import MediaText from '@/components/MediaText/MediaText'; +import PageSection from '@/components/PageSection/PageSection'; +import SectionHeading from '@/components/SectionHeading/SectionHeading'; +import type { AboutPageContent } from '@/content/types'; + +const TITLE_ID = 'about-intro-title'; + +type AboutIntroProps = { + content: AboutPageContent['intro']; +}; + +// "Hoi! Ik ben Andrea": the framed portrait next to the introduction, right +// below the page head (design .about in a .section--flush-top) +export default function AboutIntro({ content }: AboutIntroProps) { + return ( + + {/* Right below the page head: on phones the portrait is the + largest paint, so it must not wait for the page to load */} + + + + {content.paragraphs.map((paragraph, index) => ( + + ))} + + + + ); +} diff --git a/web/src/components/about/RichParagraph/RichParagraph.test.tsx b/web/src/components/about/RichParagraph/RichParagraph.test.tsx new file mode 100644 index 0000000..2caed25 --- /dev/null +++ b/web/src/components/about/RichParagraph/RichParagraph.test.tsx @@ -0,0 +1,37 @@ +import { screen } from '@testing-library/react'; +import { describe, expect, it } from 'vitest'; +import { axeResults } from '@/test/axe'; +import { renderWithProviders } from '@/test/renderWithProviders'; +import RichParagraph from './RichParagraph'; + +describe('RichParagraph', () => { + it('renders text and links in reading order', async () => { + const { container } = await renderWithProviders( + , + ); + expect(container).toHaveTextContent( + 'Bekijk mijn portfolio of neem contact op!', + ); + expect( + screen.getByRole('link', { name: 'mijn portfolio' }), + ).toHaveAttribute('href', '/portfolio'); + expect( + screen.getByRole('link', { name: 'neem contact op' }), + ).toHaveAttribute('href', '/#contact'); + expect(await axeResults(container)).toHaveNoViolations(); + }); + + it('renders a paragraph without links as plain text', async () => { + await renderWithProviders(); + expect(screen.getByText('Hoi!')).toBeInTheDocument(); + expect(screen.queryByRole('link')).not.toBeInTheDocument(); + }); +}); diff --git a/web/src/components/about/RichParagraph/RichParagraph.tsx b/web/src/components/about/RichParagraph/RichParagraph.tsx new file mode 100644 index 0000000..8fd0c47 --- /dev/null +++ b/web/src/components/about/RichParagraph/RichParagraph.tsx @@ -0,0 +1,29 @@ +import { Link, Text } from '@chakra-ui/react'; +import RouterLink from '@/components/RouterLink'; +import type { RichText } from '@/content/types'; + +type RichParagraphProps = { + paragraph: RichText; +}; + +// One paragraph of running text with links in it (BR-OM-03): text pieces as +// they are, link pieces as underlined router links. +export default function RichParagraph({ paragraph }: RichParagraphProps) { + return ( + + {paragraph.map((piece, index) => + typeof piece === 'string' ? ( + piece + ) : ( + // Static content: the order never changes, so the index + // is a stable key + + + {piece.text} + + + ), + )} + + ); +} diff --git a/web/src/components/about/StorySection/StorySection.test.tsx b/web/src/components/about/StorySection/StorySection.test.tsx new file mode 100644 index 0000000..b6d4b53 --- /dev/null +++ b/web/src/components/about/StorySection/StorySection.test.tsx @@ -0,0 +1,44 @@ +import { screen, within } from '@testing-library/react'; +import { describe, expect, it } from 'vitest'; +import aboutContent from '@/content/aboutContent'; +import { axeResults } from '@/test/axe'; +import { renderWithProviders } from '@/test/renderWithProviders'; +import StorySection from './StorySection'; + +const personal = aboutContent.personal; + +describe('StorySection', () => { + it('is a region named by its h3 label, with the text', async () => { + const { container } = await renderWithProviders( + // An h2 above it, as on the page, so the outline is complete + <> +

Hoi! Ik ben Andrea

+ + , + ); + const section = screen.getByRole('region', { name: personal.title }); + expect( + within(section).getByRole('heading', { level: 3 }), + ).toHaveAttribute('id', 'personal-title'); + personal.paragraphs.forEach((paragraph) => + expect(within(section).getByText(paragraph)).toBeInTheDocument(), + ); + expect(await axeResults(container)).toHaveNoViolations(); + }); + + it('shows extra content below the text', async () => { + await renderWithProviders( + + Boek je shoot + , + ); + const section = screen.getByRole('region', { name: personal.title }); + expect( + within(section).getByRole('link', { name: 'Boek je shoot' }), + ).toBeInTheDocument(); + }); +}); diff --git a/web/src/components/about/StorySection/StorySection.tsx b/web/src/components/about/StorySection/StorySection.tsx new file mode 100644 index 0000000..a1e284a --- /dev/null +++ b/web/src/components/about/StorySection/StorySection.tsx @@ -0,0 +1,53 @@ +import type { ReactNode } from 'react'; +import { Box, Stack, Text } from '@chakra-ui/react'; +import Eyebrow from '@/components/Eyebrow/Eyebrow'; +import PageSection from '@/components/PageSection/PageSection'; +import Reveal from '@/components/Reveal/Reveal'; +import type { AboutPageContent } from '@/content/types'; + +type StorySectionProps = { + content: AboutPageContent['background']; + // Id of the h3, which names the section + titleId: string; + tone?: 'paper' | 'alt'; + spacing?: 'default' | 'flushTop'; + 'data-testid'?: string; + // Shown below the text, e.g. the booking button + children?: ReactNode; +}; + +// One part of Andrea's story in the narrow column. Its heading is an h3 in +// the small label style: the story continues "Hoi! Ik ben Andrea" (FR-OM-03). +export default function StorySection({ + content, + titleId, + tone, + spacing, + 'data-testid': testId, + children, +}: StorySectionProps) { + return ( + + + + {content.title} + + + {content.paragraphs.map((paragraph) => ( + {paragraph} + ))} + + {/* design .mt-lg */} + {children && ( + {children} + )} + + + ); +} diff --git a/web/src/content/aboutContent.ts b/web/src/content/aboutContent.ts new file mode 100644 index 0000000..6db9a0a --- /dev/null +++ b/web/src/content/aboutContent.ts @@ -0,0 +1,80 @@ +import type { AboutPageContent } from './types'; + +// Images +import portrait from '../assets/about/andrea-portret.jpg'; +import concert from '../assets/about/about-1.jpg'; +import cat from '../assets/about/about-2.jpg'; + +// Static content of the about page until the CMS API exists; texts from the +// live site, structure from the design (FR-OM-01..05). +const aboutContent: AboutPageContent = { + head: { + eyebrow: 'Andrea Slop Fotografie', + title: 'Over mij', + }, + intro: { + eyebrow: 'Lifestyle fotograaf', + title: 'Hoi! Ik ben Andrea', + paragraphs: [ + [ + 'Hoi! Ik ben Andrea, een fotograaf met liefde voor het vastleggen van momenten. Momenten die je voor altijd bewaart.', + ], + [ + "Mijn stijl is te omschrijven als warm en spontaan. Ik houd van natuurlijke, ongedwongen foto's die een verhaal vertellen.", + ], + [ + 'Nieuwsgierig naar mijn werk? Bekijk ', + { text: 'mijn portfolio', to: '/portfolio' }, + ' of ', + // The homepage contact section until /contact exists + { text: 'neem contact op', to: '/', hash: 'contact' }, + ' voor een fotoshoot!', + ], + ], + image: { + src: portrait, + alt: 'Andrea Slop in een groene trui met haar camera in de handen, glimlachend in het bos', + width: 1200, + height: 800, + }, + }, + background: { + title: 'Hoe het begon', + paragraphs: [ + "Tijdens de studie Communicatie & Media Design kon ik mijn creativiteit kwijt in verschillende vormen. Fotografie was mijn favoriet. De keuze voor de minor Fotojournalistiek was dan ook snel gemaakt. Tijdens de studie werd mijn liefde voor fotografie alleen maar groter. Waar ik voorheen altijd foto's in mijn vrije tijd maakte, ging ik tijdens de minor op pad voor verschillende opdrachten. Tijdens het fotograferen van een concert voelde ik me meteen op mijn plek. De hele zaal door met mijn camera. Ik was helemaal in mijn element. Het was even een zoektocht maar uiteindelijk heb ik mijn specialisatie gevonden. Je kunt bij mij terecht voor newbornshoots, zwangerschapsshoots en gezinsshoots.", + ], + }, + photos: [ + { + src: concert, + alt: 'Concert vanaf het podium: de zanger steekt zijn microfoon omhoog voor een volle zaal in blauw licht', + width: 1200, + height: 798, + }, + { + src: cat, + alt: 'Een grijze langharige kat slaapt met een uitgestrekte poot op de bank', + width: 1200, + height: 800, + }, + ], + personal: { + title: 'Buiten de camera om', + paragraphs: [ + 'Mijn camera gaat altijd mee op reis. Het liefst ga ik naar een plek met een mooie zee maar ik ga ook graag op pad om de natuur vast te leggen met mijn camera.', + 'Wanneer ik niet achter de camera sta ben ik bezig met tekenen, schilderen of lezen.', + ], + }, + booking: { label: 'Boek je shoot', to: '/', hash: 'contact' }, + person: { + name: 'Andrea Slop', + jobTitle: 'Lifestyle fotograaf', + knowsAbout: [ + 'Newbornfotografie', + 'Zwangerschapsfotografie', + 'Gezinsfotografie', + ], + }, +}; + +export default aboutContent; diff --git a/web/src/content/types.ts b/web/src/content/types.ts index b02e3ce..3940245 100644 --- a/web/src/content/types.ts +++ b/web/src/content/types.ts @@ -88,6 +88,36 @@ export interface HomeContent { }; } +// Where a link goes: a route (a typo is a type error) and optionally an +// anchor on that page, without the '#' +export interface LinkTarget { + to: RoutePath; + hash?: string; +} + +export type InlineLink = LinkTarget & { text: string }; + +// A paragraph as text pieces and links in reading order, so the API can +// deliver links inside running text without HTML. Spaces belong to the text. +export type RichText = (string | InlineLink)[]; + +// Content of the about page (/over-mij) +export interface AboutPageContent { + head: { eyebrow: string; title: string }; + intro: { + eyebrow: string; + title: string; + paragraphs: RichText[]; + image: ContentImage; + }; + background: { title: string; paragraphs: string[] }; + photos: [ContentImage, ContentImage]; + personal: { title: string; paragraphs: string[] }; + booking: LinkTarget & { label: string }; + // For the structured data about Andrea; summarises what the page says + person: { name: string; jobTitle: string; knowsAbout: string[] }; +} + export interface HeroSlide { id: string; src: string; diff --git a/web/src/lib/knowsAboutList.test.ts b/web/src/lib/knowsAboutList.test.ts new file mode 100644 index 0000000..f482b32 --- /dev/null +++ b/web/src/lib/knowsAboutList.test.ts @@ -0,0 +1,48 @@ +import fc from 'fast-check'; +import { describe, expect, it } from 'vitest'; +import { knowsAboutEntries } from '@/test/arbitraries'; +import { knowsAboutList } from './knowsAboutList'; + +describe('knowsAboutList', () => { + it('trims, drops empty entries and duplicates, keeps the first one', () => { + expect( + knowsAboutList([ + ' Newbornfotografie ', + '', + ' ', + 'Gezinsfotografie', + 'Newbornfotografie', + ]), + ).toEqual(['Newbornfotografie', 'Gezinsfotografie']); + }); + + it('only keeps trimmed, non-empty, unique input entries (invariant)', () => { + fc.assert( + fc.property(knowsAboutEntries, (entries) => { + const out = knowsAboutList(entries); + const trimmed = entries.map((entry) => entry.trim()); + expect(out.every((entry) => entry !== '')).toBe(true); + expect(out.every((entry) => trimmed.includes(entry))).toBe( + true, + ); + expect(new Set(out).size).toBe(out.length); + // Every non-empty input entry survives, in first-seen order + expect(out).toEqual( + trimmed.filter( + (entry, index) => + entry !== '' && trimmed.indexOf(entry) === index, + ), + ); + }), + ); + }); + + it('changes nothing the second time (idempotency)', () => { + fc.assert( + fc.property(knowsAboutEntries, (entries) => { + const once = knowsAboutList(entries); + expect(knowsAboutList(once)).toEqual(once); + }), + ); + }); +}); diff --git a/web/src/lib/knowsAboutList.ts b/web/src/lib/knowsAboutList.ts new file mode 100644 index 0000000..496903d --- /dev/null +++ b/web/src/lib/knowsAboutList.ts @@ -0,0 +1,6 @@ +// The specialisations for the structured data (BR-SD-05): trimmed, without +// empty entries or duplicates, in the order the CMS delivers them. +export function knowsAboutList(entries: readonly string[]): string[] { + const trimmed = entries.map((entry) => entry.trim()).filter(Boolean); + return [...new Set(trimmed)]; +} diff --git a/web/src/routes/over-mij.tsx b/web/src/routes/over-mij.tsx index 8e8e469..62a02a9 100644 --- a/web/src/routes/over-mij.tsx +++ b/web/src/routes/over-mij.tsx @@ -1,17 +1,63 @@ import { createFileRoute } from '@tanstack/react-router'; +import AboutIntro from '../components/about/AboutIntro/AboutIntro'; +import StorySection from '../components/about/StorySection/StorySection'; +import LinkButton from '../components/LinkButton'; import PageIntro from '../components/PageIntro/PageIntro'; -import { pageHead } from '../seo'; +import PageSection from '../components/PageSection/PageSection'; +import PhotoDuo from '../components/PhotoDuo/PhotoDuo'; +import aboutContent from '../content/aboutContent'; +import siteContent from '../content/siteContent'; +import { aboutPage, pageHead, structuredDataScript } from '../seo'; export const Route = createFileRoute('/over-mij')({ - head: () => pageHead('/over-mij'), + head: () => ({ + ...pageHead('/over-mij'), + scripts: [ + structuredDataScript( + aboutPage('/over-mij', aboutContent.person, siteContent), + ), + ], + }), component: About, }); -// Placeholder tot de echte pagina er is (noindex via sitePages) +// The about page: who Andrea is, how it started, two photos and what she +// does besides photography, in the order of LAYOUT.md function About() { + const { head, intro, background, photos, personal, booking } = aboutContent; return ( - - Deze pagina is nog in de maak. Kom snel terug! - + <> + + + + {/* No heading in the design, so no named region (BR-OM-11) */} + + + + + + {booking.label} + + + ); } diff --git a/web/src/seo.test.ts b/web/src/seo.test.ts index d4f6eb3..ae9c8d4 100644 --- a/web/src/seo.test.ts +++ b/web/src/seo.test.ts @@ -1,15 +1,28 @@ import fc from 'fast-check'; import { describe, expect, it } from 'vitest'; +import aboutContent from './content/aboutContent'; import siteContent from './content/siteContent'; +import { emailAddress } from './lib/emailAddress'; +import { visibleSocials } from './lib/visibleSocials'; import { + aboutPage, + businessId, canonicalUrl, jsonLdScript, pageHead, + person, + personId, professionalService, siteHead, siteUrl, + structuredDataScript, } from './seo'; -import { routePath } from './test/arbitraries'; +import sitePages from './sitePages'; +import { + anySiteContent, + knowsAboutEntries, + routePath, +} from './test/arbitraries'; const meta = (head: ReturnType, key: string) => head.meta.find( @@ -122,3 +135,146 @@ describe('professionalService en siteHead', () => { ); }); }); + +describe('pageHead for the about page', () => { + it('is indexed, with its own title, description and preview image', () => { + const head = pageHead('/over-mij'); + expect(head.meta[0]).toEqual({ + title: 'Over mij – fotograaf in Huizen | Andrea Slop Fotografie', + }); + expect(meta(head, 'robots')).toBeUndefined(); + expect(meta(head, 'description')).toMatchObject({ + content: sitePages['/over-mij'].description, + }); + expect(meta(head, 'og:image')).toMatchObject({ + content: `${siteUrl}/og-over-mij.jpg`, + }); + expect(head.links[0].href).toBe(`${siteUrl}/over-mij`); + }); + + it('keeps title and description within what search engines show', () => { + const page = sitePages['/over-mij']; + expect( + `${page.title} | Andrea Slop Fotografie`.length, + ).toBeLessThanOrEqual(60); + expect(page.description.length).toBeLessThanOrEqual(155); + }); +}); + +describe('structured data about Andrea', () => { + const image = `${siteUrl}/og-over-mij.jpg`; + + it('describes Andrea from the page content and the site socials', () => { + expect(person(aboutContent.person, siteContent, image)).toEqual({ + '@type': 'Person', + '@id': personId, + name: 'Andrea Slop', + jobTitle: 'Lifestyle fotograaf', + image, + address: { + '@type': 'PostalAddress', + addressLocality: 'Huizen', + addressCountry: 'NL', + }, + url: `${siteUrl}/over-mij`, + worksFor: { '@id': businessId }, + knowsAbout: [ + 'Newbornfotografie', + 'Zwangerschapsfotografie', + 'Gezinsfotografie', + ], + sameAs: siteContent.socials.map((social) => social.href), + }); + }); + + it('leaves out empty lists instead of writing them', () => { + const data = person( + { ...aboutContent.person, knowsAbout: [' ', ''] }, + { ...siteContent, socials: [] }, + image, + ); + expect(data).not.toHaveProperty('knowsAbout'); + expect(data).not.toHaveProperty('sameAs'); + }); + + it('links Andrea and the business both ways (invariant)', () => { + fc.assert( + fc.property(anySiteContent, (site) => { + const business = professionalService(site); + const andrea = person(aboutContent.person, site, image); + expect(business['@id']).toBe(businessId); + expect(business.founder['@id']).toBe(andrea['@id']); + expect(andrea.worksFor['@id']).toBe(business['@id']); + }), + ); + }); + + it('lists exactly the valid https socials in sameAs (invariant)', () => { + fc.assert( + fc.property(anySiteContent, (site) => { + const valid = visibleSocials(site.socials).map((s) => s.href); + const andrea = person(aboutContent.person, site, image); + expect(andrea.sameAs ?? []).toEqual(valid); + }), + ); + }); + + it('lists the cleaned specialisations in knowsAbout (invariant)', () => { + fc.assert( + fc.property(knowsAboutEntries, (entries) => { + const andrea = person( + { ...aboutContent.person, knowsAbout: entries }, + siteContent, + image, + ); + const list = andrea.knowsAbout ?? []; + expect( + list.every( + (entry) => entry === entry.trim() && entry !== '', + ), + ).toBe(true); + expect(new Set(list).size).toBe(list.length); + }), + ); + }); + + it('never contains the e-mail address, on any page (invariant)', () => { + fc.assert( + fc.property(anySiteContent, (site) => { + const address = emailAddress(site.email); + const out = + jsonLdScript( + aboutPage('/over-mij', aboutContent.person, site), + ) + jsonLdScript(professionalService(site)); + return address === null || !out.includes(address); + }), + ); + }); + + it('matches the page registry and canonical URL (invariant)', () => { + fc.assert( + fc.property(anySiteContent, (site) => { + const page = aboutPage('/over-mij', aboutContent.person, site); + expect(page['@id']).toBe(canonicalUrl('/over-mij')); + expect(page.url).toBe(canonicalUrl('/over-mij')); + expect(page.name).toBe(sitePages['/over-mij'].title); + expect(page.description).toBe( + sitePages['/over-mij'].description, + ); + expect(page.mainEntity.image).toBe(image); + }), + ); + }); + + it('falls back to the site preview image for a page without its own', () => { + const page = aboutPage('/portfolio', aboutContent.person, siteContent); + expect(page.mainEntity.image).toBe(`${siteUrl}/og-image.jpg`); + }); + + it('wraps data in an escaped ld+json script tag', () => { + const script = structuredDataScript({ name: '' }); + expect(script.type).toBe('application/ld+json'); + expect(script.children).not.toMatch(/[<>]/); + expect(JSON.parse(script.children)).toEqual({ name: '' }); + }); +}); diff --git a/web/src/seo.ts b/web/src/seo.ts index c2123e3..4e14086 100644 --- a/web/src/seo.ts +++ b/web/src/seo.ts @@ -1,6 +1,7 @@ // SEO: head-tags per pagina en voor de hele site, plus gestructureerde data. // Titels en beschrijvingen staan in het pagina-register (sitePages.ts). -import type { SiteContent } from './content/types.ts'; +import type { AboutPageContent, SiteContent } from './content/types.ts'; +import { knowsAboutList } from './lib/knowsAboutList.ts'; import { visibleSocials } from './lib/visibleSocials.ts'; import type { RoutePath } from './navigation.ts'; import sitePages from './sitePages.ts'; @@ -61,24 +62,85 @@ export function jsonLdScript(data: unknown): string { .replace(/&/g, '\\u0026'); } +// Stable ids, so the business on every page and Andrea on the about page +// refer to each other (BR-SD-03) +export const businessId = `${siteUrl}/#business`; +export const personId = `${siteUrl}/over-mij#andrea`; + +const huizen = { + '@type': 'PostalAddress', + addressLocality: 'Huizen', + addressCountry: 'NL', +} as const; + // Gestructureerde data: een lokale fotograaf in Huizen. Bewust zonder // e-mailadres, anders staat het alsnog leesbaar in de pagina. export function professionalService(content: SiteContent) { return { '@context': 'https://schema.org', '@type': 'ProfessionalService', + '@id': businessId, name: siteName, url: `${siteUrl}/`, logo: `${siteUrl}/logo.png`, image: siteUrl + defaultOgImage.path, description: sitePages['/'].description, - address: { - '@type': 'PostalAddress', - addressLocality: 'Huizen', - addressCountry: 'NL', - }, + address: huizen, areaServed: { '@type': 'Place', name: 'Huizen' }, sameAs: visibleSocials(content.socials).map((social) => social.href), + founder: { '@id': personId }, + }; +} + +// Andrea as a person (BR-SD-01..05). Optional lists are left out when empty; +// no e-mail address, for the same reason as above. +export function person( + content: AboutPageContent['person'], + site: SiteContent, + image: string, +) { + const sameAs = visibleSocials(site.socials).map((social) => social.href); + const knowsAbout = knowsAboutList(content.knowsAbout); + return { + '@type': 'Person', + '@id': personId, + name: content.name, + jobTitle: content.jobTitle, + image, + address: huizen, + url: canonicalUrl('/over-mij'), + worksFor: { '@id': businessId }, + ...(knowsAbout.length > 0 ? { knowsAbout } : {}), + ...(sameAs.length > 0 ? { sameAs } : {}), + }; +} + +// The about page with Andrea as its subject (BR-SD-06); name, description +// and preview image come from the page registry +export function aboutPage( + path: RoutePath, + content: AboutPageContent['person'], + site: SiteContent, +) { + const page = sitePages[path]; + const image = siteUrl + (page.ogImage ?? defaultOgImage).path; + return { + '@context': 'https://schema.org', + '@type': 'AboutPage', + '@id': canonicalUrl(path), + url: canonicalUrl(path), + name: page.title, + description: page.description, + inLanguage: 'nl-NL', + mainEntity: person(content, site, image), + }; +} + +// A head script tag with structured data, escaped by jsonLdScript (BR-SD-07) +export function structuredDataScript(data: unknown) { + return { + type: 'application/ld+json', + children: jsonLdScript(data), }; } @@ -91,11 +153,6 @@ export function siteHead(content: SiteContent) { { property: 'og:type', content: 'website' }, { name: 'twitter:card', content: 'summary_large_image' }, ], - scripts: [ - { - type: 'application/ld+json', - children: jsonLdScript(professionalService(content)), - }, - ], + scripts: [structuredDataScript(professionalService(content))], }; } diff --git a/web/src/sitePages.ts b/web/src/sitePages.ts index 499585a..a329bba 100644 --- a/web/src/sitePages.ts +++ b/web/src/sitePages.ts @@ -26,10 +26,16 @@ const sitePages: Record = { indexed: true, }, '/over-mij': { - title: 'Over mij', + title: 'Over mij – fotograaf in Huizen', description: - 'Hi! Ik ben Andrea, lifestyle fotograaf uit Huizen. Ik leg jullie vast zoals jullie zijn: spontaan en natuurlijk, zonder ongemakkelijke poses.', - indexed: false, + "Hoi! Ik ben Andrea, lifestyle fotograaf uit Huizen. Ik maak warme, spontane foto's die een verhaal vertellen: newborn-, zwangerschaps- en gezinsshoots.", + indexed: true, + ogImage: { + path: '/og-over-mij.jpg', + width: 1200, + height: 630, + alt: 'Andrea Slop met haar camera in het bos', + }, }, '/portfolio': { title: 'Portfolio', diff --git a/web/src/sitemap.test.ts b/web/src/sitemap.test.ts index e506349..2febf09 100644 --- a/web/src/sitemap.test.ts +++ b/web/src/sitemap.test.ts @@ -17,9 +17,10 @@ const locs = (xml: string) => { const page = fc.record({ path: routePath, indexed: fc.boolean() }); describe('sitemapXml', () => { - it('bevat nu alleen de homepage', () => { + it('contains the homepage and the about page', () => { expect(locs(sitemapXml(pageList(sitePages), base))).toEqual([ `${base}/`, + `${base}/over-mij`, ]); }); diff --git a/web/src/test/arbitraries.ts b/web/src/test/arbitraries.ts index b9f92d1..9684764 100644 --- a/web/src/test/arbitraries.ts +++ b/web/src/test/arbitraries.ts @@ -4,6 +4,7 @@ import type { ContactFormEvent } from '../lib/contactFormReducer'; import type { EmailAddress, PricingPackage, + SiteContent, SocialLink, Testimonial, } from '../content/types'; @@ -55,6 +56,31 @@ export const anyEmail: fc.Arbitrary = fc.oneof( fc.record({ user: fc.string(), domain: fc.string() }), ); +// Site-wide content as the CMS could deliver it; a valid e-mail address, so +// tests can check it never leaks into output +export const anySiteContent: fc.Arbitrary = fc.record({ + footerIntro: fc.string(), + socials: fc.array(socialLink, { maxLength: 4 }), + email: validEmail, + contactForm: fc.record({ enabled: fc.boolean() }), +}); + +// Specialisations with padding, blanks and repeats, as an editor might type +const specialisation = fc.oneof( + fc.constantFrom('Newbornfotografie', 'Gezinsfotografie', '', ' '), + fc.string({ maxLength: 20 }), +); +export const knowsAboutEntries = fc.array( + fc + .tuple( + fc.constantFrom('', ' ', ' '), + specialisation, + fc.constantFrom('', ' '), + ) + .map(([before, text, after]) => before + text + after), + { maxLength: 8 }, +); + // Package ids: a few fixed ones so lists contain duplicates, plus random slugs const packageId = fc.oneof( fc.constantFrom('newborn', 'gezin', 'zwangerschap'),