Adds the portfolio page

The ten live photos in a filterable masonry grid with an accessible
lightbox, filters per shoot type kept in the URL (?shoot=), the shared
Instagram block, and an indexed page with image gallery structured data
and its own preview image. Soorten fotoshoots now only links to the
portfolio for shoot types that have photos there.

The filter bar stays on one row, so the web font loading no longer
shifts the photos below it, and no photo loads before the page has: the
grid fades in, so loading its photos early only delayed the fonts and the
intro text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-27 19:05:13 +01:00
co-authored by Claude Opus 5.5
parent 18bf0311ef
commit 9efa7fc596
58 changed files with 1492 additions and 48 deletions
+4 -2
View File
@@ -58,11 +58,13 @@ columns 1
```mermaid
block-beta
columns 1
A["Portfolio"]
B["Instagram"]
A["Intro"]
B["Portfolio"]
C["Instagram"]
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
```
## Types of shoots
@@ -13,7 +13,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('/over-mij')` + `AboutPage` JSON-LD | `PageIntro`, `AboutIntro`, `StorySection` ×2, `PhotoDuo`, `LinkButton` | yes |
| `/portfolio` | `routes/portfolio.tsx` | `pageHead(...)` | `PageIntro` placeholder | no |
| `/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 |
| `/contact` | `routes/contact.tsx` | `pageHead(...)` | `PageIntro` placeholder | no |
| `/privacyverklaring` | `routes/privacyverklaring.tsx` | `pageHead(...)` | `PageIntro` placeholder | no |
@@ -43,7 +43,7 @@ None. There is no back-end yet (`api/` is empty). The static design README antic
- `ContactForm(...)`, `ContactFormGate({ enabled, email, ... })`
- `PhotoDuo({ photos: [ContentImage, ContentImage], label, 'data-testid'? })`
- `PortfolioGrid({ items: GalleryItem[], eagerCount = 3, onOpen(index), onIntent?(), 'data-testid'? })`, `Lightbox({ items, index: number | null, onIndexChange, onClose, label?, finalFocusEl? })` (default export, lazy-loadable), `FilterBar({ options: FilterOption[], value, onChange, label })`
- `about/AboutIntro({ content })`, `about/StorySection({ content, titleId, tone?, spacing?, children? })`, `shoots/ShootList({ shoots, packages, portfolioLive })`, `shoots/ShootBlock({ shoot, packages, reverse, priority, portfolioLive })`
- `about/AboutIntro({ content })`, `about/StorySection({ content, titleId, tone?, spacing?, children? })`, `shoots/ShootList({ shoots, packages, portfolioShoots })` (types that link to the portfolio), `shoots/ShootBlock({ shoot, packages, reverse, priority, portfolioLink })`, `portfolio/PortfolioGallery({ photos, shootTypes, shoot, onShootChange })`
- `StatusPage({ title, children, actions? })`, `ErrorPage({ error, reset })`
- `LinkButton(RouterLink props & { variant?: 'outline' | 'accent' | 'light' })`
- `UmamiAnalytics({ hostname? })`
@@ -62,6 +62,7 @@ None. There is no back-end yet (`api/` is empty). The static design README antic
- `slidesToLoad(active, count): number[]`
- `backToTopThreshold(viewportHeight): number`
- `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`)
### Monitoring
@@ -78,6 +79,10 @@ None. There is no back-end yet (`api/` is empty). The static design README antic
- **Fields**: `title`, `handle`, `photos: ContentImage[]` (the intro photos followed by the review photos, `instagramContent.ts`)
### LinkTarget / InlineLink / RichText
- **Fields**: `{ to: RoutePath; hash? }`; `InlineLink` adds `text`; `RichText = (string | InlineLink)[]`
### PortfolioContent / PortfolioPhoto
- **Fields**: `intro` (eyebrow, title, text), `photos: PortfolioPhoto[]` — `{ id, shootType: ShootTypeId, thumb: ContentImage (800 px wide), full: ImageSource (1600 px long side) }`
### GalleryItem / FilterOption
- **Fields**: `{ id, thumb, full, caption? }` / `{ id, label }` (generic, for the gallery blocks)
### AboutPageContent
- **Fields**: `head`, `intro` (eyebrow, title, `paragraphs: RichText[]`, image), `background`, `photos`, `personal`, `booking` (label + LinkTarget), `person` (name, jobTitle, knowsAbout)
### PricingPackage / Testimonial
@@ -17,7 +17,8 @@ graph TD
Shell --> Umami["UmamiAnalytics"]
Outlet --> Home["routes/index.tsx: Hero + six sections"]
Outlet --> About["routes/over-mij.tsx: about page"]
Outlet --> Placeholders["portfolio, contact, privacyverklaring: PageIntro"]
Outlet --> Portfolio["routes/portfolio.tsx: PortfolioGallery + InstagramGrid"]
Outlet --> Placeholders["contact, privacyverklaring: PageIntro"]
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"]
@@ -35,7 +36,7 @@ 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,About,Placeholders,Hero,Sections,Form page;
class Home,About,Portfolio,Placeholders,Hero,Sections,Form page;
class Content,NavData,Seo,Theme,Blocks support;
```
@@ -37,8 +37,9 @@ Text alternative: visitors and crawlers use the website, which links out to soci
- **Recover from errors** — 404 page inside the shell, error page with retry
- **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"
- *Soorten fotoshoots* (`/soorten-fotoshoots`, indexed): the five shoot types (Newborn, Zwangerschap, Gezin, Loveshoot, Portretten) with photo, text, a contact link (package preselected where one exists) and, once the portfolio is live, a filtered portfolio link; closing call to action to the prices
- *Placeholder pages (noindex)*: Portfolio, Contact, Privacyverklaring
- *Planned (static design only)*: portfolio with lightbox, shoot types and pricing page, contact page
- **Browse the portfolio** (`/portfolio`, indexed) — ten photos in a masonry grid, filters per shoot type (Alles, Newborn, Zwangerschap, Gezin; `?shoot=` in the URL), lightbox with captions, Instagram block; linked from Soorten fotoshoots per shoot type that has photos
- *Placeholder pages (noindex)*: Contact, Privacyverklaring
- *Planned (static design only)*: 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
@@ -65,7 +65,8 @@ Candidates for modification are marked with ★ for the over-mij-page feature.
- `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/{portfolio,contact,privacyverklaring}.tsx` — placeholders with `PageIntro`
- `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
- `web/src/components/NavigationBar/*` — header, NavLink, MobileNav
- `web/src/components/Footer/*` — footer, FooterColumn, FooterLink
@@ -5,7 +5,7 @@
- **Feature Slug**: portfolio-page
- **Project Type**: Brownfield
- **Start Date**: 2026-10-24T19:30:00Z
- **Current Stage**: CONSTRUCTION - Code Generation (Unit 2 Gallery building blocks, generated, awaiting approval)
- **Current Stage**: CONSTRUCTION - Code Generation (Unit 3 Portfolio page, generated, awaiting approval)
- **Branch**: feature/portfolio-page (rebased onto master 1bf28cb after contact-page PR #10)
- **Worktree**: K:\Development\SlpSoftware\Projects\AndreaSlopFotografie-portfolio
@@ -79,11 +79,11 @@ Parallel features, each in its own worktree (originally stacked on feature/over-
- [ ] Units Generation - SKIP
### 🟢 CONSTRUCTION PHASE
- [~] Functional Design - EXECUTE (units 2 and 3) / SKIP (unit 1) — Unit 2 ✅
- [~] Functional Design - EXECUTE (units 2 and 3) / SKIP (unit 1) — Unit 2 ✅; Unit 3 ✅
- [ ] NFR Requirements - SKIP
- [ ] NFR Design - SKIP
- [ ] Infrastructure Design - SKIP
- [~] Code Generation - EXECUTE (per unit) — Unit 1 Shared Instagram block ✅ (e013f14 after rebases); Unit 2 Gallery building blocks: generated, awaiting approval
- [~] Code Generation - EXECUTE (per unit) — Unit 1 Shared Instagram block ✅ (e013f14 after rebases); Unit 2 Gallery building blocks ✅ (18bf031); Unit 3 Portfolio page: generated, awaiting approval
- [ ] Build and Test - EXECUTE
### 🟡 OPERATIONS PHASE
@@ -268,3 +268,51 @@ Feature "portfolio-page" may affect components also touched by active feature "o
**Context**: CONSTRUCTION - Code Generation Unit 2 (generated, awaiting approval)
---
## Code Generation — Unit 2 — Approval; SSH agent; Functional Design Unit 3 start
**Timestamp**: 2026-10-27T08:00:00Z
**User Input**: "start de ssh agent, want de pc is tussendoor uit geweest. Dan kan je pushen zodra ik wil dta je dta doet. Ga daarna verder naar de volgende stage"
**AI Response**: "Unit 2 approved (18bf031). No agent was running; started one without -t (ssh-agent -s > ~/.ssh/agent.env, PID 1170); it has no identities yet — asked the user to run ssh-add themselves (passphrase). Push only on the user's request. Started Functional Design for unit 3: downloaded the 10 live portfolio photos into a scratch folder (sizes 1067×1600 / 1600×1067, one 2560×1707), viewed them, and created construction/plans/portfolio-page-functional-design-plan.md and portfolio-page-fd-questions.md with a proposal of shoot type and alt text per photo (Newborn 6, Zwangerschap 2, Gezin 2; no Loveshoot or Portret) and 4 questions (approve proposal, photos 2/4 newborn or gezin, OG photo, Soorten links follow-up)."
**Context**: CONSTRUCTION - Functional Design Unit 3 (awaiting answers)
---
## Functional Design — Unit 3 — Answers and Artifacts
**Timestamp**: 2026-10-27T08:30:00Z
**User Input**: "ik heb de vragen beantwoord"
**AI Response**: "Answers: Q1 A (shoot types and alt texts as proposed), Q2 A (photos 2 and 4 stay Newborn), Q3 A (preview image from photo 7), Q4 A (wire the 'types with photos' helper into Soorten fotoshoots in this unit; 3 links instead of 5). No ambiguities. Generated construction/portfolio-page/functional-design/{domain-entities, business-rules, business-logic-model, frontend-components}.md: the 10 photos with ids, types, sizes and alt texts; filter, ?shoot=, caption, SEO (ImageGallery with ImageObjects, og-portfolio.jpg, /portfolio indexed but not in photoPagePaths unless measured below 0.9 and the user agrees) and Soorten link rules; new pure helpers with properties; PortfolioGallery and the route; ShootList/ShootBlock prop portfolioLive → portfolioShoots."
**Context**: CONSTRUCTION - Functional Design Unit 3 (awaiting approval)
---
## Functional Design — Unit 3 — Approval
**Timestamp**: 2026-10-27T08:45:00Z
**User Input**: "approved, ga door. ssh key is ook geladen"
**AI Response**: "Functional design of unit 3 approved. Verified the ED25519 key is loaded in the agent (push still only on request). Created construction/plans/portfolio-page-code-generation-plan.md (15 steps: photo processing with a one-off System.Drawing script, content and types, portfolioFilters helpers with PBT, galleryImages, PortfolioGallery, route, sitePages/lighthouserc/sitemap, app tests, Soorten links prop change, LAYOUT.md, RE lines, pnpm check with a stop-and-ask if /portfolio mobile < 0.9, visual check offered via deploy_test on request, summary, commit)."
**Context**: CONSTRUCTION - Code Generation Unit 3 (plan awaiting approval)
---
## Code Generation — Unit 3 — Plan Approval, Generation and Loading Decision
**Timestamp**: 2026-10-27T18:10:00Z
**User Input**: "Approve plan" — later "Ga verder waar je gebleven was" — and, asked in chat (AskUserQuestion) how the first portfolio photos load: "Geen foto direct laden (Recommended)"
**AI Response**: "Executed portfolio-page-code-generation-plan.md. Photos processed with a one-off System.Drawing script (first run failed: in PowerShell argument mode `[long]80` was passed as a string; fixed with `EncoderParameter]::new`). Content, portfolioFilters with PBT, galleryImages, PortfolioGallery (closes the lightbox on any filter change, detected during render), route, sitePages/lighthouserc/sitemap, app tests, Soorten links prop change, LAYOUT.md, RE lines. First pnpm check: /portfolio mobile 0.77. Diagnosed with dedicated Lighthouse runs: LCP was the intro text at 4.5 s because the 3 eager (but Reveal-hidden) photos competed with the fonts; CLS 0.119 came from the filter bar re-wrapping when the web font loaded (measured: without the bar CLS 0). Fixed the filter bar at the cause (single non-wrapping row; CLS 0.001) and asked the user about eager loading (0.80 with vs 0.91 without, two runs each); user chose no eager photos; requirements FR-PF-07 and BR-LD-01 updated. Final pnpm check: tests 82/460 green, /portfolio passes; remaining mobile failures (/, /soorten-fotoshoots, /contact) measured equally on master (pre-existing). Desktop green after one transient connection-refused rerun. Committed locally (no push)."
**Context**: CONSTRUCTION - Code Generation Unit 3 (generated, awaiting approval)
---
@@ -0,0 +1,48 @@
# Code Generation Plan — Unit 3: Portfolio page
Single source of truth for code generation of this unit. Workspace root: `K:\Development\SlpSoftware\Projects\AndreaSlopFotografie-portfolio` (worktree); all code in `web/src/` unless stated. Branch `feature/portfolio-page` (on master 1bf28cb, which already contains `webPage()` and `shootTypes.ts`).
## Unit Context
- **Requirements**: FR-PF-01, 02, 04, 08 (on this page), 09; SEO-PF-01..05; NFR-PF-01, 03..06
- **Design**: [functional design](../portfolio-page/functional-design/) (photos table, rules BR-PH/FL/SP/CP/SEO/SL/LY, helpers and properties, components)
- **Dependencies**: units 1 (`InstagramGrid`) and 2 (`PortfolioGrid`, `Lightbox`, `FilterBar`, `lightboxReducer`); master's `shootTypes.ts`, `webPage()`, `lib/shootLinks.ts` (`isPortfolioLive`)
- **Touches code of the finished Soorten fotoshoots feature**: `ShootList`, `ShootBlock`, `routes/soorten-fotoshoots.tsx`, `app.test.tsx` (agreed follow-up, Q4 = A)
## Steps
### Photos
- [x] **Step 1** — One-off PowerShell script in the scratchpad (.NET `System.Drawing`, high-quality bicubic, JPEG quality ~80, same approach as earlier features; not part of the project): from the 10 downloaded originals create `web/src/assets/portfolio/{id}.jpg` (800 px wide) and `{id}-groot.jpg` (1600 px long side), and `web/public/og-portfolio.jpg` (1200 × 630 centre crop of photo 7). Record the resulting sizes.
### Content and helpers
- [x] **Step 2** — `content/types.ts`: `PortfolioPhoto`, `PortfolioContent`. `content/portfolioContent.ts`: intro + 10 photos (domain-entities.md), images imported from `assets/portfolio/`.
- [x] **Step 3** — `lib/portfolioFilters.ts` (+ test): `isShootTypeId`, `shootTypesWithPhotos`, `shootFromSearch`, `filterPhotos`, `filterOptions` (`ALL_FILTER = 'alles'`), `toGalleryItems`, `photoCountLabel` — example tests and the properties in business-logic-model.md. `test/arbitraries.ts`: `portfolioPhoto` / `portfolioPhotos` generator.
- [x] **Step 4** — `seo.ts`: `galleryImages(photos, base = siteUrl)` (+ tests in `seo.test.ts`: one `ImageObject` per photo, absolute https URLs, description = alt, creator/copyrightHolder ids, no e-mail).
### Page
- [x] **Step 5** — `components/portfolio/PortfolioGallery/PortfolioGallery.tsx` (+ test): section with hidden h2 "Foto's", `FilterBar`, count live region, `PortfolioGrid`, lazy `Lightbox` (requested on intent or open), `lightboxReducer` state, close on filter change, focus return to the tile of the last shown photo. Tests: options, filtering and count announcement, `onShootChange` values (incl. "Alles" → `undefined`), invalid/unavailable shoot → Alles, open lightbox within the filtered list with caption, filter change closes it, axe.
- [x] **Step 6** — `routes/portfolio.tsx`: `validateSearch` (`{ shoot?: ShootTypeId }`), head (`pageHead` + `ImageGallery` JSON-LD), `PageIntro` (eyebrow, h1, intro), `PortfolioGallery` with replace navigation without scroll, `InstagramGrid` (valid Instagram link only).
- [x] **Step 7** — `sitePages.ts`: `/portfolio` `indexed: true` + `ogImage`; `lighthouserc.cjs`: `/portfolio` from `noindexPaths` to `indexedPaths` (not in `photoPagePaths`); `sitemap.test.ts` and other tests that list indexed pages updated.
- [x] **Step 8** — `app.test.tsx`: `/portfolio` renders the h1, filters, grid, Instagram; `?shoot=gezin` starts filtered; `?shoot=onzin` and `?shoot=loveshoot` show Alles; head has no `noindex`, canonical without parameters, `og:image`, the `ImageGallery` script.
### Soorten fotoshoots links (Q4 = A)
- [x] **Step 9** — `ShootList`/`ShootBlock`: prop `portfolioLive: boolean` → `portfolioShoots: readonly ShootTypeId[]`; `routes/soorten-fotoshoots.tsx` passes `shootTypesWithPhotos(...)` ids when `/portfolio` is live; tests updated (`app.test.tsx`: 3 links — newborn, zwangerschap, gezin).
### Docs and verification
- [x] **Step 10** — `LAYOUT.md`: Portfolio diagram Intro → Portfolio → Instagram (per `.ai/layout-conventions.md`).
- [x] **Step 11** — Reverse engineering: own lines about `/portfolio` (indexed, route, content, `PortfolioGallery`, helpers, `galleryImages`) and the Soorten links prop.
- [x] **Step 12** — `tsc`, ESLint, Prettier; ListAgents + "claim 4173"; `pnpm check`. Mobile Lighthouse for `/portfolio`: if below 0.9, stop and ask the user (0.85 photo-page budget or not) before touching `photoPagePaths`. Failures on `/` and `/contact` are compared with master as in unit 2.
- [x] **Step 13** — Visual check: no browser in this session. Offer a `deploy_test` (after "claim test") so the user can check the page on test, desktop and phone; do it only when the user asks. *Outcome: offered in the completion message.*
- [x] **Step 14** — Code summary `aidlc-docs/features/portfolio-page/construction/portfolio-page/code/code-summary.md`.
- [x] **Step 15** — Commit on `feature/portfolio-page` ("Adds the portfolio page"), with the unit 3 design docs. Push only when the user asks.
## Extension Compliance (unit 3)
| Rule | Status | Rationale |
|---|---|---|
| SECURITY-04 | Compliant | No CSP change; images self-hosted |
| SECURITY-05 | Compliant | `?shoot=` allowlisted (`isShootTypeId`), then checked against types with photos; never rendered |
| SECURITY-10 | Compliant | No new dependency; image processing is a one-off local script |
| SECURITY-11 | Compliant | Misuse case (crafted `?shoot=`) tested |
| SECURITY-13 | Compliant | No external resources; JSON-LD through `jsonLdScript` |
| Other SECURITY rules | N/A | No data stores, auth, server or infrastructure |
| PBT-01..07, 10 | Planned | Steps 3–4 (properties from business-logic-model.md, `portfolioPhoto` generator, example tests alongside) |
| PBT-08 / 09 | Compliant | Existing seed logging and fast-check |
@@ -0,0 +1,70 @@
# Functional Design-vragen — Unit 3: Portfoliopagina
Al vastgelegd (geen vraag nodig):
- **Volgorde**: zoals op de live site (1–10 hieronder).
- **Formaten**: raster 800 px breed; groot 1600 px aan de lange kant (foto 8 is nu 2560 px en wordt ook 1600). Hele foto, niet bijgesneden. Opgeslagen in `web/src/assets/portfolio/`.
- **Bijschrift in de lightbox** = de volledige naam van het shoottype uit `shootTypes.ts`: "Newbornshoot", "Zwangerschapsshoot", "Gezinsshoot". **Filterlabels** = de korte naam: "Newborn", "Zwangerschap", "Gezin".
- **Filters**: met deze 10 foto's zijn dat Alles, Newborn, Zwangerschap en Gezin. Loveshoot en Portret hebben geen foto en krijgen geen filter (verduidelijking 7). `?shoot=loveshoot` toont dus "Alles".
- **Kop boven het raster**: een h2 "Foto's" die alleen screenreaders horen (het ontwerp toont geen kop); de sectie is daarmee een benoemd landmark.
- **Titel en beschrijving**: blijven zoals ze zijn (vraag 11).
Vul per vraag de letter in na `[Answer]:`. Past geen enkele optie, kies dan de laatste (Anders) en licht toe.
---
## Voorstel: shoottype en alt-tekst per foto
| # | Bestand (live) | Wat er te zien is | Shoottype | Alt-tekst (voorstel) |
| --- | -------------- | ----------------------------------------------------------------------- | ------------ | ---------------------------------------------------------------------------------------- |
| 1 | F41A1916 | Baby in wit pakje ligt op de onderarm van een ouder, kijkt in de camera | Newborn | Pasgeboren baby in een wit pakje ligt op de onderarm van een ouder en kijkt in de camera |
| 2 | F41A1922 | Vader kust zijn baby op het hoofd | Newborn | Vader kust zijn pasgeboren baby op het hoofd |
| 3 | F41A7883 | Man omarmt zijn zwangere partner van achteren, zandvlakte bij avondzon | Zwangerschap | Aanstaande vader omarmt zijn zwangere partner op een zandvlakte in de avondzon |
| 4 | F41A7176 | Moeder drukt haar gezicht tegen het hoofdje van haar baby | Newborn | Moeder drukt haar gezicht tegen het hoofdje van haar pasgeboren baby |
| 5 | F41A8700 | Close-up van een slapende baby in een gestreept pakje | Newborn | Slapende pasgeboren baby in een bruin-wit gestreept pakje |
| 6 | F41A8206 | Zwangere buik in zwarte kleding, twee handen eromheen | Zwangerschap | Zwangere buik in een zwarte jurk, omarmd door twee handen |
| 7 | F41A1579 | Grote broer kust de baby op bed | Gezin | Grote broer kust zijn pasgeboren broertje of zusje op een wit bed |
| 8 | 5-F41A4650 | Babyvuistje tussen gebreide deken en geruite doek | Newborn | Babyvuistje tussen een gebreide deken en een geruite doek |
| 9 | F41A7138 | Vader en moeder kijken naar hun slapende baby | Gezin | Jonge ouders kijken samen naar hun slapende pasgeboren baby |
| 10 | F41A7284 | Blote voetjes in een gestreept gebreid broekje | Newborn | Blote babyvoetjes in een gestreept gebreid broekje |
Telling: Newborn 6, Zwangerschap 2, Gezin 2.
## Vraag 1: Klopt het voorstel hierboven?
- A) Ja, alle shoottypes en alt-teksten zoals voorgesteld (Andrea kan de alt-teksten later nog nalezen) (aanbevolen)
- B) Ja, maar met aanpassingen (beschrijf per nummer hieronder)
- X) Anders (beschrijf hieronder na de [Answer]:-tag)
[Answer]: A
## Vraag 2: Foto 2 en 4 (ouder met baby): Newborn of Gezin?
Op beide staat één ouder met een pasgeboren baby, binnen, in de stijl van de newbornshoots.
- A) **Newborn** (zoals voorgesteld): het zijn foto's uit een newbornshoot; Gezin houdt de foto's met meer gezinsleden (aanbevolen)
- B) **Gezin**: dan worden het 4 newborn- en 4 gezinsfoto's
- X) Anders (beschrijf hieronder na de [Answer]:-tag)
[Answer]: A
## Vraag 3: Preview-afbeelding bij delen (1200×630)
Liggende foto's passen het best in het brede formaat.
- A) **Foto 7** (grote broer kust de baby): warm, vertelt een verhaal, past bij "lifestyle" (aanbevolen)
- B) **Foto 5** (slapende baby, close-up)
- C) **Foto 6** (zwangere buik)
- X) Anders (beschrijf hieronder na de [Answer]:-tag)
[Answer]: A
## Vraag 4: Links "Bekijk meer …foto's" op Soorten fotoshoots
Die pagina toont straks bij elk shoottype een link naar het portfolio, ook bij Loveshoot en Portret. Daar zijn geen portfoliofoto's van, dus die links tonen "Alles". De sessie van Soorten fotoshoots is gestopt; het aansluiten van de helper ligt bij deze feature.
- A) **In deze unit**: de helper `shootTypesWithPhotos` in `ShootList`/`ShootBlock` aansluiten, zodat alleen Newborn, Zwangerschap en Gezin een link krijgen; de routetest gaat van 5 naar 3 links (aanbevolen)
- B) **Later, apart**: nu niets aan Soorten fotoshoots veranderen; tot die tijd linken Loveshoot en Portret naar "Alles"
- X) Anders (beschrijf hieronder na de [Answer]:-tag)
[Answer]: A
@@ -0,0 +1,10 @@
# Functional Design Plan — Unit 3: Portfolio page
Depth: standard. Scope from the execution plan: the photo data (shoot type and alt text per photo, approved by the user — clarification 4), the preview image, the `?shoot=` rules, the filter/caption mapping onto the unit 2 blocks, the `ImageGallery` structured data, the follow-up for the Soorten fotoshoots links, and the testable properties of the new helpers (PBT-01). Questions: [portfolio-page-fd-questions.md](portfolio-page-fd-questions.md).
- [x] Collect and analyse the answers in `portfolio-page-fd-questions.md`
- [x] `domain-entities.md` — `PortfolioPhoto`, `PortfolioContent`, the 10 photos with shoot type, alt text, sizes; relation to `ShootType`, `GalleryItem`, `ImageObject`
- [x] `business-rules.md` — photo and image rules (sizes, order), filter rules (options, `?shoot=` parsing and fallback, canonical), caption, lightbox scope, SEO (indexed, title/description unchanged, `ogImage`, `ImageGallery`), Soorten links rule, LAYOUT.md
- [x] `business-logic-model.md` — route → gallery → grid/lightbox flow; pure helpers and their properties (PBT-01)
- [x] `frontend-components.md` — `PortfolioGallery` and the route: hierarchy, props, state, accessibility, test ids
- [x] Validate against requirements.md, application-design.md, unit 2 design and the extension rules
@@ -0,0 +1,39 @@
# Code Summary — Unit 3: Portfolio page
Plan: [portfolio-page-code-generation-plan.md](../../plans/portfolio-page-code-generation-plan.md) · Design: [functional-design/](../functional-design/)
## Created
| File | What |
|---|---|
| `web/src/assets/portfolio/*.jpg` | 10 photos × 2: grid 800 px wide (35–143 kB), large 1600 px long side (104–292 kB); one-off `System.Drawing` script, JPEG quality 80 |
| `web/public/og-portfolio.jpg` | 1200 × 630 centre crop of photo 7 (68 kB) |
| `web/src/content/portfolioContent.ts` | Intro + the 10 approved photos (id, shoot type, sizes, alt) |
| `web/src/lib/portfolioFilters.ts` (+ test) | `isShootTypeId`, `shootTypesWithPhotos`, `shootFromSearch`, `filterPhotos`, `filterOptions`, `toGalleryItems`, `photoCountLabel`; example + property-based tests (oracle, idempotence, round-trip, invariants) |
| `web/src/components/portfolio/PortfolioGallery/` (+ test) | Section with hidden h2 "Foto's", `FilterBar`, count announcement, `PortfolioGrid` (`eagerCount={0}`), lazy `Lightbox` (requested on intent or open), `lightboxReducer`, closes on any filter change, focus return to the last shown tile |
## Modified
| File | Change |
|---|---|
| `web/src/routes/portfolio.tsx` | Real page: typed `validateSearch` (`{ shoot?: ShootTypeId }`), head with `ImageGallery` JSON-LD, `PageIntro`, `PortfolioGallery` (replace navigation, no scroll), `InstagramGrid` |
| `web/src/content/types.ts` | `PortfolioPhoto`, `PortfolioContent` |
| `web/src/seo.ts` (+ tests) | `galleryImages(photos)` (`ImageObject`s, absolute URLs, creator/copyrightHolder ids) |
| `web/src/sitePages.ts` | `/portfolio` indexed, `ogImage` |
| `web/lighthouserc.cjs` | `/portfolio` in `indexedPaths` (default budget 0.9, not a photo page) |
| `web/src/test/arbitraries.ts` | `portfolioPhoto`, `portfolioPhotos` |
| `web/src/components/shoots/ShootList`, `ShootBlock`, `routes/soorten-fotoshoots.tsx` (+ tests) | `portfolioLive` → `portfolioShoots` / `portfolioLink`: "Bekijk meer …foto's" only for newborn, zwangerschap, gezin |
| `web/src/components/FilterBar/FilterBar.tsx`, `recipes/filterControl.ts` | One row that never wraps (`nowrap`, horizontal scroll if too narrow, `safe center`): fixes a layout shift (CLS 0.119 → 0.001) when the web font replaced the fallback |
| `web/src/app.test.tsx`, `seo.test.ts`, `sitemap.test.ts` | Portfolio route tests (outline, filters, `?shoot=` incl. invalid values, canonical, og:image, JSON-LD, replace navigation); placeholder examples moved to `/privacyverklaring`; Soorten expects 3 portfolio links |
| `LAYOUT.md` | Portfolio: Intro → Portfolio → Instagram |
| `aidlc-docs/_shared/reverse-engineering/*` | Own lines about `/portfolio`, the gallery, helpers and the Soorten links prop |
| `requirements.md` FR-PF-07, `business-rules.md` BR-LD-01 | No eager grid photos (user decision, see below) |
## Decisions during generation
- **Eager loading** (user decision 2026-10-27): the grid fades in (`Reveal`), so its photos are never the largest paint; the 3 eager photos only competed with the fonts and delayed the intro text (LCP 4.5 s → 2.9 s without). Measured twice each: 0.80 with, 0.91 without.
- **Filter bar layout shift**: diagnosed by measuring without the bar (CLS 0) and fixed at the cause (single non-wrapping row), not by reserving extra space.
## Verification
- `tsc`, ESLint, Prettier: clean.
- Tests: ✅ 82 files, 460 tests.
- Lighthouse desktop: ✅ all 7 URLs (one earlier run had a transient `ERR_CONNECTION_REFUSED` on port 4173 caused by the measuring runs just before; the rerun passed).
- Lighthouse mobile: ✅ `/portfolio` (≥ 0.9; 0.91 in the dedicated runs). ❌ pre-existing, same on master: `/` 0.77 (budget 0.8), `/soorten-fotoshoots` 0.84 (budget 0.85; master 0.84, this branch 0.86 in dedicated runs), `/contact` 0.87 (budget 0.9). Open item in the memory note "Open follow-ups".
- Visual check: no browser in this session; offered to the user via `deploy_test` (after "claim test").
@@ -0,0 +1,49 @@
# Business Logic Model — Unit 3: Portfolio page
## Flow — opening the page with a filter, changing it, opening a photo
```mermaid
sequenceDiagram
box rgba(246,224,94,0.4) Visitor
participant V as Visitor
end
box rgba(99,179,237,0.4) Page
participant R as Route
participant G as PortfolioGallery
participant B as Grid and Lightbox
end
V->>R: open /portfolio?shoot=gezin
R->>R: validateSearch keeps a ShootTypeId
R->>G: shoot, photos, shoot types
G->>G: shootFromSearch, filterOptions, filterPhotos, toGalleryItems
G->>B: two gezin photos
V->>G: choose Newborn
G->>R: onShootChange newborn
R->>R: navigate with replace, no scroll
G->>V: announce 6 foto's
V->>B: click photo 2
B->>G: onOpen 1
G->>B: lightbox at index 1 of the newborn list
```
Text alternative: the route validates ?shoot= and passes it with the content to PortfolioGallery, which derives the options, the filtered list and the gallery items with pure helpers; choosing a filter updates the URL without a history entry and announces the count; clicking a photo opens the lightbox within the filtered list.
## Pure Helpers and Properties (PBT-01)
New in `web/src/lib/` (100% coverage, example + property-based tests, generators: `shootTypeId`, `uniqueShootTypes` (existing), plus a new `portfolioPhoto` generator).
| Helper | Purpose | Properties |
|---|---|---|
| `shootTypesWithPhotos(shootTypes, photos)` | Shoot types that have at least one photo, in list order | Subset of `shootTypes` in the same order (invariant); a type is in the result iff some photo has it (oracle); adding a photo of a listed type does not change the result (invariant); idempotent when the photos are re-filtered by the result (idempotence) |
| `shootFromSearch(value, available)` | `?shoot=` → `ShootTypeId \| undefined` | Every available id round-trips, also in other letter case or with spaces (round-trip); result is always `undefined` or in `available` (invariant); non-strings → `undefined` |
| `filterPhotos(photos, shoot)` | Photos of one type, or all | Result ⊆ input, order kept (invariant); all of type `shoot` (invariant); `filterPhotos(filterPhotos(p, s), s) = filterPhotos(p, s)` (idempotence); `undefined` → identity (invariant); the union over all types = all photos (oracle) |
| `filterOptions(shootTypes, allLabel)` | "Alles" + one option per type | First is `{ id: 'alles', label: allLabel }`; length = types + 1; labels = `name` (invariant) |
| `toGalleryItems(photos, shootTypes)` | Photos → `GalleryItem`s with caption | Same length and order, ids kept (invariant); caption = `shootLabel` of the photo's type (oracle) |
| `photoCountLabel(n)` | "1 foto" / "n foto's" | Singular only for 1 (example-based; no further property) |
| `galleryImages(photos, base?)` in `seo.ts` | `ImageObject[]` | One per photo, same order (invariant); every URL starts with `https://` and the site URL (invariant); `description` = alt (oracle); serialised JSON contains no `@` e-mail pattern (invariant) |
The route's `validateSearch` uses `isShootTypeId` (a type guard derived from `shootTypes.ts`), covered through `shootFromSearch`.
## State
- **URL**: the active filter (validated).
- **PortfolioGallery**: `openIndex: number | null` via `lightboxReducer` from unit 2 (`listChanged` on filter change), the count announcement text, a `lightboxRequested` flag that starts the lazy import.
@@ -0,0 +1,57 @@
# Business Rules — Unit 3: Portfolio page
Requirements FR-PF-01..09, SEO-PF-01..05, NFR-PF-04/06; unit 2 rules BR-GR/LB/FB apply unchanged.
## Photos
- **BR-PH-01**: the 10 photos in the order of domain-entities.md; every photo has a valid `ShootTypeId`, a unique id and positive intrinsic sizes.
- **BR-PH-02**: grid image 800 px wide, large image 1600 px on the long side, same aspect ratio, compressed once by hand (no build step); stored in `web/src/assets/portfolio/`.
## Loading
- **BR-LD-01**: the page passes `eagerCount={0}` to `PortfolioGrid`: no grid photo loads before the page has (decision 2026-10-27, see requirements FR-PF-07).
## Filters
- **BR-FL-01 Options**: "Alles" (id `alles`) first, then one option per shoot type that has at least one photo, in `shootTypes.ts` order, labelled with `name`. For these photos: Alles, Newborn, Zwangerschap, Gezin.
- **BR-FL-02 Group name**: "Filter op soort shoot".
- **BR-FL-03 Filtered list**: "Alles" → all photos; a shoot type → only its photos, original relative order.
- **BR-FL-04 Announcement**: after a filter change, a polite live region says "{n} foto's" ("1 foto" for one).
- **BR-FL-05 Lightbox**: a filter change closes an open lightbox; the lightbox only browses the filtered list (C6).
## `?shoot=` parameter
- **BR-SP-01 Route validation**: `validateSearch` keeps `shoot` only when it is a `ShootTypeId` (exact, after trim + lower case); anything else (missing, unknown, non-string, array) becomes `{}`. Type: `{ shoot?: ShootTypeId }`.
- **BR-SP-02 Photos check**: the page uses the shoot only when that type has photos; otherwise it shows "Alles" (no message). `shootFromSearch(value, available)` implements both checks for the page; the value from the URL is never rendered.
- **BR-SP-03 Changing**: choosing "Alles" removes the parameter; choosing a type sets it; navigation with `replace: true` and without scrolling (Q4 of application design).
- **BR-SP-04 Canonical**: always `https://andreaslop.nl/portfolio`; the sitemap lists `/portfolio` only.
## Caption
- **BR-CP-01**: lightbox caption = the photo's shoot type `shootLabel` ("Newbornshoot", "Zwangerschapsshoot", "Gezinsshoot").
## SEO
- **BR-SEO-01**: `sitePages['/portfolio']`: `indexed: true`, title and description unchanged, `ogImage` `/og-portfolio.jpg` (1200 × 630, alt as in domain-entities.md).
- **BR-SEO-02**: `lighthouserc.cjs`: `/portfolio` moves from `noindexPaths` to `indexedPaths`. It is **not** added to `photoPagePaths` unless the measured mobile performance stays below 0.9 and the user agrees to 0.85 (open decision in aidlc-state.md).
- **BR-SEO-03**: structured data = `webPage('ImageGallery', '/portfolio', { associatedMedia: galleryImages(all 10 photos) })` through `structuredDataScript`; independent of the active filter; no e-mail; every URL absolute https.
- **BR-SEO-04**: one h1 (PageIntro "Portfolio"); grid section named by a visually hidden h2 "Foto's"; Instagram section h2 "Instagram".
## Soorten fotoshoots links (Q4 = A)
- **BR-SL-01**: on `/soorten-fotoshoots`, "Bekijk meer {photosLabel}" → `/portfolio?shoot={id}` shows only while `/portfolio` is indexed **and** only for shoot types that have portfolio photos (`shootTypesWithPhotos`). Now: newborn, zwangerschap, gezin (3 links instead of 5).
## LAYOUT.md
- **BR-LY-01**: the Portfolio diagram becomes Intro → Portfolio → Instagram (FR-PF-09).
## Decision Flow — the active filter
```mermaid
graph TD
Url["?shoot= in the URL"] --> Valid{"A ShootTypeId?"}
Valid -->|"no"| All["Alles"]
Valid -->|"yes"| Has{"Type has photos?"}
Has -->|"no"| All
Has -->|"yes"| Type["That shoot type"]
All --> Show["Show the filtered list"]
Type --> Show
classDef decision fill:#FF9800,stroke:#e65100,color:#000;
classDef state fill:#2196F3,stroke:#0d47a1,color:#000;
class Valid,Has decision;
class Url,All,Type,Show state;
```
Text alternative: a ?shoot= value that is not a known shoot type, or names a type without photos, falls back to Alles; otherwise that type is the active filter; either way the page shows the filtered list.
@@ -0,0 +1,71 @@
# Domain Entities — Unit 3: Portfolio page
Decisions: [portfolio-page-fd-questions.md](../../plans/portfolio-page-fd-questions.md) (all A).
## Relationships
```mermaid
graph TD
Content["PortfolioContent"] -->|"intro"| Intro["eyebrow, title, text"]
Content -->|"photos (10, in order)"| Photo["PortfolioPhoto"]
Photo -->|"shootType"| Shoot["ShootType (shootTypes.ts)"]
Photo -->|"thumb + full"| Images["ContentImage + ImageSource"]
Photo -->|"toGalleryItems"| Item["GalleryItem (unit 2)"]
Shoot -->|"shootLabel as caption"| Item
Shoot -->|"name as label"| Option["FilterOption (unit 2)"]
Photo -->|"galleryImages"| ImageObject["schema.org ImageObject"]
classDef entity fill:#2196F3,stroke:#0d47a1,color:#000;
classDef shared fill:#4CAF50,stroke:#2e7d32,color:#000;
classDef value fill:#e2e8f0,stroke:#4a5568,color:#000;
class Content,Photo entity;
class Shoot,Item,Option,ImageObject shared;
class Intro,Images value;
```
Text alternative: PortfolioContent holds the intro and ten PortfolioPhotos in order; each photo references a ShootType and has a grid and a large image; photos become generic GalleryItems with the shoot type's full label as caption, shoot types become FilterOptions with their short name, and photos become schema.org ImageObjects for the structured data.
## PortfolioContent (`content/portfolioContent.ts`)
| Field | Value |
|---|---|
| `intro.eyebrow` | "Werk" |
| `intro.title` | "Portfolio" |
| `intro.text` | "Een selectie uit mijn werk. Klik of tik op een foto om hem groot te bekijken." |
| `photos` | the 10 photos below, in this order |
## PortfolioPhoto
| Field | Type | Rule |
|---|---|---|
| `id` | `string` | Stable slug from the original file (e.g. `f41a1916`); unique |
| `shootType` | `ShootTypeId` | One of the ids in `shootTypes.ts` |
| `thumb` | `ContentImage` | 800 px wide, own aspect ratio, alt text below |
| `full` | `ImageSource` | 1600 px on the long side, same aspect ratio |
## The 10 photos (approved 2026-10-27)
| # | id | Shoot type | Orientation | Alt text |
|---|---|---|---|---|
| 1 | `f41a1916` | newborn | portrait | Pasgeboren baby in een wit pakje ligt op de onderarm van een ouder en kijkt in de camera |
| 2 | `f41a1922` | newborn | portrait | Vader kust zijn pasgeboren baby op het hoofd |
| 3 | `f41a7883` | zwangerschap | portrait | Aanstaande vader omarmt zijn zwangere partner op een zandvlakte in de avondzon |
| 4 | `f41a7176` | newborn | portrait | Moeder drukt haar gezicht tegen het hoofdje van haar pasgeboren baby |
| 5 | `f41a8700` | newborn | landscape | Slapende pasgeboren baby in een bruin-wit gestreept pakje |
| 6 | `f41a8206` | zwangerschap | landscape | Zwangere buik in een zwarte jurk, omarmd door twee handen |
| 7 | `f41a1579` | gezin | landscape | Grote broer kust zijn pasgeboren broertje of zusje op een wit bed |
| 8 | `f41a4650` | newborn | landscape | Babyvuistje tussen een gebreide deken en een geruite doek |
| 9 | `f41a7138` | gezin | portrait | Jonge ouders kijken samen naar hun slapende pasgeboren baby |
| 10 | `f41a7284` | newborn | portrait | Blote babyvoetjes in een gestreept gebreid broekje |
Portrait: thumb 800 × 1200, full 1067 × 1600. Landscape: thumb 800 × 533, full 1600 × 1067 (photo 8 scaled down from 2560 × 1707).
## Preview image
`web/public/og-portfolio.jpg`, 1200 × 630, cropped from photo 7; alt "Grote broer kust zijn pasgeboren broertje of zusje op een wit bed".
## ImageObject (structured data)
| Field | Value |
|---|---|
| `@type` | `ImageObject` |
| `contentUrl` | absolute https URL of `full.src` |
| `thumbnailUrl` | absolute https URL of `thumb.src` |
| `description` | the alt text |
| `width` / `height` | of the full image |
| `creator` | `{ '@id': personId }` |
| `copyrightHolder` | `{ '@id': businessId }` |
@@ -0,0 +1,42 @@
# Frontend Components — Unit 3: Portfolio page
## Hierarchy
```mermaid
graph TD
Route["routes/portfolio.tsx"] --> Intro["PageIntro (h1 Portfolio)"]
Route --> Gallery["portfolio/PortfolioGallery"]
Route --> Insta["InstagramGrid (shared)"]
Gallery --> Section["PageSection (h2 Foto's, hidden)"]
Section --> Filter["FilterBar"]
Section --> Count["live region: n foto's"]
Section --> Grid["PortfolioGrid"]
Section --> Lazy["Suspense + lazy Lightbox"]
Soorten["routes/soorten-fotoshoots.tsx"] --> List["shoots/ShootList + ShootBlock"]
classDef root fill:#4CAF50,stroke:#2e7d32,color:#000;
classDef ui fill:#2196F3,stroke:#0d47a1,color:#000;
classDef changed fill:#FF9800,stroke:#e65100,color:#000;
class Route root;
class Intro,Gallery,Insta,Section,Filter,Count,Grid,Lazy ui;
class Soorten,List changed;
```
Text alternative: the portfolio route renders PageIntro, the new PortfolioGallery and the shared InstagramGrid; the gallery renders a PageSection with a hidden h2, the FilterBar, a count live region, the PortfolioGrid and the lazily loaded Lightbox; the Soorten fotoshoots route and its ShootList/ShootBlock change to link only shoot types with photos.
## Route `routes/portfolio.tsx`
- `validateSearch: (search) => ({ shoot?: ShootTypeId })` via `isShootTypeId`
- `head`: `pageHead('/portfolio')` + `structuredDataScript(webPage('ImageGallery', '/portfolio', { associatedMedia: galleryImages(portfolioContent.photos) }))`
- component: `PageIntro eyebrow title` with intro text → `PortfolioGallery` → `InstagramGrid` (only with a valid Instagram link, as on the homepage)
- `onShootChange(shoot)` → `navigate({ search: shoot ? { shoot } : {}, replace: true, resetScroll: false })`
## PortfolioGallery (`components/portfolio/PortfolioGallery/`)
- **Props**: `photos`, `shootTypes`, `shoot: string | undefined` (raw from the route), `onShootChange(shoot: ShootTypeId | undefined)`
- **Derived**: available types, active shoot (`shootFromSearch`), options, filtered photos, gallery items
- **State**: `lightbox` (`lightboxReducer`), `announcement`, `lightboxRequested`
- **Markup**: `PageSection labelledBy="portfolio-title" spacing="flushTop"` with `VisuallyHidden as h2 id="portfolio-title"` "Foto's"; `FilterBar label="Filter op soort shoot"` (value `alles` when no shoot); `chakra.p srOnly aria-live="polite"` (`data-testid="portfolio-count"`); `PortfolioGrid` (`onOpen` → open, `onIntent` → request lightbox); `Suspense fallback={null}` → lazy `Lightbox` rendered once requested, with `finalFocusEl` returning the tile of the last shown item (`[data-testid="portfolio-tile-{n}"]`)
- **Test ids**: `portfolio-gallery`, plus those of the unit 2 blocks
## Soorten fotoshoots (changed)
- `ShootList` / `ShootBlock`: prop `portfolioLive: boolean` → `portfolioShoots: readonly ShootTypeId[]` (types that get a link); the block shows the link when its id is in the list
- `routes/soorten-fotoshoots.tsx`: `portfolioShoots = isPortfolioLive(sitePages) ? shootTypesWithPhotos(shootTypes, portfolioContent.photos).map(t => t.id) : []`
- `app.test.tsx`: expects 3 links (newborn, zwangerschap, gezin) when `/portfolio` is indexed
@@ -77,7 +77,7 @@ Shell header → **Intro** (page head, h1) → **Portfolio** (filter bar + mason
- Opening and switching respect `prefers-reduced-motion` (no fade/slide).
### FR-PF-07 Image loading
- **Grid**: the first 3 photos in order (one per column on desktop) load immediately with high priority; the others use the existing `DeferredImage` (after the load event, near the viewport). All grid images carry intrinsic width/height (no layout shift). *Source: Q7 = A, clarification 2 = A*
- **Grid**: all photos use the existing `DeferredImage` (after the load event, near the viewport); none load eagerly. All grid images carry intrinsic width/height (no layout shift). *Source: Q7 = A, clarification 2 = A; changed at Code Generation unit 3 (2026-10-27): the grid fades in (`Reveal`), so its photos are never the largest paint, and the 3 eager photos only delayed the fonts and the intro text — mobile Lighthouse 0.80 with, 0.91 without*
- **Lightbox**: the large image loads only when the lightbox opens; the next and previous large images (within the active set) are preloaded while it is open. While a large image loads, the grid image (already cached) or a neutral placeholder is shown — no empty flash, no layout jump. *Source: Q6 = A*
### FR-PF-08 Instagram block, shared
+8 -2
View File
@@ -6,8 +6,14 @@
const origin = 'http://localhost:4173';
// Moet gelijk lopen met src/sitePages.ts (een test bewaakt dat)
const indexedPaths = ['/', '/over-mij', '/soorten-fotoshoots', '/contact'];
const noindexPaths = ['/portfolio', '/privacyverklaring'];
const indexedPaths = [
'/',
'/over-mij',
'/portfolio',
'/soorten-fotoshoots',
'/contact',
];
const noindexPaths = ['/privacyverklaring'];
const notFoundPath = '/bestaat-niet';
// Homepage mobiel voorlopig 0,8: de foto's zijn nog niet responsive en de
Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

+86 -7
View File
@@ -101,12 +101,17 @@ describe('app', () => {
);
it('zet titel en noindex van een placeholder in de head', async () => {
await renderApp('/portfolio');
await screen.findByRole('heading', { level: 1, name: 'Portfolio' });
expect(document.title).toBe('Portfolio | Andrea Slop Fotografie');
await renderApp('/privacyverklaring');
await screen.findByRole('heading', {
level: 1,
name: 'Privacyverklaring',
});
expect(document.title).toBe(
'Privacyverklaring | Andrea Slop Fotografie',
);
expect(
document.head.querySelector('link[rel="canonical"]'),
).toHaveAttribute('href', 'https://andreaslop.nl/portfolio');
).toHaveAttribute('href', 'https://andreaslop.nl/privacyverklaring');
expect(
document.head.querySelector('meta[name="robots"]'),
).toHaveAttribute('content', 'noindex');
@@ -265,7 +270,7 @@ describe('app', () => {
'/contact',
]);
// Links to the filtered portfolio only once that page is live
// (indexed); they switch on by themselves when it is
// (indexed), and only for shoot types with portfolio photos
expect(
within(main)
.queryAllByRole('link', { name: /^Bekijk meer/ })
@@ -276,8 +281,6 @@ describe('app', () => {
'/portfolio?shoot=newborn',
'/portfolio?shoot=zwangerschap',
'/portfolio?shoot=gezin',
'/portfolio?shoot=loveshoot',
'/portfolio?shoot=portret',
]
: [],
);
@@ -304,6 +307,82 @@ describe('app', () => {
expect(await axeResults(container)).toHaveNoViolations();
});
it('shows the portfolio with its outline, filters, photos and structured data', async () => {
const { container } = await renderApp('/portfolio');
await screen.findByRole('heading', { level: 1, name: 'Portfolio' });
expectShell();
const main = screen.getByRole('main');
expect(
within(main)
.getAllByRole('heading', { level: 2 })
.map((heading) => heading.textContent),
).toEqual(["Foto's", 'Instagram']);
expect(
within(main).getByRole('button', { name: 'Alles', pressed: true }),
).toBeInTheDocument();
expect(
within(screen.getByTestId('portfolio-grid')).getAllByRole('link'),
).toHaveLength(10);
expect(document.title).toBe('Portfolio | Andrea Slop Fotografie');
expect(document.head.querySelector('meta[name="robots"]')).toBeNull();
expect(
document.head.querySelector('link[rel="canonical"]'),
).toHaveAttribute('href', 'https://andreaslop.nl/portfolio');
expect(
document.head.querySelector('meta[property="og:image"]'),
).toHaveAttribute('content', 'https://andreaslop.nl/og-portfolio.jpg');
const data = [
...document.querySelectorAll('script[type="application/ld+json"]'),
].map((script) => JSON.parse(script.textContent!));
const gallery = data.find((item) => item['@type'] === 'ImageGallery');
expect(gallery.associatedMedia).toHaveLength(10);
expect(await axeResults(container)).toHaveNoViolations();
});
it('starts the portfolio filtered on ?shoot= and keeps the canonical URL plain', async () => {
await renderApp('/portfolio?shoot=gezin');
await screen.findByRole('heading', { level: 1, name: 'Portfolio' });
expect(
screen.getByRole('button', { name: 'Gezin', pressed: true }),
).toBeInTheDocument();
expect(
within(screen.getByTestId('portfolio-grid')).getAllByRole('link'),
).toHaveLength(2);
expect(
document.head.querySelector('link[rel="canonical"]'),
).toHaveAttribute('href', 'https://andreaslop.nl/portfolio');
});
it.each(['onzin', 'loveshoot', '%3Cscript%3E'])(
'shows the whole portfolio for ?shoot=%s',
async (value) => {
await renderApp(`/portfolio?shoot=${value}`);
await screen.findByRole('heading', { level: 1, name: 'Portfolio' });
expect(
screen.getByRole('button', { name: 'Alles', pressed: true }),
).toBeInTheDocument();
expect(
within(screen.getByTestId('portfolio-grid')).getAllByRole(
'link',
),
).toHaveLength(10);
},
);
it('puts the chosen filter in the URL without a history entry', async () => {
const { router } = await renderApp('/portfolio');
await screen.findByRole('heading', { level: 1, name: 'Portfolio' });
const user = userEvent.setup();
await user.click(screen.getByRole('button', { name: 'Newborn' }));
await waitFor(() =>
expect(router.state.location.search).toEqual({ shoot: 'newborn' }),
);
expect(router.history.length).toBe(1);
await user.click(screen.getByRole('button', { name: 'Alles' }));
await waitFor(() => expect(router.state.location.search).toEqual({}));
});
it('toont een onbekende URL als 404 binnen de shell', async () => {
const { container } = await renderApp('/bestaat-niet');
expect(
Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 292 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 259 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 191 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

+8 -2
View File
@@ -29,8 +29,14 @@ export default function FilterBar({
aria-label={label}
data-testid="filter-bar"
display="flex"
flexWrap="wrap"
justifyContent="center"
// One row, always: when the web font replaces the fallback, a
// wrapping row could gain or lose a line and push the photos
// below it down (layout shift). Too narrow: the row scrolls.
flexWrap="nowrap"
overflowX="auto"
// Centred while it fits; from the start when it scrolls, so the
// first choice is never cut off
justifyContent="safe center"
columnGap={{ base: 4, md: 6 }}
>
{options.map((option) => {
@@ -0,0 +1,145 @@
import { useEffect, useState } from 'react';
import { act, screen, waitFor, within } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { describe, expect, it, vi } from 'vitest';
import portfolioContent from '@/content/portfolioContent';
import shootTypes from '@/content/shootTypes';
import type { ShootTypeId } from '@/content/types';
import { axeResults } from '@/test/axe';
import { renderWithProviders } from '@/test/renderWithProviders';
import PortfolioGallery from './PortfolioGallery';
const photos = portfolioContent.photos;
// Lets a test change the shoot from outside, as the route would
let setShootFromOutside: (shoot: string | undefined) => void = () => {};
// The route's part: it keeps the chosen shoot (in the URL)
function Harness({
start,
onShootChange = () => {},
}: {
start?: string;
onShootChange?: (shoot: ShootTypeId | undefined) => void;
}) {
const [shoot, setShoot] = useState<string | undefined>(start);
useEffect(() => {
setShootFromOutside = setShoot;
}, []);
return (
<PortfolioGallery
photos={photos}
shootTypes={shootTypes}
shoot={shoot}
onShootChange={(next) => {
setShoot(next);
onShootChange(next);
}}
/>
);
}
// By test id: while the closed dialog fades out (in jsdom it never
// finishes), the page behind it is still hidden from the accessibility tree
const tiles = () =>
screen
.getByTestId('portfolio-grid')
.querySelectorAll('[data-testid^="portfolio-tile-"]');
describe('PortfolioGallery', () => {
it('is a section named by a hidden heading, with filters for the types that have photos', async () => {
const { container } = await renderWithProviders(<Harness />);
expect(
screen.getByRole('region', { name: "Foto's" }),
).toBeInTheDocument();
const group = screen.getByRole('group', {
name: 'Filter op soort shoot',
});
expect(
within(group)
.getAllByRole('button')
.map((b) => b.textContent),
).toEqual(['Alles', 'Newborn', 'Zwangerschap', 'Gezin']);
expect(
screen.getByRole('button', { name: 'Alles', pressed: true }),
).toBeInTheDocument();
expect(tiles()).toHaveLength(10);
// Every photo waits until the page has loaded (none eager)
for (const image of screen.getAllByRole('img')) {
expect(image).not.toHaveAttribute('fetchpriority');
expect(image).toHaveAttribute('loading', 'lazy');
}
expect(await axeResults(container)).toHaveNoViolations();
});
it('filters on a shoot type, announces the count and reports the choice', async () => {
const onShootChange = vi.fn();
await renderWithProviders(<Harness onShootChange={onShootChange} />);
const user = userEvent.setup();
await user.click(screen.getByRole('button', { name: 'Gezin' }));
expect(onShootChange).toHaveBeenLastCalledWith('gezin');
expect(tiles()).toHaveLength(2);
expect(screen.getByTestId('portfolio-count')).toHaveTextContent(
"2 foto's",
);
await user.click(screen.getByRole('button', { name: 'Alles' }));
expect(onShootChange).toHaveBeenLastCalledWith(undefined);
expect(tiles()).toHaveLength(10);
});
it('starts with the shoot from the URL', async () => {
await renderWithProviders(<Harness start="zwangerschap" />);
expect(
screen.getByRole('button', { name: 'Zwangerschap', pressed: true }),
).toBeInTheDocument();
expect(tiles()).toHaveLength(2);
});
it.each(['loveshoot', 'onzin', '<script>'])(
'shows everything for ?shoot=%s',
async (value) => {
await renderWithProviders(<Harness start={value} />);
expect(
screen.getByRole('button', { name: 'Alles', pressed: true }),
).toBeInTheDocument();
expect(tiles()).toHaveLength(10);
expect(document.body).not.toHaveTextContent(value);
},
);
it('opens the lightbox within the filtered photos, captioned with the shoot type', async () => {
await renderWithProviders(<Harness start="gezin" />);
const user = userEvent.setup();
await user.click(screen.getByTestId('portfolio-tile-2'));
const counter = await screen.findByTestId('lightbox-counter');
expect(counter).toHaveTextContent('2 / 2');
expect(screen.getByTestId('lightbox-caption')).toHaveTextContent(
'Gezinsshoot',
);
expect(screen.getByTestId('lightbox-image')).toHaveAttribute(
'src',
photos.find((p) => p.id === 'f41a7138')?.full.src,
);
});
it('closes the lightbox when the filter changes', async () => {
await renderWithProviders(<Harness />);
const user = userEvent.setup();
await user.click(screen.getByTestId('portfolio-tile-1'));
expect(await screen.findByTestId('lightbox')).toHaveAttribute(
'data-state',
'open',
);
// The dialog makes the page inert, so the filter changes from
// outside, as through the URL
act(() => setShootFromOutside('newborn'));
expect(tiles()).toHaveLength(6);
// A close from the parent reaches the dialog in an effect
await waitFor(() =>
expect(screen.getByTestId('lightbox')).toHaveAttribute(
'data-state',
'closed',
),
);
});
});
@@ -0,0 +1,136 @@
import { lazy, Suspense, useReducer, useRef, useState } from 'react';
import { Box, chakra, Heading, VisuallyHidden } from '@chakra-ui/react';
import FilterBar from '@/components/FilterBar/FilterBar';
import PageSection from '@/components/PageSection/PageSection';
import PortfolioGrid from '@/components/PortfolioGrid/PortfolioGrid';
import type { PortfolioPhoto, ShootType, ShootTypeId } from '@/content/types';
import { closedLightbox, lightboxReducer } from '@/lib/lightboxReducer';
import {
ALL_FILTER,
filterOptions,
filterPhotos,
photoCountLabel,
shootFromSearch,
shootTypesWithPhotos,
toGalleryItems,
} from '@/lib/portfolioFilters';
// Loaded on the first hover, focus or click on a photo (application design Q7)
const Lightbox = lazy(() => import('@/components/Lightbox/Lightbox'));
const TITLE_ID = 'portfolio-title';
type PortfolioGalleryProps = {
photos: readonly PortfolioPhoto[];
shootTypes: readonly ShootType[];
// The shoot from ?shoot=; checked here against the types with photos
shoot: string | undefined;
onShootChange: (shoot: ShootTypeId | undefined) => void;
};
// The portfolio's photos: filters per shoot type, the masonry grid and the
// lightbox, connected. The URL holds the chosen filter (via the route); this
// component holds which photo is open.
export default function PortfolioGallery({
photos,
shootTypes,
shoot,
onShootChange,
}: PortfolioGalleryProps) {
const available = shootTypesWithPhotos(shootTypes, photos);
const active = shootFromSearch(
shoot,
available.map((type) => type.id),
);
const shown = filterPhotos(photos, active);
const items = toGalleryItems(shown, shootTypes);
const [lightbox, dispatch] = useReducer(lightboxReducer, closedLightbox);
const [lightboxRequested, setLightboxRequested] = useState(false);
const [announcement, setAnnouncement] = useState('');
const grid = useRef<HTMLDivElement>(null);
// Another list, however the filter changed: the open photo may no longer
// be in it, so the lightbox closes (BR-FL-05). Adjusted during render,
// as React advises for state that follows a prop.
const [listFor, setListFor] = useState(active);
if (listFor !== active) {
setListFor(active);
dispatch({ type: 'listChanged', count: items.length });
}
const chooseFilter = (id: string) => {
const next = id === ALL_FILTER ? undefined : (id as ShootTypeId);
setAnnouncement(photoCountLabel(filterPhotos(photos, next).length));
onShootChange(next);
};
const open = (index: number) => {
setLightboxRequested(true);
dispatch({ type: 'open', index, count: items.length });
};
// Back to the tile of the photo shown last (BR-LB-08)
const tileOfShownPhoto = () =>
lightbox.open
? (grid.current?.querySelector<HTMLElement>(
`[data-testid="portfolio-tile-${lightbox.index + 1}"]`,
) ?? null)
: null;
return (
<PageSection
labelledBy={TITLE_ID}
spacing="flushTop"
data-testid="portfolio-gallery"
>
{/* The design shows no heading here; one for screen readers
names the section */}
<VisuallyHidden>
<Heading as="h2" id={TITLE_ID}>
Foto's
</Heading>
</VisuallyHidden>
<Box mb={{ base: 6, md: 10 }}>
<FilterBar
options={filterOptions(available, 'Alles')}
value={active ?? ALL_FILTER}
onChange={chooseFilter}
label="Filter op soort shoot"
/>
</Box>
<chakra.p srOnly aria-live="polite" data-testid="portfolio-count">
{announcement}
</chakra.p>
<Box ref={grid}>
<PortfolioGrid
items={items}
// No photo loads before the page has: the grid fades in, so
// its photos are never the largest paint, and loading them
// early only slowed the fonts and the intro text (measured
// 0.80 vs 0.91 on mobile; decision 2026-10-27)
eagerCount={0}
onOpen={open}
onIntent={() => setLightboxRequested(true)}
/>
</Box>
{lightboxRequested && (
<Suspense fallback={null}>
<Lightbox
items={items}
index={lightbox.open ? lightbox.index : null}
onIndexChange={(index) =>
dispatch({
type: 'open',
index,
count: items.length,
})
}
onClose={() => dispatch({ type: 'close' })}
finalFocusEl={tileOfShownPhoto}
/>
</Suspense>
)}
</PageSection>
);
}
@@ -10,7 +10,7 @@ const shoot = (id: string) => shootTypes.find((item) => item.id === id)!;
const renderBlock = (
id: string,
{ portfolioLive = false, reverse = false, priority = false } = {},
{ portfolioLink = false, reverse = false, priority = false } = {},
) =>
renderWithProviders(
<ShootBlock
@@ -18,7 +18,7 @@ const renderBlock = (
packages={packages}
reverse={reverse}
priority={priority}
portfolioLive={portfolioLive}
portfolioLink={portfolioLink}
/>,
);
@@ -67,7 +67,7 @@ describe('ShootBlock', () => {
});
it('links to the portfolio filtered on the shoot type when live', async () => {
await renderBlock('portret', { portfolioLive: true });
await renderBlock('portret', { portfolioLink: true });
expect(
screen.getByRole('link', { name: "Bekijk meer portretfoto's" }),
).toHaveAttribute('href', '/portfolio?shoot=portret');
@@ -13,8 +13,8 @@ type ShootBlockProps = {
reverse: boolean;
// The first photo on the page loads straight away
priority: boolean;
// Show "Bekijk meer …foto's" (BR-SF-04)
portfolioLive: boolean;
// Show "Bekijk meer …foto's" (BR-SF-04, BR-SL-01)
portfolioLink: boolean;
};
// Links in the text column: room around them for a 44px touch target
@@ -28,7 +28,7 @@ export default function ShootBlock({
packages,
reverse,
priority,
portfolioLive,
portfolioLink,
}: ShootBlockProps) {
const titleId = `shoot-${shoot.id}-title`;
@@ -74,7 +74,7 @@ export default function ShootBlock({
Stuur een berichtje
</RouterLink>
</Link>
{portfolioLive && (
{portfolioLink && (
<Link variant="underline" asChild {...linkStyle}>
<RouterLink
{...shootPortfolioLink(shoot)}
@@ -12,7 +12,7 @@ const renderList = () =>
<ShootList
shoots={shootTypes}
packages={packages}
portfolioLive={false}
portfolioShoots={[]}
/>,
);
@@ -1,12 +1,14 @@
import { Box } from '@chakra-ui/react';
import PageSection from '@/components/PageSection/PageSection';
import type { PricingPackage, ShootType } from '@/content/types';
import type { PricingPackage, ShootType, ShootTypeId } from '@/content/types';
import ShootBlock from '../ShootBlock/ShootBlock';
type ShootListProps = {
shoots: readonly ShootType[];
packages: readonly PricingPackage[];
portfolioLive: boolean;
// Shoot types that link to the portfolio: only while it is live, and
// only for types with portfolio photos (BR-SL-01)
portfolioShoots: readonly ShootTypeId[];
};
// The shoot types below the page head, each in its own full-width band:
@@ -16,7 +18,7 @@ type ShootListProps = {
export default function ShootList({
shoots,
packages,
portfolioLive,
portfolioShoots,
}: ShootListProps) {
return (
<Box data-testid="shoot-list">
@@ -32,7 +34,7 @@ export default function ShootList({
packages={packages}
reverse={index % 2 === 1}
priority={index === 0}
portfolioLive={portfolioLive}
portfolioLink={portfolioShoots.includes(shoot.id)}
/>
</PageSection>
))}
+136
View File
@@ -0,0 +1,136 @@
import type { PortfolioContent, PortfolioPhoto, ShootTypeId } from './types';
// Images: the live portfolio photos, 800 px wide for the grid and 1600 px
// on the long side for the lightbox, never cropped
import f41a1916 from '../assets/portfolio/f41a1916.jpg';
import f41a1916Groot from '../assets/portfolio/f41a1916-groot.jpg';
import f41a1922 from '../assets/portfolio/f41a1922.jpg';
import f41a1922Groot from '../assets/portfolio/f41a1922-groot.jpg';
import f41a7883 from '../assets/portfolio/f41a7883.jpg';
import f41a7883Groot from '../assets/portfolio/f41a7883-groot.jpg';
import f41a7176 from '../assets/portfolio/f41a7176.jpg';
import f41a7176Groot from '../assets/portfolio/f41a7176-groot.jpg';
import f41a8700 from '../assets/portfolio/f41a8700.jpg';
import f41a8700Groot from '../assets/portfolio/f41a8700-groot.jpg';
import f41a8206 from '../assets/portfolio/f41a8206.jpg';
import f41a8206Groot from '../assets/portfolio/f41a8206-groot.jpg';
import f41a1579 from '../assets/portfolio/f41a1579.jpg';
import f41a1579Groot from '../assets/portfolio/f41a1579-groot.jpg';
import f41a4650 from '../assets/portfolio/f41a4650.jpg';
import f41a4650Groot from '../assets/portfolio/f41a4650-groot.jpg';
import f41a7138 from '../assets/portfolio/f41a7138.jpg';
import f41a7138Groot from '../assets/portfolio/f41a7138-groot.jpg';
import f41a7284 from '../assets/portfolio/f41a7284.jpg';
import f41a7284Groot from '../assets/portfolio/f41a7284-groot.jpg';
const portrait = {
thumb: { width: 800, height: 1200 },
full: { width: 1067, height: 1600 },
};
const landscape = {
thumb: { width: 800, height: 534 },
full: { width: 1600, height: 1067 },
};
function photo(
id: string,
shootType: ShootTypeId,
files: { thumb: string; full: string },
size: typeof portrait,
alt: string,
): PortfolioPhoto {
return {
id,
shootType,
thumb: { src: files.thumb, alt, ...size.thumb },
full: { src: files.full, ...size.full },
};
}
// The portfolio until the CMS API exists: the photos of the live site in
// their order (2026-10-24), with the shoot type and description approved
// in the functional design (Andrea may still reword the descriptions)
const portfolioContent: PortfolioContent = {
intro: {
eyebrow: 'Werk',
title: 'Portfolio',
text: 'Een selectie uit mijn werk. Klik of tik op een foto om hem groot te bekijken.',
},
photos: [
photo(
'f41a1916',
'newborn',
{ thumb: f41a1916, full: f41a1916Groot },
portrait,
'Pasgeboren baby in een wit pakje ligt op de onderarm van een ouder en kijkt in de camera',
),
photo(
'f41a1922',
'newborn',
{ thumb: f41a1922, full: f41a1922Groot },
portrait,
'Vader kust zijn pasgeboren baby op het hoofd',
),
photo(
'f41a7883',
'zwangerschap',
{ thumb: f41a7883, full: f41a7883Groot },
portrait,
'Aanstaande vader omarmt zijn zwangere partner op een zandvlakte in de avondzon',
),
photo(
'f41a7176',
'newborn',
{ thumb: f41a7176, full: f41a7176Groot },
portrait,
'Moeder drukt haar gezicht tegen het hoofdje van haar pasgeboren baby',
),
photo(
'f41a8700',
'newborn',
{ thumb: f41a8700, full: f41a8700Groot },
landscape,
'Slapende pasgeboren baby in een bruin-wit gestreept pakje',
),
photo(
'f41a8206',
'zwangerschap',
{ thumb: f41a8206, full: f41a8206Groot },
landscape,
'Zwangere buik in een zwarte jurk, omarmd door twee handen',
),
photo(
'f41a1579',
'gezin',
{ thumb: f41a1579, full: f41a1579Groot },
landscape,
'Grote broer kust zijn pasgeboren broertje of zusje op een wit bed',
),
photo(
'f41a4650',
'newborn',
{ thumb: f41a4650, full: f41a4650Groot },
{
thumb: { width: 800, height: 533 },
full: { width: 1600, height: 1067 },
},
'Babyvuistje tussen een gebreide deken en een geruite doek',
),
photo(
'f41a7138',
'gezin',
{ thumb: f41a7138, full: f41a7138Groot },
portrait,
'Jonge ouders kijken samen naar hun slapende pasgeboren baby',
),
photo(
'f41a7284',
'newborn',
{ thumb: f41a7284, full: f41a7284Groot },
portrait,
'Blote babyvoetjes in een gestreept gebreid broekje',
),
],
};
export default portfolioContent;
+15
View File
@@ -72,6 +72,21 @@ export interface FilterOption {
label: string;
}
// One photo of the portfolio: which kind of shoot it is from (filters and
// lightbox caption) and the photo in two sizes, grid and lightbox
export interface PortfolioPhoto {
id: string;
shootType: ShootTypeId;
thumb: ContentImage;
full: ImageSource;
}
// The portfolio page until the CMS API exists (/api/portfolio)
export interface PortfolioContent {
intro: { eyebrow: string; title: string; text: string };
photos: PortfolioPhoto[];
}
// A priced shoot offer. id is a stable slug: it goes into ?pakket= and is
// the shoot value the contact form sends.
export interface PricingPackage {
+216
View File
@@ -0,0 +1,216 @@
import fc from 'fast-check';
import { describe, expect, it } from 'vitest';
import portfolioContent from '../content/portfolioContent';
import shootTypes from '../content/shootTypes';
import type { ShootTypeId } from '../content/types';
import {
portfolioPhotos,
shootTypeId,
uniqueShootTypes,
} from '../test/arbitraries';
import {
ALL_FILTER,
filterOptions,
filterPhotos,
isShootTypeId,
photoCountLabel,
shootFromSearch,
shootTypesWithPhotos,
toGalleryItems,
} from './portfolioFilters';
const photos = portfolioContent.photos;
const allIds = shootTypes.map((type) => type.id);
describe('isShootTypeId', () => {
it('accepts known ids only, exactly as written', () => {
expect(isShootTypeId('gezin', allIds)).toBe(true);
expect(isShootTypeId('Gezin', allIds)).toBe(false);
expect(isShootTypeId('onzin', allIds)).toBe(false);
expect(isShootTypeId(3, allIds)).toBe(false);
expect(isShootTypeId(['gezin'], allIds)).toBe(false);
});
});
describe('shootTypesWithPhotos', () => {
it('lists newborn, zwangerschap and gezin for the live photos', () => {
expect(
shootTypesWithPhotos(shootTypes, photos).map((t) => t.id),
).toEqual(['newborn', 'zwangerschap', 'gezin']);
});
it('keeps exactly the types with a photo, in list order (oracle)', () => {
fc.assert(
fc.property(uniqueShootTypes, portfolioPhotos, (types, list) => {
const result = shootTypesWithPhotos(types, list);
const expected = types.filter((type) =>
list.map((p) => p.shootType).includes(type.id),
);
expect(result).toEqual(expected);
}),
);
});
it('does not change when the photos are narrowed to those types (idempotence)', () => {
fc.assert(
fc.property(uniqueShootTypes, portfolioPhotos, (types, list) => {
const once = shootTypesWithPhotos(types, list);
const ids = once.map((type) => type.id);
const narrowed = list.filter((p) => ids.includes(p.shootType));
expect(shootTypesWithPhotos(once, narrowed)).toEqual(once);
}),
);
});
});
describe('shootFromSearch', () => {
const available: ShootTypeId[] = ['newborn', 'zwangerschap', 'gezin'];
it('accepts an available id in any letter case', () => {
expect(shootFromSearch('gezin', available)).toBe('gezin');
expect(shootFromSearch(' Newborn ', available)).toBe('newborn');
});
it('ignores unknown ids, types without photos and non-strings', () => {
expect(shootFromSearch('loveshoot', available)).toBeUndefined();
expect(shootFromSearch('<script>', available)).toBeUndefined();
expect(shootFromSearch(undefined, available)).toBeUndefined();
expect(shootFromSearch(['gezin'], available)).toBeUndefined();
expect(shootFromSearch('', available)).toBeUndefined();
});
it('returns every available id for its own value (round-trip)', () => {
fc.assert(
fc.property(
fc.uniqueArray(shootTypeId, { minLength: 1 }),
fc.constantFrom('', ' ', ' '),
fc.boolean(),
(ids, pad, upper) => {
for (const id of ids) {
const typed = upper ? id.toUpperCase() : id;
expect(shootFromSearch(pad + typed + pad, ids)).toBe(
id,
);
}
},
),
);
});
it('only ever returns an available id (invariant)', () => {
fc.assert(
fc.property(
fc.anything(),
fc.uniqueArray(shootTypeId),
(value, ids) => {
const result = shootFromSearch(value, ids);
expect(result === undefined || ids.includes(result)).toBe(
true,
);
},
),
);
});
});
describe('filterPhotos', () => {
it('shows all photos without a shoot, or one type in its own order', () => {
expect(filterPhotos(photos, undefined)).toEqual(photos);
expect(filterPhotos(photos, 'gezin').map((p) => p.id)).toEqual([
'f41a1579',
'f41a7138',
]);
expect(filterPhotos(photos, 'loveshoot')).toEqual([]);
});
it('keeps only that type, in the original order (invariant)', () => {
fc.assert(
fc.property(portfolioPhotos, shootTypeId, (list, shoot) => {
const result = filterPhotos(list, shoot);
expect(result.every((p) => p.shootType === shoot)).toBe(true);
const positions = result.map((p) => list.indexOf(p));
expect(positions).toEqual([...positions].sort((a, b) => a - b));
}),
);
});
it('changes nothing when filtered twice (idempotence)', () => {
fc.assert(
fc.property(portfolioPhotos, shootTypeId, (list, shoot) => {
const once = filterPhotos(list, shoot);
expect(filterPhotos(once, shoot)).toEqual(once);
}),
);
});
it('splits all photos over the types without losing any (oracle)', () => {
fc.assert(
fc.property(portfolioPhotos, (list) => {
const total = allIds.reduce(
(sum, id) => sum + filterPhotos(list, id).length,
0,
);
expect(total).toBe(list.length);
}),
);
});
});
describe('filterOptions', () => {
it('starts with Alles and labels each type with its short name', () => {
const types = shootTypesWithPhotos(shootTypes, photos);
expect(filterOptions(types, 'Alles')).toEqual([
{ id: ALL_FILTER, label: 'Alles' },
{ id: 'newborn', label: 'Newborn' },
{ id: 'zwangerschap', label: 'Zwangerschap' },
{ id: 'gezin', label: 'Gezin' },
]);
});
it('has one option per type after Alles (invariant)', () => {
fc.assert(
fc.property(uniqueShootTypes, (types) => {
const options = filterOptions(types, 'Alles');
expect(options).toHaveLength(types.length + 1);
expect(options[0].id).toBe(ALL_FILTER);
expect(options.slice(1).map((o) => o.label)).toEqual(
types.map((t) => t.name),
);
}),
);
});
});
describe('toGalleryItems', () => {
it('captions each photo with the full name of its shoot type', () => {
const items = toGalleryItems(photos, shootTypes);
expect(items[0].caption).toBe('Newbornshoot');
expect(items[2].caption).toBe('Zwangerschapsshoot');
expect(items[6].caption).toBe('Gezinsshoot');
expect(items[0].thumb).toBe(photos[0].thumb);
});
it('keeps order, ids and images, and takes the caption from the type (oracle)', () => {
fc.assert(
fc.property(portfolioPhotos, uniqueShootTypes, (list, types) => {
const items = toGalleryItems(list, types);
expect(items.map((i) => i.id)).toEqual(list.map((p) => p.id));
items.forEach((item, i) => {
expect(item.full).toBe(list[i].full);
expect(item.caption).toBe(
types.find((t) => t.id === list[i].shootType)
?.shootLabel,
);
});
}),
);
});
});
describe('photoCountLabel', () => {
it('uses the singular only for one photo', () => {
expect(photoCountLabel(1)).toBe('1 foto');
expect(photoCountLabel(0)).toBe("0 foto's");
expect(photoCountLabel(6)).toBe("6 foto's");
});
});
+86
View File
@@ -0,0 +1,86 @@
import type {
FilterOption,
GalleryItem,
PortfolioPhoto,
ShootType,
ShootTypeId,
} from '../content/types.ts';
// The filter that shows every photo; it has no ?shoot= value
export const ALL_FILTER = 'alles';
// Whether a value is one of the given shoot type ids (exactly as written)
export function isShootTypeId(
value: unknown,
known: readonly ShootTypeId[],
): value is ShootTypeId {
return (
typeof value === 'string' &&
(known as readonly string[]).includes(value)
);
}
// The shoot types that have at least one photo, in the order of the list
// (BR-FL-01). Only these get a filter, and a link from Soorten fotoshoots.
export function shootTypesWithPhotos(
shootTypes: readonly ShootType[],
photos: readonly PortfolioPhoto[],
): ShootType[] {
return shootTypes.filter((type) =>
photos.some((photo) => photo.shootType === type.id),
);
}
// The shoot type from ?shoot=, if it is one of `available` (BR-SP-02).
// Letter case and surrounding spaces do not matter; anything else
// (unknown id, a type without photos, number, missing) gives undefined, so
// the page shows "Alles" and the URL's value is never shown.
export function shootFromSearch(
value: unknown,
available: readonly ShootTypeId[],
): ShootTypeId | undefined {
if (typeof value !== 'string') return undefined;
const wanted = value.trim().toLowerCase();
return available.find((id) => id === wanted);
}
// The photos of one shoot type in their own order, or all of them
export function filterPhotos(
photos: readonly PortfolioPhoto[],
shoot: ShootTypeId | undefined,
): PortfolioPhoto[] {
return shoot === undefined
? [...photos]
: photos.filter((photo) => photo.shootType === shoot);
}
// "Alles" first, then one choice per shoot type, labelled with its short name
export function filterOptions(
shootTypes: readonly ShootType[],
allLabel: string,
): FilterOption[] {
return [
{ id: ALL_FILTER, label: allLabel },
...shootTypes.map((type) => ({ id: type.id, label: type.name })),
];
}
// Portfolio photos as items for the shared gallery blocks; the caption is
// the full name of the shoot type ("Newbornshoot", BR-CP-01)
export function toGalleryItems(
photos: readonly PortfolioPhoto[],
shootTypes: readonly ShootType[],
): GalleryItem[] {
return photos.map((photo) => ({
id: photo.id,
thumb: photo.thumb,
full: photo.full,
caption: shootTypes.find((type) => type.id === photo.shootType)
?.shootLabel,
}));
}
// "1 foto" or "6 foto's", for the announcement after a filter change
export function photoCountLabel(count: number): string {
return count === 1 ? '1 foto' : `${count} foto's`;
}
+3
View File
@@ -8,6 +8,9 @@ const filterControlRecipe = defineRecipe({
className: 'filter-control',
base: {
display: 'inline-flex',
// Labels never break or shrink inside the single filter row
flexShrink: 0,
whiteSpace: 'nowrap',
alignItems: 'center',
// 44px touch target (BR-RWD-04)
minH: '44px',
+70 -7
View File
@@ -1,17 +1,80 @@
import { createFileRoute } from '@tanstack/react-router';
import { createFileRoute, useNavigate } from '@tanstack/react-router';
import InstagramGrid from '../components/InstagramGrid/InstagramGrid';
import PageIntro from '../components/PageIntro/PageIntro';
import { pageHead } from '../seo';
import PortfolioGallery from '../components/portfolio/PortfolioGallery/PortfolioGallery';
import instagramContent from '../content/instagramContent';
import portfolioContent from '../content/portfolioContent';
import shootTypes from '../content/shootTypes';
import siteContent from '../content/siteContent';
import type { ShootTypeId } from '../content/types';
import { isShootTypeId } from '../lib/portfolioFilters';
import { visibleSocials } from '../lib/visibleSocials';
import { galleryImages, pageHead, structuredDataScript, webPage } from '../seo';
// ?shoot= from a filter or a "Bekijk meer …foto's" link: only a known shoot
// type is kept, so links to it are type-checked (BR-SP-01). Whether that
// type has photos is checked on the page.
type PortfolioSearch = { shoot?: ShootTypeId };
const shootTypeIds = shootTypes.map((type) => type.id);
export const Route = createFileRoute('/portfolio')({
head: () => pageHead('/portfolio'),
validateSearch: (search: Record<string, unknown>): PortfolioSearch => {
const value =
typeof search.shoot === 'string'
? search.shoot.trim().toLowerCase()
: undefined;
return isShootTypeId(value, shootTypeIds) ? { shoot: value } : {};
},
head: () => ({
...pageHead('/portfolio'),
scripts: [
structuredDataScript(
webPage('ImageGallery', '/portfolio', {
associatedMedia: galleryImages(portfolioContent.photos),
}),
),
],
}),
component: Portfolio,
});
// Placeholder tot de echte pagina er is (noindex via sitePages)
// The portfolio (LAYOUT.md: Intro → Portfolio → Instagram): the photos with
// filters and lightbox, then the same Instagram block as on the homepage
function Portfolio() {
const { shoot } = Route.useSearch();
const navigate = useNavigate({ from: Route.fullPath });
const { intro, photos } = portfolioContent;
// Without a valid https link the tiles would lead nowhere: no section
const instagram = visibleSocials(siteContent.socials).find(
(social) => social.platform === 'instagram',
);
return (
<PageIntro eyebrow="Werk" title="Portfolio">
Deze pagina is nog in de maak. Kom snel terug!
</PageIntro>
<>
<PageIntro eyebrow={intro.eyebrow} title={intro.title}>
{intro.text}
</PageIntro>
<PortfolioGallery
photos={photos}
shootTypes={shootTypes}
shoot={shoot}
// The filter is a view, not a step: no history entry per
// change and no jump to the top (application design Q4)
onShootChange={(next) =>
navigate({
search: next ? { shoot: next } : {},
replace: true,
resetScroll: false,
})
}
/>
{instagram && (
<InstagramGrid
content={instagramContent}
profileUrl={instagram.href}
/>
)}
</>
);
}
+10 -1
View File
@@ -5,9 +5,11 @@ 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';
@@ -43,7 +45,14 @@ function PhotoshootTypes() {
<ShootList
shoots={shootTypes}
packages={packages}
portfolioLive={isPortfolioLive(sitePages)}
portfolioShoots={
isPortfolioLive(sitePages)
? shootTypesWithPhotos(
shootTypes,
portfolioContent.photos,
).map((type) => type.id)
: []
}
/>
<CallToAction
title={closing.title}
+51 -3
View File
@@ -1,6 +1,7 @@
import fc from 'fast-check';
import { describe, expect, it } from 'vitest';
import aboutContent from './content/aboutContent';
import portfolioContent from './content/portfolioContent';
import shootTypes from './content/shootTypes';
import siteContent from './content/siteContent';
import { emailAddress } from './lib/emailAddress';
@@ -14,6 +15,7 @@ import {
canonicalUrl,
contactPage,
defaultOgImage,
galleryImages,
jsonLdScript,
pageHead,
person,
@@ -30,6 +32,7 @@ import sitePages from './sitePages';
import {
anySiteContent,
knowsAboutEntries,
portfolioPhotos,
routePath,
uniqueShootTypes,
} from './test/arbitraries';
@@ -93,9 +96,9 @@ describe('pageHead', () => {
});
it('zet noindex op een placeholder', () => {
const head = pageHead('/portfolio');
const head = pageHead('/privacyverklaring');
expect(meta(head, 'robots')).toMatchObject({ content: 'noindex' });
expect(head.links[0].href).toBe(`${siteUrl}/portfolio`);
expect(head.links[0].href).toBe(`${siteUrl}/privacyverklaring`);
});
});
@@ -312,7 +315,11 @@ describe('structured data about Andrea', () => {
});
it('falls back to the site preview image for a page without its own', () => {
const page = aboutPage('/portfolio', aboutContent.person, siteContent);
const page = aboutPage(
'/privacyverklaring',
aboutContent.person,
siteContent,
);
expect(page.mainEntity.image).toBe(`${siteUrl}/og-image.jpg`);
});
@@ -622,3 +629,44 @@ describe('the contact page', () => {
);
});
});
describe('galleryImages', () => {
it('describes each portfolio photo as an image by Andrea, owned by the business', () => {
const images = galleryImages(portfolioContent.photos);
expect(images).toHaveLength(10);
const first = portfolioContent.photos[0];
expect(images[0]).toEqual({
'@type': 'ImageObject',
contentUrl: absoluteUrl(first.full.src),
thumbnailUrl: absoluteUrl(first.thumb.src),
description: first.thumb.alt,
width: 1067,
height: 1600,
creator: { '@id': personId },
copyrightHolder: { '@id': businessId },
});
});
it('gives one image per photo in order, with absolute URLs and the alt text (invariant, oracle)', () => {
fc.assert(
fc.property(portfolioPhotos, (photos) => {
const images = galleryImages(photos);
expect(images).toHaveLength(photos.length);
images.forEach((image, i) => {
expect(image.contentUrl).toMatch(/^https:\/\//);
expect(image.thumbnailUrl).toMatch(/^https:\/\//);
expect(image.description).toBe(photos[i].thumb.alt);
});
}),
);
});
it('never puts an e-mail address in the gallery script (invariant)', () => {
const script = jsonLdScript(
webPage('ImageGallery', '/portfolio', {
associatedMedia: galleryImages(portfolioContent.photos),
}),
);
expect(script).not.toMatch(/@[a-z0-9-]+\.[a-z]/i);
});
});
+18
View File
@@ -2,6 +2,7 @@
// Titels en beschrijvingen staan in het pagina-register (sitePages.ts).
import type {
AboutPageContent,
PortfolioPhoto,
ServiceArea,
ShootType,
SiteContent,
@@ -228,3 +229,20 @@ export function siteHead(content: SiteContent) {
scripts: [structuredDataScript(professionalService(content))],
};
}
// The portfolio photos as schema.org images for the ImageGallery page
// (SEO-PF-03): the large version with the grid version as thumbnail, the
// description from the alt text, Andrea as creator and the business as
// copyright holder. Always every photo, whatever filter is on the page.
export function galleryImages(photos: readonly PortfolioPhoto[]) {
return photos.map((photo) => ({
'@type': 'ImageObject',
contentUrl: absoluteUrl(photo.full.src),
thumbnailUrl: absoluteUrl(photo.thumb.src),
description: photo.thumb.alt,
width: photo.full.width,
height: photo.full.height,
creator: { '@id': personId },
copyrightHolder: { '@id': businessId },
}));
}
+7 -1
View File
@@ -41,7 +41,13 @@ const sitePages: Record<RoutePath, PageMeta> = {
title: 'Portfolio',
description:
"Bekijk het portfolio van Andrea Slop Fotografie: spontane lifestylefoto's van gezinnen, stellen, zwangerschappen en newborns in Huizen en omgeving.",
indexed: false,
indexed: true,
ogImage: {
path: '/og-portfolio.jpg',
width: 1200,
height: 630,
alt: 'Grote broer kust zijn pasgeboren broertje of zusje op een wit bed',
},
},
'/soorten-fotoshoots': {
title: 'Soorten fotoshoots',
+1
View File
@@ -21,6 +21,7 @@ describe('sitemapXml', () => {
expect(locs(sitemapXml(pageList(sitePages), base))).toEqual([
`${base}/`,
`${base}/over-mij`,
`${base}/portfolio`,
`${base}/soorten-fotoshoots`,
`${base}/contact`,
]);
+25
View File
@@ -6,6 +6,7 @@ import type { Point } from '../lib/swipeDirection';
import type {
EmailAddress,
GalleryItem,
PortfolioPhoto,
FrameColor,
PricingPackage,
ShootType,
@@ -378,3 +379,27 @@ export const lightboxEvent: fc.Arbitrary<LightboxEvent> = fc.oneof(
count: fc.integer({ min: 0, max: 12 }),
}),
);
// A portfolio photo of any shoot type; ids are made unique by the list
export const portfolioPhoto: fc.Arbitrary<PortfolioPhoto> = fc
.tuple(
fc.stringMatching(/^[a-z0-9]{1,10}$/),
shootTypeId,
imageSize,
nonBlank,
)
.map(([id, shootType, size, alt]) => ({
id,
shootType,
thumb: { src: `/${id}.jpg`, alt, ...size },
full: {
src: `/${id}-groot.jpg`,
width: size.width * 2,
height: size.height * 2,
},
}));
export const portfolioPhotos = fc.uniqueArray(portfolioPhoto, {
selector: (photo) => photo.id,
maxLength: 15,
});