Files
AndreaSlopFotografie/aidlc-docs/features/portfolio-page/construction/plans/portfolio-page-code-generation-plan.md
T
SluijsensandClaude Opus 5.5 9efa7fc596 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>
2026-10-27 19:05:13 +01:00

5.7 KiB
Raw Blame History

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 (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

  • 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

  • Step 2 — content/types.ts: PortfolioPhoto, PortfolioContent. content/portfolioContent.ts: intro + 10 photos (domain-entities.md), images imported from assets/portfolio/.
  • 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.
  • 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

  • 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.
  • 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).
  • 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.
  • 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.
  • 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

  • Step 10 — LAYOUT.md: Portfolio diagram Intro → Portfolio → Instagram (per .ai/layout-conventions.md).
  • Step 11 — Reverse engineering: own lines about /portfolio (indexed, route, content, PortfolioGallery, helpers, galleryImages) and the Soorten links prop.
  • 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.
  • 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.
  • Step 14 — Code summary aidlc-docs/features/portfolio-page/construction/portfolio-page/code/code-summary.md.
  • 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