Adds the portfolio page #11
@@ -58,11 +58,13 @@ columns 1
|
|||||||
```mermaid
|
```mermaid
|
||||||
block-beta
|
block-beta
|
||||||
columns 1
|
columns 1
|
||||||
A["Portfolio"]
|
A["Intro"]
|
||||||
B["Instagram"]
|
B["Portfolio"]
|
||||||
|
C["Instagram"]
|
||||||
|
|
||||||
style A fill:#e76f51,stroke:#ad533d,color:#fff,font-size:16px,width:400px,height:125px,stroke-width:2px
|
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 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
|
## 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` | — |
|
| (root) | `routes/__root.tsx` | `siteHead(siteContent)` | `AppShell` | — |
|
||||||
| `/` | `routes/index.tsx` | `pageHead('/')` | `Hero` + six home sections; search `?pakket=` | yes |
|
| `/` | `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 |
|
| `/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 |
|
| `/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 |
|
| `/contact` | `routes/contact.tsx` | `pageHead(...)` | `PageIntro` placeholder | no |
|
||||||
| `/privacyverklaring` | `routes/privacyverklaring.tsx` | `pageHead(...)` | `PageIntro` placeholder | no |
|
| `/privacyverklaring` | `routes/privacyverklaring.tsx` | `pageHead(...)` | `PageIntro` placeholder | no |
|
||||||
@@ -39,16 +39,18 @@ None. There is no back-end yet (`api/` is empty). The static design README antic
|
|||||||
- `Eyebrow(TextProps & { as?: 'p' | 'span' | 'h2' | 'h3' | 'h4' })` — accent label, optionally a heading
|
- `Eyebrow(TextProps & { as?: 'p' | 'span' | 'h2' | 'h3' | 'h4' })` — accent label, optionally a heading
|
||||||
- `SectionHeading({ id, title, eyebrow?, lead?, align?: 'center' | 'start', spacing?: 'default' | 'compact', focusable? })` — renders an h2
|
- `SectionHeading({ id, title, eyebrow?, lead?, align?: 'center' | 'start', spacing?: 'default' | 'compact', focusable? })` — renders an h2
|
||||||
- `FramedImage({ image: ContentImage, aspectRatio })`, `DeferredImage(ImageProps & { image, near? })`, `Reveal(BoxProps & { delay? })`
|
- `FramedImage({ image: ContentImage, aspectRatio })`, `DeferredImage(ImageProps & { image, near? })`, `Reveal(BoxProps & { delay? })`
|
||||||
- `IntroGallery({ content })`, `AboutBlock({ content })`, `Pricing({ content, packages })`, `PriceCard(...)`, `Testimonials({ content, testimonials })`, `ContactSection({ content, packages, enabled, email, pakket? })`, `InstagramGrid({ content, profileUrl })`
|
- `IntroGallery({ content })`, `AboutBlock({ content })`, `Pricing({ content, packages })`, `PriceCard(...)`, `Testimonials({ content, testimonials })`, `ContactSection({ content, packages, enabled, email, pakket? })`, `InstagramGrid({ content: InstagramContent, profileUrl })` (shared, `components/InstagramGrid/`)
|
||||||
- `ContactForm(...)`, `ContactFormGate({ enabled, email, ... })`
|
- `ContactForm(...)`, `ContactFormGate({ enabled, email, ... })`
|
||||||
- `PhotoDuo({ photos: [ContentImage, ContentImage], label, 'data-testid'? })`
|
- `PhotoDuo({ photos: [ContentImage, ContentImage], label, 'data-testid'? })`
|
||||||
- `about/AboutIntro({ content })`, `about/StorySection({ content, titleId, tone?, spacing?, children? })`, `shoots/ShootList({ shoots, packages, portfolioLive })`, `shoots/ShootBlock({ shoot, packages, reverse, priority, portfolioLive })`
|
- `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, 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 })`
|
- `StatusPage({ title, children, actions? })`, `ErrorPage({ error, reset })`
|
||||||
- `LinkButton(RouterLink props & { variant?: 'outline' | 'accent' | 'light' })`
|
- `LinkButton(RouterLink props & { variant?: 'outline' | 'accent' | 'light' })`
|
||||||
- `UmamiAnalytics({ hostname? })`
|
- `UmamiAnalytics({ hostname? })`
|
||||||
|
|
||||||
### Hooks
|
### Hooks
|
||||||
- `useHeroSlider(count)` → slider state, controls, handlers, `HeroAnnouncement`
|
- `useHeroSlider(count)` → slider state, controls, handlers, `HeroAnnouncement` (swipe via `useSwipe`, wrap via `wrapIndex`)
|
||||||
|
- `useSwipe({ onPrev, onNext, enabled? })` → `{ onTouchStart, onTouchEnd }` (threshold and direction from `lib/swipeDirection`)
|
||||||
- `useScrolledPast(getThreshold)` → boolean (stable `getThreshold` required)
|
- `useScrolledPast(getThreshold)` → boolean (stable `getThreshold` required)
|
||||||
- `useRouteFocus()` — focuses `<main>` after navigation
|
- `useRouteFocus()` — focuses `<main>` after navigation
|
||||||
- `useInView({ rootMargin, skip })` → `{ ref, inView }`; `usePageLoaded()` → boolean; `useReveal()` → `{ ref, visible }`
|
- `useInView({ rootMargin, skip })` → `{ ref, inView }`; `usePageLoaded()` → boolean; `useReveal()` → `{ ref, visible }`
|
||||||
@@ -60,6 +62,8 @@ None. There is no back-end yet (`api/` is empty). The static design README antic
|
|||||||
- `slidesToLoad(active, count): number[]`
|
- `slidesToLoad(active, count): number[]`
|
||||||
- `backToTopThreshold(viewportHeight): number`
|
- `backToTopThreshold(viewportHeight): number`
|
||||||
- `slideLabel`, `formatPrice`, `bookLabel`, `visiblePackages`, `visibleTestimonials`, `packageFromSearch`, `shootOptions`, `mailSubject`/`mailtoLink`, `validateField`/`validateContact`, `isLikelySpam`, `toContactPayload`, `contactFormReducer`
|
- `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
|
### Monitoring
|
||||||
- `monitoringFor(hostname): Monitoring | null`, `startSentry(hostname?)`, `reportError(error)`
|
- `monitoringFor(hostname): Monitoring | null`, `startSentry(hostname?)`, `reportError(error)`
|
||||||
@@ -70,9 +74,15 @@ None. There is no back-end yet (`api/` is empty). The static design README antic
|
|||||||
### ContentImage
|
### ContentImage
|
||||||
- **Fields**: `src`, `alt`, `width`, `height` (intrinsic size, reserves space)
|
- **Fields**: `src`, `alt`, `width`, `height` (intrinsic size, reserves space)
|
||||||
### HomeContent
|
### HomeContent
|
||||||
- **Fields**: `intro`, `about` (`eyebrow`, `title`, `paragraphs[]`, `image`, `link: { label, to: RoutePath }`), `pricing`, `testimonials`, `contact`, `instagram`
|
- **Fields**: `intro`, `about` (`eyebrow`, `title`, `paragraphs[]`, `image`, `link: { label, to: RoutePath }`), `pricing`, `testimonials`, `contact`
|
||||||
|
### InstagramContent
|
||||||
|
- **Fields**: `title`, `handle`, `photos: ContentImage[]` (the intro photos followed by the review photos, `instagramContent.ts`)
|
||||||
### LinkTarget / InlineLink / RichText
|
### LinkTarget / InlineLink / RichText
|
||||||
- **Fields**: `{ to: RoutePath; hash? }`; `InlineLink` adds `text`; `RichText = (string | InlineLink)[]`
|
- **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
|
### AboutPageContent
|
||||||
- **Fields**: `head`, `intro` (eyebrow, title, `paragraphs: RichText[]`, image), `background`, `photos`, `personal`, `booking` (label + LinkTarget), `person` (name, jobTitle, knowsAbout)
|
- **Fields**: `head`, `intro` (eyebrow, title, `paragraphs: RichText[]`, image), `background`, `photos`, `personal`, `booking` (label + LinkTarget), `person` (name, jobTitle, knowsAbout)
|
||||||
### PricingPackage / Testimonial
|
### PricingPackage / Testimonial
|
||||||
|
|||||||
@@ -17,10 +17,11 @@ graph TD
|
|||||||
Shell --> Umami["UmamiAnalytics"]
|
Shell --> Umami["UmamiAnalytics"]
|
||||||
Outlet --> Home["routes/index.tsx: Hero + six sections"]
|
Outlet --> Home["routes/index.tsx: Hero + six sections"]
|
||||||
Outlet --> About["routes/over-mij.tsx: about page"]
|
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 --> Hero["Hero (HeroArrows, HeroPauseButton, HeroSocials, useHeroSlider)"]
|
||||||
Home --> Sections["components/home/: IntroGallery, AboutBlock, Pricing, Testimonials, ContactSection, InstagramGrid"]
|
Home --> Sections["components/home/: IntroGallery, AboutBlock, Pricing, Testimonials, ContactSection; shared InstagramGrid"]
|
||||||
Sections --> Blocks["Shared blocks: PageSection, MediaText, CallToAction, RichParagraph, Eyebrow, SectionHeading, FramedImage, DeferredImage, Reveal"]
|
Sections --> Blocks["Shared blocks: PageSection, MediaText, CallToAction, RichParagraph, Eyebrow, SectionHeading, FramedImage, DeferredImage, Reveal; gallery: PortfolioGrid, Lightbox, FilterBar"]
|
||||||
Sections --> Form["ContactForm + ContactFormGate (lazy), contact/"]
|
Sections --> Form["ContactForm + ContactFormGate (lazy), contact/"]
|
||||||
Content["content/: siteContent, heroContent, homeContent, packages, testimonials, types"] -.-> Shell
|
Content["content/: siteContent, heroContent, homeContent, packages, testimonials, types"] -.-> Shell
|
||||||
Content -.-> Home
|
Content -.-> Home
|
||||||
@@ -35,7 +36,7 @@ graph TD
|
|||||||
classDef support fill:#e2e8f0,stroke:#4a5568,stroke-width:1px,color:#000;
|
classDef support fill:#e2e8f0,stroke:#4a5568,stroke-width:1px,color:#000;
|
||||||
class Main,Root entry;
|
class Main,Root entry;
|
||||||
class Shell,Skip,Nav,Footer,ToTop,Umami,Outlet shell;
|
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;
|
class Content,NavData,Seo,Theme,Blocks support;
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -74,12 +75,12 @@ Text alternative: main.tsx starts Sentry and mounts the router; the root route r
|
|||||||
|
|
||||||
### components/home/ (homepage sections)
|
### components/home/ (homepage sections)
|
||||||
- **Purpose**: The six homepage blocks below the hero, in LAYOUT.md order
|
- **Purpose**: The six homepage blocks below the hero, in LAYOUT.md order
|
||||||
- **Responsibilities**: `IntroGallery` (four photos, swipeable row on phones), `AboutBlock` (framed photo of Andrea + intro + link to `/over-mij`), `Pricing` + `PriceCard` (packages with "Boek" links → `/?pakket=…#contact`), `Testimonials` (+ `TestimonialCarousel`, `TestimonialSlide`), `ContactSection` (lazy `ContactForm` behind `ContactFormGate`, mailto fallback), `InstagramGrid` (fixed tiles linking to the profile)
|
- **Responsibilities**: `IntroGallery` (four photos, swipeable row on phones), `AboutBlock` (framed photo of Andrea + intro + link to `/over-mij`), `Pricing` + `PriceCard` (packages with "Boek" links → `/?pakket=…#contact`), `Testimonials` (+ `TestimonialCarousel`, `TestimonialSlide`), `ContactSection` (lazy `ContactForm` behind `ContactFormGate`, mailto fallback); the Instagram block is the shared `components/InstagramGrid` (fixed tiles linking to the profile, content from `instagramContent.ts`), also used on the portfolio
|
||||||
- **Type**: Application
|
- **Type**: Application
|
||||||
|
|
||||||
### Shared section building blocks
|
### Shared section building blocks
|
||||||
- **Purpose**: Reusable pieces extracted during homepage-sections; `HomeSection` was renamed to `PageSection` and `MediaText`/`Eyebrow` were extracted in over-mij-page
|
- **Purpose**: Reusable pieces extracted during homepage-sections; `HomeSection` was renamed to `PageSection` and `MediaText`/`Eyebrow` were extracted in over-mij-page
|
||||||
- **Responsibilities**: `PageSection` (section frame: `aria-labelledby`, tone `paper`/`alt`, width `default`/`narrow`/`full`, spacing `default`/`tight`/`flushTop`, anchor offset), `MediaText` (framed photo next to a text column, design `.about`), `Eyebrow` (accent label, optionally a heading), `SectionHeading` (eyebrow + h2 + lead, align start/center, compact spacing), `FramedImage` (photo with a coloured offset block, sand by default, design `.about__media`), `CallToAction` (closing block: h2, lead, action; added in soorten-fotoshoots-page), `RichParagraph` (paragraph with inline links), `DeferredImage` (loads after page load and near the viewport, reserves space), `Reveal` (fade-in on scroll, content always in the DOM, reduced motion respected)
|
- **Responsibilities**: `PageSection` (section frame: `aria-labelledby`, tone `paper`/`alt`, width `default`/`narrow`/`full`, spacing `default`/`tight`/`flushTop`, anchor offset), `MediaText` (framed photo next to a text column, design `.about`), `Eyebrow` (accent label, optionally a heading), `SectionHeading` (eyebrow + h2 + lead, align start/center, compact spacing), `FramedImage` (photo with a coloured offset block, sand by default, design `.about__media`), `CallToAction` (closing block: h2, lead, action; added in soorten-fotoshoots-page), `RichParagraph` (paragraph with inline links), `DeferredImage` (loads after page load and near the viewport, reserves space), `Reveal` (fade-in on scroll, content always in the DOM, reduced motion respected); gallery blocks from portfolio-page: `PortfolioGrid` (CSS-only masonry in reading order, first 3 photos eager), `Lightbox` (Chakra `Dialog`, wrap-around browsing, keys, swipe, preloading, load-error note), `FilterBar` (toggle buttons, `filterControl` recipe)
|
||||||
- **Type**: Application (shared UI)
|
- **Type**: Application (shared UI)
|
||||||
|
|
||||||
### components/PageIntro/, StatusPage/
|
### components/PageIntro/, StatusPage/
|
||||||
|
|||||||
@@ -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
|
- **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"
|
- **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
|
- *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
|
- **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
|
||||||
- *Planned (static design only)*: portfolio with lightbox, shoot types and pricing page, contact page
|
- *Placeholder pages (noindex)*: Contact, Privacyverklaring
|
||||||
|
- *Planned (static design only)*: shoot types and pricing page, contact page
|
||||||
- **Business Dictionary**:
|
- **Business Dictionary**:
|
||||||
- **Shell** — the Header / page content / Footer frame shared by every page (see LAYOUT.md)
|
- **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
|
- **Hero** — full-screen photo slider at the top of the homepage
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ graph TD
|
|||||||
Hero --> useHeroSlider["Hero/useHeroSlider.ts"]
|
Hero --> useHeroSlider["Hero/useHeroSlider.ts"]
|
||||||
Hero --> LinkButton["components/LinkButton.tsx"]
|
Hero --> LinkButton["components/LinkButton.tsx"]
|
||||||
LinkButton --> RouterLink["components/RouterLink.tsx"]
|
LinkButton --> RouterLink["components/RouterLink.tsx"]
|
||||||
Index --> HomeParts["home/*: IntroGallery, AboutBlock, Pricing, Testimonials, ContactSection, InstagramGrid"]
|
Index --> HomeParts["home/*: IntroGallery, AboutBlock, Pricing, Testimonials, ContactSection; shared InstagramGrid"]
|
||||||
HomeParts --> PageSection["PageSection/PageSection.tsx"]
|
HomeParts --> PageSection["PageSection/PageSection.tsx"]
|
||||||
HomeParts --> SectionHeading["SectionHeading/SectionHeading.tsx"]
|
HomeParts --> SectionHeading["SectionHeading/SectionHeading.tsx"]
|
||||||
HomeParts --> Reveal["Reveal/Reveal.tsx"]
|
HomeParts --> Reveal["Reveal/Reveal.tsx"]
|
||||||
@@ -65,12 +65,14 @@ 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/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/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/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/AppShell.tsx` — shell
|
||||||
- `web/src/components/NavigationBar/*` — header, NavLink, MobileNav
|
- `web/src/components/NavigationBar/*` — header, NavLink, MobileNav
|
||||||
- `web/src/components/Footer/*` — footer, FooterColumn, FooterLink
|
- `web/src/components/Footer/*` — footer, FooterColumn, FooterLink
|
||||||
- `web/src/components/Hero/*` — hero slider, arrows, pause button, socials, slider hook
|
- `web/src/components/Hero/*` — hero slider, arrows, pause button, socials, slider hook
|
||||||
- `web/src/components/home/*` — the six homepage sections (AboutBlock is the closest relative of the Over mij page's first block)
|
- `web/src/components/home/*` — five homepage sections (AboutBlock is the closest relative of the Over mij page's first block)
|
||||||
|
- `web/src/components/InstagramGrid/InstagramGrid.tsx` — Instagram block, shared by the homepage and the portfolio (moved from `home/` in portfolio-page)
|
||||||
- ★ `web/src/components/PageSection/PageSection.tsx` — section frame for any page (was `HomeSection`)
|
- ★ `web/src/components/PageSection/PageSection.tsx` — section frame for any page (was `HomeSection`)
|
||||||
- ★ `web/src/components/MediaText/MediaText.tsx`, `Eyebrow/Eyebrow.tsx` — framed photo next to text; accent label
|
- ★ `web/src/components/MediaText/MediaText.tsx`, `Eyebrow/Eyebrow.tsx` — framed photo next to text; accent label
|
||||||
- ★ `web/src/components/SectionHeading/SectionHeading.tsx` — eyebrow + h2 + lead
|
- ★ `web/src/components/SectionHeading/SectionHeading.tsx` — eyebrow + h2 + lead
|
||||||
@@ -82,9 +84,10 @@ Candidates for modification are marked with ★ for the over-mij-page feature.
|
|||||||
- `web/src/components/StatusPage/*` — StatusPage layout, NotFound, ErrorPage
|
- `web/src/components/StatusPage/*` — StatusPage layout, NotFound, ErrorPage
|
||||||
- ★ `web/src/components/LinkButton.tsx`, `RouterLink.tsx` — router links (button style / Chakra-wrapped)
|
- ★ `web/src/components/LinkButton.tsx`, `RouterLink.tsx` — router links (button style / Chakra-wrapped)
|
||||||
- ★ `web/src/content/types.ts` — content interfaces (API shape)
|
- ★ `web/src/content/types.ts` — content interfaces (API shape)
|
||||||
- ★ `web/src/content/*.ts` — static content (`siteContent`, `heroContent`, `homeContent`, `packages`, `testimonials`, `socialPlatforms`)
|
- ★ `web/src/content/*.ts` — static content (`siteContent`, `heroContent`, `homeContent` (exports `introPhotos`), `instagramContent`, `packages`, `testimonials`, `socialPlatforms`)
|
||||||
- `web/src/contact/*` — contact form types and placeholder submit
|
- `web/src/contact/*` — contact form types and placeholder submit
|
||||||
- `web/src/hooks/*` — `useRouteFocus`, `useScrolledPast`, `useInView`, `usePageLoaded`, `useReveal`
|
- `web/src/hooks/*` — `useRouteFocus`, `useScrolledPast`, `useInView`, `usePageLoaded`, `useReveal`, `useSwipe` (shared by the hero and the lightbox)
|
||||||
|
- `web/src/components/{PortfolioGrid,Lightbox,FilterBar}/` — gallery building blocks (portfolio-page unit 2): masonry grid in reading order (CSS only), lightbox on Chakra `Dialog` (lazy-loadable default export), single-choice toggle buttons; generic over `GalleryItem` / `FilterOption`
|
||||||
- `web/src/lib/*.ts` — pure helpers with tests
|
- `web/src/lib/*.ts` — pure helpers with tests
|
||||||
- `web/src/monitoring/*` — Sentry/Umami config and loader
|
- `web/src/monitoring/*` — Sentry/Umami config and loader
|
||||||
- `web/src/navigation.ts` — `RoutePath`, `mainNav`, `footerNav`
|
- `web/src/navigation.ts` — `RoutePath`, `mainNav`, `footerNav`
|
||||||
|
|||||||
@@ -8,3 +8,4 @@
|
|||||||
| Feature | over-mij-page | ✅ Complete | feature/over-mij-page | web/src/routes/over-mij.tsx, web/src/content, possibly shared components (PageIntro, FramedImage, SectionHeading) and web/src/seo.ts | 2026-10-22 |
|
| Feature | over-mij-page | ✅ Complete | feature/over-mij-page | web/src/routes/over-mij.tsx, web/src/content, possibly shared components (PageIntro, FramedImage, SectionHeading) and web/src/seo.ts | 2026-10-22 |
|
||||||
| Feature | soorten-fotoshoots-page | ✅ Complete | feature/soorten-fotoshoots-page | web/src/routes/soorten-fotoshoots.tsx, new web/src/content/shootTypes.ts, new web/src/assets/shoots/, new shared CallToAction, MediaText (reverse prop), Pricing (id="prijzen" only), siteContent (service area), own entries in sitePages.ts / lighthouserc.cjs, JSON-LD via the shared webPage() helper in seo.ts | 2026-10-24 |
|
| Feature | soorten-fotoshoots-page | ✅ Complete | feature/soorten-fotoshoots-page | web/src/routes/soorten-fotoshoots.tsx, new web/src/content/shootTypes.ts, new web/src/assets/shoots/, new shared CallToAction, MediaText (reverse prop), Pricing (id="prijzen" only), siteContent (service area), own entries in sitePages.ts / lighthouserc.cjs, JSON-LD via the shared webPage() helper in seo.ts | 2026-10-24 |
|
||||||
| Feature | contact-page | ✅ Complete | feature/contact-page | web/src/routes/contact.tsx, web/src/content, possibly ContactForm/ContactSection, PageIntro, MediaText/FramedImage, web/src/seo.ts, sitePages/sitemap | 2026-10-24 |
|
| Feature | contact-page | ✅ Complete | feature/contact-page | web/src/routes/contact.tsx, web/src/content, possibly ContactForm/ContactSection, PageIntro, MediaText/FramedImage, web/src/seo.ts, sitePages/sitemap | 2026-10-24 |
|
||||||
|
| Feature | portfolio-page | ✅ Complete | feature/portfolio-page (based on master after over-mij merge; worktree ../AndreaSlopFotografie-portfolio) | web/src/routes/portfolio.tsx, web/src/content, new PortfolioGrid + Lightbox, InstagramGrid (moved to shared), own entries in sitePages.ts / lighthouserc.cjs, ImageGallery JSON-LD via the shared webPage() helper | 2026-10-24 |
|
||||||
|
|||||||
@@ -0,0 +1,95 @@
|
|||||||
|
# AI-DLC State Tracking
|
||||||
|
|
||||||
|
## Project Information
|
||||||
|
- **Feature Name**: Portfolio page (`/portfolio`)
|
||||||
|
- **Feature Slug**: portfolio-page
|
||||||
|
- **Project Type**: Brownfield
|
||||||
|
- **Start Date**: 2026-10-24T19:30:00Z
|
||||||
|
- **Current Stage**: Complete
|
||||||
|
- **Branch**: feature/portfolio-page (rebased onto master 1bf28cb after contact-page PR #10)
|
||||||
|
- **Worktree**: K:\Development\SlpSoftware\Projects\AndreaSlopFotografie-portfolio
|
||||||
|
|
||||||
|
## Workspace State
|
||||||
|
- **Existing Code**: Yes
|
||||||
|
- **Programming Languages**: TypeScript (React/TSX)
|
||||||
|
- **Build System**: pnpm + Vite (`tsc && vite build`), Gitea Actions CI
|
||||||
|
- **Project Structure**: Single front-end SPA in `web/`; static HTML design reference in `design/andreaslop-static/`; `api/` folder present but empty (.NET back-end planned)
|
||||||
|
- **Reverse Engineering Needed**: No (artifacts current with the over-mij blocks; team agreement: no full refresh, each feature updates only its own lines)
|
||||||
|
- **Workspace Root**: K:\Development\SlpSoftware\Projects\AndreaSlopFotografie
|
||||||
|
|
||||||
|
## Code Location Rules
|
||||||
|
- **Application Code**: Workspace root (NEVER in aidlc-docs/) — front-end lives in `web/`
|
||||||
|
- **Feature Documentation**: aidlc-docs/features/portfolio-page/ only
|
||||||
|
- **Shared Artifacts**: aidlc-docs/_shared/
|
||||||
|
- **Structure patterns**: See code-generation.md Critical Rules
|
||||||
|
|
||||||
|
## Language Configuration
|
||||||
|
- **Documentation Language**: English
|
||||||
|
- **Conversation Language**: User Language (Dutch)
|
||||||
|
- **Source**: inherited from aidlc-docs/language-preference.md (answer A); user may override
|
||||||
|
|
||||||
|
## Extension Configuration
|
||||||
|
| Extension | Enabled | Decided At |
|
||||||
|
|---|---|---|
|
||||||
|
| Security Baseline | Yes | Requirements Analysis |
|
||||||
|
| Property-Based Testing | Yes (full enforcement) | Requirements Analysis |
|
||||||
|
|
||||||
|
## Operations Configuration
|
||||||
|
- **Include Operations Phase**: No
|
||||||
|
- **Decided At**: Requirements Analysis
|
||||||
|
|
||||||
|
## Execution Plan Summary
|
||||||
|
- **Stages to Execute**: Application Design (standard), Functional Design (units 2 and 3), Code Generation (3 units), Build and Test
|
||||||
|
- **Stages to Skip**: Reverse Engineering (team agreement), User Stories (single persona, concrete FRs), Units Generation (split fixed in the execution plan), Functional Design for unit 1 (behaviour-preserving move), NFR Requirements and NFR Design (NFRs set at requirements level), Infrastructure Design (static assets only), Operations (decided No)
|
||||||
|
- **Units**: 1 Shared Instagram block → 2 Gallery building blocks → 3 Portfolio page (needs the webPage() and shootTypes.ts peer commits)
|
||||||
|
- **Delivery**: branch feature/portfolio-page, commits per unit, full `pnpm check` (incl. Lighthouse) per unit, one PR at the end
|
||||||
|
|
||||||
|
## Parallel Work Agreements
|
||||||
|
Parallel features, each in its own worktree (originally stacked on feature/over-mij-page, merged to master as 11a5224): contact-page (✅ merged as 8b70f23, PR #9; session ended. Was: next: siteContent.socials reordered to Instagram, Facebook; new shared ContactDetails, PrivacyNote, ContactPanel; unit 2 on origin/feature/contact-page 26a8bd9, not on master yet. After the next rebase: `SocialLink.label?` and `SiteContent.contactForm.replyTime` — SiteContent fixtures in tests need `replyTime`), soorten-fotoshoots-page (✅ merged as a58bc1c; session ended); session names change on restart, check ListAgents. Over-mij session ("Over mij pagina") notifies when merged.
|
||||||
|
- No full RE refresh; each feature only updates the RE lines about its own route/components
|
||||||
|
- Hot files: own entry only in sitePages.ts, lighthouserc.cjs, active-features.md
|
||||||
|
- **Test environment (single, last deploy wins)**: send "claim test" with the reason (who reviews what) before a `deploy_test` dispatch, and "test free" once that review is done. A merge to master also deploys to test, so check that test is not claimed before merging
|
||||||
|
- **Lighthouse / `pnpm check` (port 4173)**: send "claim 4173" to the other two sessions before a run and "4173 free" after; avoid CPU-heavy work (full vitest with coverage, build) while another session runs Lighthouse
|
||||||
|
- **Peer commits to cherry-pick at the start of unit 3**:
|
||||||
|
- soorten-fotoshoots: **on master since a58bc1c (PR #8) — no cherry-pick needed**. Was `eb23536` "Adds the shoot types and their photos" (content/types.ts ShootTypeId/FrameColor/ShootType, content/shootTypes.ts + test, assets/shoots/*.jpg 960×1200, theme.ts frame.* tokens, test/arbitraries.ts shootTypeId/shootType/uniqueShootTypes). Run `pnpm typegen` afterwards (theme change). Their Gezin photo is F41A7138 (also portfolio photo 9; overlap accepted by their user; different derivatives)
|
||||||
|
- If soorten-fotoshoots PR #8 (or contact's PR) is merged to master before unit 3 starts: rebase onto master instead of cherry-picking that commit
|
||||||
|
- contact-page: **`webPage()` on master since a58bc1c (as 3c7d00e) — no cherry-pick needed**; 790495d no longer exists after contact's rebase
|
||||||
|
- seo.ts: contact-page builds generic `webPage(type, path, extra)` (aboutPage refactored onto it) in a separate commit; portfolio cherry-picks it and uses it for ImageGallery/CollectionPage JSON-LD. No own xxxPage() helper. Proposed signature: `webPage(type: WebPageType, path: RoutePath, extra: Record<string, unknown> = {})` with `WebPageType = 'WebPage' | 'AboutPage' | 'ContactPage' | 'ImageGallery' | 'CollectionPage'` (add a type to the union in an own one-line commit if needed) → `{ @context, @type: type, @id + url: canonicalUrl(path), name/description from sitePages[path], inLanguage: 'nl-NL', ...extra }` (extra last). Commit hash follows once contact's user approves; design against this signature until then
|
||||||
|
- Claims: portfolio — PortfolioGrid, Lightbox, InstagramGrid moved from components/home/ to shared; contact — ContactForm generalisation, contact-details block; soorten-fotoshoots — content/shootTypes.ts, CallToAction band, optional MediaText `reverse` prop
|
||||||
|
- PageIntro is used by all; announce before changing it
|
||||||
|
- Photos: soorten-fotoshoots owns the shoot photos (newborn, zwangerschap, loveshoot, portret, gezin) in `web/src/assets/shoots/`, delivered as an assets-only commit; portfolio cherry-picks it if the user picks any of them. Portfolio-only photos go in `web/src/assets/portfolio/`. Photos already in `web/src/assets/home/` (intro-2, intro-4) are imported from there. Send the final photo list to soorten-fotoshoots after Requirements Analysis. **Update**: user chose the 10 live photos (Q1 A), no overlap with the shoot photos; list sent
|
||||||
|
- Shoot types: portfolio reuses soorten-fotoshoots' list for filters and captions. Proposed shape in `content/types.ts`: `ShootTypeId = 'newborn' | 'zwangerschap' | 'gezin' | 'loveshoot' | 'portret'`; `ShootType { id; name ('Newborn', …, 'Portretten'); shootLabel ('Newbornshoot', …, 'Portretshoot'); paragraphs; image; packageId? }`; order newborn, zwangerschap, gezin, loveshoot, portret. Delivered as a separate commit (types + shootTypes.ts + assets/shoots/) at the start of their unit 1; hash follows. Portfolio photo data references `ShootTypeId` only. `?shoot=<id>` link from their page: confirmed by their user; shown only once `/portfolio` is `indexed: true` (no message needed at merge). Portfolio route: `validateSearch` returns typed `{ shoot?: ShootTypeId }` so their `search: { shoot }` type-checks. Types without portfolio photos fall back to "Alles"; portfolio exports a pure helper (working name `shootTypesWithPhotos`) in unit 3 and sends its name. ShootType gains `photosLabel` and `frameColor` (theirs, additive). RichParagraph moves to `components/` (theirs). Their shoot blocks render "Bekijk meer {photosLabel}" → `/portfolio?shoot=<id>` once `sitePages['/portfolio'].indexed === true`; their app.test.tsx expects 5 portfolio links when indexed, else 0 (check after rebase). Their session has ended: wiring the helper into their ShootList/ShootBlock (`portfolioLive && hasPhotos`) is now a follow-up for this feature (unit 3 or a small follow-up commit). `ShootType.detailImage` added (optional, theirs)
|
||||||
|
|
||||||
|
## Known Risks
|
||||||
|
- **Lighthouse mobile performance ≈ 0.9 threshold** (from soorten-fotoshoots, 2026-10-25): pages whose LCP is an image land at LCP ≈ 3.22 s ≈ score 0.895 in the simulated mobile run (over-mij and soorten-fotoshoots); fewer image bytes do not help, the cost is main bundle + route chunk. Relevant for NFR-PF-05 in unit 3: keep the route chunk small (Lightbox lazy, Q7), measure early, and align with soorten-fotoshoots' user decision on the budget before changing `lighthouserc*.cjs`
|
||||||
|
- **Soorten-fotoshoots' rule (their unit 2 commit, decided by their user)**: `lighthouserc.cjs` exports `photoPagePaths = ['/over-mij', '/soorten-fotoshoots']` with `photoPageMobilePerformance = 0.85` (mobile only); assertMatrix order home (0.8) → photo pages (0.85) → other indexed → noindex → 404; `lighthouserc.desktop.cjs` maps every entry to 0.9. Suggested for portfolio: add `/portfolio` to `photoPagePaths` once indexed. **Open for this feature**: that lowers NFR-PF-05 (≥ 0.9 mobile, approved) for `/portfolio` to 0.85 — needs this user's decision; decide in unit 3 after measuring (if `/portfolio` reaches 0.9 it stays in the default budget)
|
||||||
|
|
||||||
|
- **Accent button contrast** (from contact-page, 2026-10-25): `linkButton` variant `accent` (white on accent #7f8b76) is 3.58:1 < 4.5:1; Lighthouse only flags it when visible on first load (Reveal hides it elsewhere). Decided by the user, **on master since 8b70f23**: accent button bg → `accent.deep` (#5f6a58), hover → new token `accent.deeper` (#475042); changes theme.ts and recipes/linkButton.ts — keep both on a rebase. Portfolio does not plan an accent button; the filter bar uses `accent.deep` for its active state (≥ 4.5:1) — verify contrast of every new colour pair in unit 2 anyway
|
||||||
|
- **Homepage mobile performance** sits at 0.79–0.80 against its 0.8 threshold on current builds (contact, 3 runs). A failing `/` in a portfolio Lighthouse run is probably this, not a portfolio regression; compare against master before acting
|
||||||
|
|
||||||
|
## Stage Progress
|
||||||
|
|
||||||
|
### 🔵 INCEPTION PHASE
|
||||||
|
- [x] Workspace Detection
|
||||||
|
- [x] Reverse Engineering - SKIP (artifacts current; team agreement)
|
||||||
|
- [x] Requirements Analysis (approved)
|
||||||
|
- [x] User Stories - SKIP
|
||||||
|
- [x] Workflow Planning (approved)
|
||||||
|
- [x] Application Design - EXECUTE (approved)
|
||||||
|
- [ ] Units Generation - SKIP
|
||||||
|
|
||||||
|
### 🟢 CONSTRUCTION PHASE
|
||||||
|
- [~] Functional Design - EXECUTE (units 2 and 3) / SKIP (unit 1) — Unit 2 ✅; Unit 3 ✅
|
||||||
|
- [ ] NFR Requirements - SKIP
|
||||||
|
- [ ] NFR Design - SKIP
|
||||||
|
- [ ] Infrastructure Design - SKIP
|
||||||
|
- [x] Code Generation - EXECUTE (per unit) — Unit 1 Shared Instagram block ✅ (e013f14 after rebases); Unit 2 Gallery building blocks ✅ (18bf031); Unit 3 Portfolio page ✅ (9efa7fc)
|
||||||
|
- [x] Build and Test - EXECUTE (approved)
|
||||||
|
|
||||||
|
### 🟡 OPERATIONS PHASE
|
||||||
|
- [ ] Deployment Setup, Monitoring Setup, Production Readiness Validation - SKIP (Operations = No)
|
||||||
|
|
||||||
|
## Current Status
|
||||||
|
- **Lifecycle Phase**: COMPLETE
|
||||||
|
- **Current Stage**: Complete
|
||||||
|
- **Next Stage**: none (Operations = No)
|
||||||
@@ -0,0 +1,346 @@
|
|||||||
|
# AI-DLC Audit Log — portfolio-page
|
||||||
|
|
||||||
|
## Initial User Request
|
||||||
|
|
||||||
|
**Timestamp**: 2026-10-24T19:30:00Z
|
||||||
|
|
||||||
|
**User Input**: "Ik wil een nieuwe feature starten voor het bouwen van de portfolio pagina. Wederom met aandacht voor SEO, accessibility en reusability van code elementen, chakra en theming. Net zoals voorgaande feature."
|
||||||
|
|
||||||
|
**AI Response**: "Started AI-DLC workflow (existing multi-feature workspace, no welcome message). Began Workspace Detection."
|
||||||
|
|
||||||
|
**Context**: INCEPTION - Workspace Detection (start)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Workspace Detection — Branch Base Decision
|
||||||
|
|
||||||
|
**Timestamp**: 2026-10-24T19:33:00Z
|
||||||
|
|
||||||
|
**User Input**: "Portfolio vanaf over-mij branch"
|
||||||
|
|
||||||
|
**AI Response**: "Flagged that feature over-mij-page is not finished (Build and Test started but not closed, audit entry uncommitted, branch not merged to master) while the portfolio page will reuse its shared blocks (PageIntro, PageSection, media+text block). Asked how to sequence the two features: finish over-mij first (recommended), branch portfolio from feature/over-mij-page, or branch from master. User chose to branch from feature/over-mij-page."
|
||||||
|
|
||||||
|
**Context**: INCEPTION - Workspace Detection. Process decision on branch base.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Workspace Detection
|
||||||
|
|
||||||
|
**Timestamp**: 2026-10-24T19:34:50Z
|
||||||
|
|
||||||
|
**User Input**: (none — automatic stage)
|
||||||
|
|
||||||
|
**AI Response**: "Feature resolution: request is clearly new work, so a new feature was started without a feature-selection prompt. Classification: Feature (new page, no defect). Slug: portfolio-page. Branch feature/portfolio-page created from feature/over-mij-page (ae769cb); the uncommitted over-mij-page audit.md entry stays in the working tree and belongs to that feature. Brownfield (React SPA in web/, placeholder route web/src/routes/portfolio.tsx and design reference design/andreaslop-static/portfolio.html exist). Language configuration inherited from aidlc-docs/language-preference.md (answer A: English docs, Dutch conversation), stated to the user for correction instead of re-asking. Reverse engineering artifacts in _shared/ are stale: generated at 99d4610, while 43 files under web/ changed up to ae769cb (shared section blocks, Over mij page, seo.ts, sitePages.ts). Next: refresh Reverse Engineering."
|
||||||
|
|
||||||
|
**Context**: INCEPTION - Workspace Detection (complete). Parallel features: over-mij-page (🟢 Construction, Build and Test). Conflicts: see below.
|
||||||
|
|
||||||
|
⚠️ **Potential Conflict Detected**
|
||||||
|
Feature "portfolio-page" may affect components also touched by active feature "over-mij-page":
|
||||||
|
- Shared components: web/src/content, shared section components (PageIntro, PageSection, media+text block), web/src/seo.ts, web/src/sitePages.ts
|
||||||
|
- Resolution: portfolio-page is stacked on feature/over-mij-page; over-mij-page must be merged to master before the portfolio PR, or the portfolio PR will also carry its commits.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Workspace Detection — Parallel Work Setup
|
||||||
|
|
||||||
|
**Timestamp**: 2026-10-24T19:55:00Z
|
||||||
|
|
||||||
|
**User Input**: "kan je niet verde rin eeen worktree en zorgen dat je die update zodra over mij klaar is? Ik heb meerdere features gestart omdat ik die tegelijk wilden gaan oppakken. Kan je daarmee werken? OM wel te zorgen dat er geen dubbel werk gedaan wordt? Alsof je met teamgenoten praat?"
|
||||||
|
|
||||||
|
**AI Response**: "Moved the feature into its own worktree K:\Development\SlpSoftware\Projects\AndreaSlopFotografie-portfolio (branch feature/portfolio-page); the main checkout is left on a detached HEAD at ae769cb. Moved this feature's registry row from the main checkout to the worktree. Coordinated with the parallel sessions (contact-page, soorten-fotoshoots-page, over-mij-page) and recorded the agreements in aidlc-state.md § Parallel Work Agreements. Asked the over-mij session to notify all three when it is merged, so portfolio can rebase onto master. Reverse Engineering skipped: per team agreement the shared artifacts are current with the over-mij blocks, and each feature updates only its own lines (the prepared broad refresh was not applied)."
|
||||||
|
|
||||||
|
**Context**: INCEPTION - Workspace Detection (parallel setup) → Reverse Engineering SKIP → Requirements Analysis next
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Branch Update — over-mij-page merged
|
||||||
|
|
||||||
|
**Timestamp**: 2026-10-24T20:30:00Z
|
||||||
|
|
||||||
|
**User Input**: (none — notification from the over-mij-page session: merged to master as 11a5224, PR #7)
|
||||||
|
|
||||||
|
**AI Response**: "Updated feature/portfolio-page as agreed with the user ('zorgen dat je die update zodra over mij klaar is'). The branch had no own commits, so it was fast-forwarded from ae769cb to master 11a5224 (only docs changed: 7a56a47, 194df71); uncommitted portfolio docs were stashed and re-applied. Resolved the expected conflict in aidlc-docs/active-features.md: kept master's ✅ Complete row for over-mij-page and added the portfolio-page row."
|
||||||
|
|
||||||
|
**Context**: INCEPTION - before Requirements Analysis. Branch base is now master.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Requirements Analysis — Start
|
||||||
|
|
||||||
|
**Timestamp**: 2026-10-24T20:45:00Z
|
||||||
|
|
||||||
|
**User Input**: "ja start de requirement analysis"
|
||||||
|
|
||||||
|
**AI Response**: "Started Requirements Analysis (standard depth: new page, multiple components incl. new PortfolioGrid and Lightbox, clear intent but open choices). Compared the design (portfolio.html: page head, 8 photos cropped 3:4 in a 3/2/1-column grid, lightbox with prev/next/close/caption/counter, Instagram block) with the live site andreaslop.nl/portfolio (no h1 or intro, 10 newer photos, 9 of 10 without alt text, no filters, Instagram block). Created inception/requirements/requirement-verification-questions.md (in Dutch, like the previous feature) with 13 content questions (photo set, grid layout, lightbox, caption, deep link, image sizes, loading, intro text, filters, Instagram block, SEO title/description, JSON-LD ImageGallery, OG image) plus the Security Baseline and Property-Based Testing opt-ins and the Operations phase question."
|
||||||
|
|
||||||
|
**Context**: INCEPTION - Requirements Analysis (awaiting answers)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Requirements Analysis — Verification Answers
|
||||||
|
|
||||||
|
**Timestamp**: 2026-10-24T21:05:00Z
|
||||||
|
|
||||||
|
**User Input**: "Ik heb de vragen beantwoord"
|
||||||
|
|
||||||
|
**AI Response**: "Read the answers: Q1 A (the 10 live photos, re-processed, descriptive alt texts), Q2 B (masonry), Q3 A (accessible lightbox on Chakra Dialog), Q4 C (separate short caption per photo, e.g. shoot type), Q5 A (no deep link to a single photo), Q6 A (two sizes: grid ~800px, lightbox ~1600–2000px, neighbours preloaded), Q7 A (first row eager/high priority, rest deferred), Q8 A (eyebrow Werk, h1 Portfolio, intro 'Klik of tik'), Q9 B (filters per shoot type based on shootTypes.ts), Q10 A (InstagramGrid shared with own content, same photos as homepage), Q11 B (keep title and description), Q12 A (ImageGallery with ImageObject list via webPage()), Q13 A (own OG image from a portfolio photo), Security Baseline A (Yes), PBT A (Yes), Operations B (No). Recorded extension and operations configuration. Detected interactions needing clarification: masonry vs. 'first row' loading and reading order; caption vs. shoot type data; who assigns shoot types; filter state in URL; lightbox scope under a filter; empty filters. Created inception/requirements/requirement-clarification-questions.md with 7 questions. Notified soorten-fotoshoots of the dependency on shootTypes.ts and that the portfolio uses none of their shoot photos."
|
||||||
|
|
||||||
|
**Context**: INCEPTION - Requirements Analysis (awaiting clarification answers)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Requirements Analysis — Clarification Answers and Requirements Document
|
||||||
|
|
||||||
|
**Timestamp**: 2026-10-24T21:30:00Z
|
||||||
|
|
||||||
|
**User Input**: "Ik heb de vragen beantwoord"
|
||||||
|
|
||||||
|
**AI Response**: "Read the clarification answers, all A: C1 masonry in row order, C2 first 3 photos eager, C3 caption = shoot type label from the same data as the filters, C4 shoot type and alt text per photo proposed in Functional Design and approved by the user, C5 filter in the URL (?shoot=, canonical stays /portfolio), C6 lightbox browses within the active filter, C7 only filters for shoot types with photos plus 'Alles'. No remaining contradictions. Loaded the Security Baseline and Property-Based Testing rules. Generated inception/requirements/requirements.md (9 FRs, 5 SEO requirements, 6 NFRs, extension compliance at requirements level, dependencies on contact-page's webPage() and soorten-fotoshoots' shootTypes.ts). Added LAYOUT.md 'Intro' block for consistency with the other pages (not asked as a question; flagged to the user for review). Confirmed the ?shoot=<id> URL to soorten-fotoshoots. Presented the Requirements Analysis completion message."
|
||||||
|
|
||||||
|
**Context**: INCEPTION - Requirements Analysis (awaiting approval)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Requirements Analysis — Approval
|
||||||
|
|
||||||
|
**Timestamp**: 2026-10-24T21:40:00Z
|
||||||
|
|
||||||
|
**User Input**: "ga door naar workflow planning"
|
||||||
|
|
||||||
|
**AI Response**: "Requirements approved (incl. the LAYOUT.md 'Intro' addition). User Stories skipped (single persona). Started Workflow Planning."
|
||||||
|
|
||||||
|
**Context**: INCEPTION - Requirements Analysis (approved) → Workflow Planning
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Workflow Planning
|
||||||
|
|
||||||
|
**Timestamp**: 2026-10-24T21:50:00Z
|
||||||
|
|
||||||
|
**User Input**: (none — stage executed after approval)
|
||||||
|
|
||||||
|
**AI Response**: "Created inception/plans/execution-plan.md. Risk Medium (lightbox and row-order masonry; two peer dependencies). Execute: Application Design (standard), Functional Design for units 2 and 3, Code Generation for 3 units, Build and Test. Skip: Units Generation, Functional Design unit 1, NFR Requirements, NFR Design, Infrastructure Design, Operations. Units: 1 Shared Instagram block, 2 Gallery building blocks (generic, fixture-tested, no peer dependency), 3 Portfolio page (cherry-picks webPage() and shootTypes.ts first; stops and reports if missing). Presented the plan for approval."
|
||||||
|
|
||||||
|
**Context**: INCEPTION - Workflow Planning (awaiting approval)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Workflow Planning — Approval
|
||||||
|
|
||||||
|
**Timestamp**: 2026-10-24T22:00:00Z
|
||||||
|
|
||||||
|
**User Input**: "akkoord, ga verder"
|
||||||
|
|
||||||
|
**AI Response**: "Execution plan approved. Started Application Design (standard depth). Inspected the hero swipe logic (inline in useHeroSlider), the ?pakket= search handling (validateSearch + lib/packageFromSearch) and DeferredImage; no Chakra Dialog in use yet. Created inception/plans/application-design-plan.md with the already-decided points (claimed names with generic APIs, generic gallery item, content modules, URL state via validateSearch, Lightbox on Chakra Dialog, SEO builders on webPage()) and 7 questions: composition of grid/lightbox/filter, filter bar semantics, filter bar style, history behaviour, swipe extraction, masonry technique, lightbox code splitting."
|
||||||
|
|
||||||
|
**Context**: INCEPTION - Application Design (awaiting answers)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Application Design — Answers
|
||||||
|
|
||||||
|
**Timestamp**: 2026-10-24T22:30:00Z
|
||||||
|
|
||||||
|
**User Input**: "ik heb de vragen beantwoord" (preceded by: "kan je voor de voorgestelde ontwerpen en de verwijderknop een voorbeeld geven?")
|
||||||
|
|
||||||
|
**AI Response**: "Before the answers: published an interactive example page (https://claude.ai/artifact/6s8P5d17ac69otiaWzDWZZ) for questions 2 (filter semantics), 3 (filter styles) and 4 (back button; 'verwijderknop' interpreted as 'terugknop', stated to the user). Answers read: Q1 A, Q2 A, Q3 A, Q4 A, Q5 A, Q6 'A, als het later nodig', Q7 A. Q6 looks cut off; added follow-up question 6a to the plan before generating the design. Also recorded the soorten-fotoshoots agreement: typed validateSearch { shoot?: ShootTypeId } on /portfolio, links shown once /portfolio is indexed, helper for shoot types with photos in unit 3."
|
||||||
|
|
||||||
|
**Context**: INCEPTION - Application Design (follow-up question pending)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Application Design — Follow-up Answer and Artifacts
|
||||||
|
|
||||||
|
**Timestamp**: 2026-10-24T22:50:00Z
|
||||||
|
|
||||||
|
**User Input**: "Ik heb de vraag beantwoord en voor de duidleijkheid mijn antwoord op vraag 6 gecorrigeerd"
|
||||||
|
|
||||||
|
**AI Response**: "Read Q6 'A, als het later nodig kunnen we het alsnog ombouwen' and follow-up 6a = B: CSS-only masonry now, no preparation for JS measuring. Generated inception/application-design/components.md, component-methods.md, services.md, component-dependency.md and application-design.md. Key points: shared PortfolioGrid, Lightbox (lazy, Chakra Dialog) and FilterBar (toggle buttons, eyebrow style, new recipe) connected by components/portfolio/PortfolioGallery; URL owns the filter (typed validateSearch, replace navigation), PortfolioGallery owns the open photo; useSwipe + lib/swipeDirection extracted from the hero (and wrapIndex shared); generic GalleryItem; per-unit split of new/changed files; peer dependencies only in unit 3. Presented the completion message."
|
||||||
|
|
||||||
|
**Context**: INCEPTION - Application Design (awaiting approval)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Application Design — Approval
|
||||||
|
|
||||||
|
**Timestamp**: 2026-10-25T07:00:00Z
|
||||||
|
|
||||||
|
**User Input**: "Akkoord, ga verder"
|
||||||
|
|
||||||
|
**AI Response**: "Application Design approved. Units Generation skipped (units fixed in the execution plan). Moved to CONSTRUCTION. Unit 1 (Shared Instagram block) has no Functional Design; created construction/plans/shared-instagram-code-generation-plan.md (13 steps: InstagramContent type and module, git mv of InstagramGrid to components/, homepage switched, tests, pnpm check, visual check, own RE lines, code summary, two commits: inception docs then unit 1; no push). Started pnpm install in the worktree (no node_modules yet). Noted soorten-fotoshoots commit eb23536 for unit 3."
|
||||||
|
|
||||||
|
**Context**: CONSTRUCTION - Code Generation Unit 1 (plan awaiting approval)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Code Generation — Unit 1 — Plan Approval
|
||||||
|
|
||||||
|
**Timestamp**: 2026-10-25T07:10:00Z
|
||||||
|
|
||||||
|
**User Input**: "Approve plan"
|
||||||
|
|
||||||
|
**AI Response**: "Executed shared-instagram-code-generation-plan.md steps 1–12: InstagramContent type and instagramContent.ts, introPhotos exported, InstagramGrid moved to components/ (git mv) with props type changed, new test for the photo reuse, homepage switched; no leftovers. pnpm check green (60 files, 274 tests, Lighthouse 7 URLs mobile+desktop). Coordinated port 4173 with the parallel sessions (claim/free protocol). No browser available for the side-by-side visual check; verified by construction and unchanged tests, flagged to the user. Own RE lines updated; code summary written. Committing the inception docs and unit 1 locally (no push)."
|
||||||
|
|
||||||
|
**Context**: CONSTRUCTION - Code Generation Unit 1 (generated, awaiting approval)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Code Generation — Unit 1 — Approval
|
||||||
|
|
||||||
|
**Timestamp**: 2026-10-25T07:40:00Z
|
||||||
|
|
||||||
|
**User Input**: "Ga verder"
|
||||||
|
|
||||||
|
**AI Response**: "Unit 1 approved (commits 4de0885, 996cc32). active-features.md status → 🟢 Construction. Recorded contact-page commit 790495d (webPage) for unit 3. Started Functional Design for unit 2 (gallery-blocks): created construction/plans/gallery-blocks-functional-design-plan.md and gallery-blocks-fd-questions.md (10 questions: lightbox transition, phone button layout, tap on image, swipe down, announcement, tile name, large image failure, preload count, grid on filter change, Home/End)."
|
||||||
|
|
||||||
|
**Context**: CONSTRUCTION - Functional Design Unit 2 (awaiting answers)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Branch Update — soorten-fotoshoots-page merged
|
||||||
|
|
||||||
|
**Timestamp**: 2026-10-25T10:30:00Z
|
||||||
|
|
||||||
|
**User Input**: (none — notification from the soorten-fotoshoots session: PR #8 merged as a58bc1c)
|
||||||
|
|
||||||
|
**AI Response**: "Stashed the uncommitted docs under a named stash, rebased feature/portfolio-page (2 commits) onto origin/master a58bc1c. Conflicts: aidlc-docs/active-features.md (kept the soorten ✅ row and the portfolio row) and _shared/reverse-engineering/architecture.md (merged the shared InstagramGrid line with soorten's CallToAction/RichParagraph blocks). Popped and dropped the own stash by name (contact's stash left untouched). New hashes 236123d (plans), cce11a8 (unit 1). Verified: tsc clean, vitest 65 files / 326 tests passed (Lighthouse not run). shootTypes.ts now comes via master; the eb23536 cherry-pick is no longer needed. Soorten's session ended, so wiring the 'types with photos' helper into their ShootList/ShootBlock becomes a follow-up of this feature."
|
||||||
|
|
||||||
|
**Context**: CONSTRUCTION - Functional Design Unit 2 (awaiting answers)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Branch Update — contact-page merged
|
||||||
|
|
||||||
|
**Timestamp**: 2026-10-25T19:00:00Z
|
||||||
|
|
||||||
|
**User Input**: (none — notification from the contact-page session: PR #9 merged as 8b70f23, test free)
|
||||||
|
|
||||||
|
**AI Response**: "Stashed docs under a named stash, rebased feature/portfolio-page onto origin/master 8b70f23 (new hashes ad567bb plans, ec48bd7 unit 1). Conflicts only in aidlc-docs/active-features.md (kept all master rows incl. contact-page as on master, portfolio row with status 🟢 Construction). Popped and dropped the own stash by name; stash list empty. Verified: tsc clean, vitest 71 files / 368 tests passed. Parallel sessions (soorten-fotoshoots, contact) have both ended; portfolio is the only active feature."
|
||||||
|
|
||||||
|
**Context**: CONSTRUCTION - Functional Design Unit 2 (awaiting answers)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Branch Update — contact-page PR #10 merged (docs)
|
||||||
|
|
||||||
|
**Timestamp**: 2026-10-25T19:20:00Z
|
||||||
|
|
||||||
|
**User Input**: (none — notification from the contact-page session: PR #10 merged as 1bf28cb, docs only)
|
||||||
|
|
||||||
|
**AI Response**: "Rebased onto origin/master 1bf28cb. Mistake and fix: when resolving the active-features.md conflict I removed the conflict markers and kept both sides, so the old 'contact-page 🟢 Construction' row stayed next to master's '✅ Complete' row and was committed in the rebased planning commit. Cause: blindly keeping both sides of a hunk where one side replaced a line. Fixed in history (local, unpushed) with a fixup commit + autosquash; the stash conflict was then resolved from the committed file with only the portfolio status changed. Verified the restored state, audit and FD files byte-equal to the stash before dropping it by name. New hashes b35b1c2 (plans), e013f14 (unit 1); web/ unchanged by this rebase."
|
||||||
|
|
||||||
|
**Context**: CONSTRUCTION - Functional Design Unit 2 (awaiting answers)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Functional Design — Unit 2 — Answers and Artifacts
|
||||||
|
|
||||||
|
**Timestamp**: 2026-10-25T19:40:00Z
|
||||||
|
|
||||||
|
**User Input**: "Stuur de vragen hier" — then answered in chat: Q1 Korte overvloeier, Q2 Balk onderaan op telefoon, Q3 Niets, Q4 Nee, Q5 Positie en bijschrift, Q6 Alt + (groot bekijken), Q7 Kleine foto met melding, Q8 2 aan elke kant, Q9 Direct wisselen, Q10 Ja.
|
||||||
|
|
||||||
|
**AI Response**: "Asked the 10 FD questions in chat (user request) and recorded the answers in gallery-blocks-fd-questions.md (A A A A A A B B A A). No ambiguities. Generated construction/gallery-blocks/functional-design/{domain-entities, business-rules, business-logic-model, frontend-components}.md: masonry spans K=40 rows per column width + 2 gap rows (CSS only), eager first 3, tile = link with modifier-click passthrough, lightbox rules (wrap, Home/End, swipe, phone bottom bar, crossfade 0.3 s, thumb while loading, visible error message, preload 2 each side, close on list change), filter bar rules, swipe rules, hero refactor. Added a pure lightboxReducer (not named in Application Design) so the open/close/browse state can be tested statefully (PBT-06). Properties per helper documented for PBT-01."
|
||||||
|
|
||||||
|
**Context**: CONSTRUCTION - Functional Design Unit 2 (awaiting approval)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Functional Design — Unit 2 — Approval
|
||||||
|
|
||||||
|
**Timestamp**: 2026-10-25T19:50:00Z
|
||||||
|
|
||||||
|
**User Input**: "Ga verder"
|
||||||
|
|
||||||
|
**AI Response**: "Functional design of unit 2 approved. Created construction/plans/gallery-blocks-code-generation-plan.md (20 steps: types, five pure helpers with example and property-based tests incl. a stateful reducer test, arbitraries, useSwipe + hero refactor, theme token and filterControl recipe, FilterBar, PortfolioGrid, Lightbox, fixtures, pnpm check, own RE lines, summary, one local commit)."
|
||||||
|
|
||||||
|
**Context**: CONSTRUCTION - Code Generation Unit 2 (plan awaiting approval)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Code Generation — Unit 2 — Plan Approval and Generation
|
||||||
|
|
||||||
|
**Timestamp**: 2026-10-25T21:30:00Z
|
||||||
|
|
||||||
|
**User Input**: "Approve plan"
|
||||||
|
|
||||||
|
**AI Response**: "Executed gallery-blocks-code-generation-plan.md steps 1–20: types, five pure helpers with example and property-based tests (incl. stateful lightboxReducer test), arbitraries, useSwipe + hero refactor (hero tests unchanged), theme token swap + filterControl recipe, FilterBar, PortfolioGrid (CSS-only masonry, verified generated CSS), Lightbox (Chakra Dialog), fixtures. ESLint set-state-in-effect errors fixed at the cause. jsdom limits handled explicitly in tests (focus trap needs layout boxes; exit needs animation events). Claimed/freed port 4173 with the remaining idle sessions. pnpm check: tests 80 files / 426 passed, desktop Lighthouse green; mobile Lighthouse failed on / (0.75, rerun 0.79 vs 0.8) and /contact (0.88 vs 0.9). Root cause checked: master on the same machine gives / 0.78 and /contact 0.88, main bundle grows 0.12 kB gzip — pre-existing budget issue, not a regression; surfaced to the user. Own RE lines updated; code summary written; committed locally (no push)."
|
||||||
|
|
||||||
|
**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)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Code Generation — Unit 3 — Approval; Build and Test Stage
|
||||||
|
|
||||||
|
**Timestamp**: 2026-10-28T09:00:00Z
|
||||||
|
|
||||||
|
**User Input**: "kan ik het via lan testen?" / "kan je committen en pushen en dan deployen naar test? Dan kan je de lokale server stoppen" / "start de ssh agent weer op" / "ssh key topegevoegd" / "ga verder naar Build en Test"
|
||||||
|
|
||||||
|
**AI Response**: "Served the build on the LAN (vite preview --host, http://192.168.1.2:4173) for the user's check, then stopped it. Everything was already committed; pushed feature/portfolio-page and dispatched the CI workflow with deploy_test (run 580: check, deploy-test, lighthouse all success; test.andreaslop.nl serves the portfolio). Restarted the ssh-agent after a reboot (no -t); the user added the key. Unit 3 approved. Build and Test: full test suite 82 files / 460 tests, coverage thresholds met (95.3% overall), build success; integration scenarios covered by route and gallery tests; Lighthouse: CI green, locally /portfolio 0.91 with pre-existing borderline pages unchanged versus master. Wrote construction/build-and-test/{build-instructions, unit-test-instructions, integration-test-instructions, performance-test-instructions, build-and-test-summary}.md."
|
||||||
|
|
||||||
|
**Build Status**: Success
|
||||||
|
**Test Status**: Pass
|
||||||
|
**Operations Phase Decision**: No (Decided At: Requirements Analysis)
|
||||||
|
|
||||||
|
**Context**: CONSTRUCTION - Build and Test (awaiting approval)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Build and Test — Approval; Workflow Complete
|
||||||
|
|
||||||
|
**Timestamp**: 2026-10-28T09:15:00Z
|
||||||
|
|
||||||
|
**User Input**: "continue to next stage"
|
||||||
|
|
||||||
|
**AI Response**: "Build and Test approved. Operations = No (Requirements Analysis), so the workflow completes: active-features.md → ✅ Complete, aidlc-state.md → Complete. Committed the Build and Test docs locally. Presented the Workflow Complete summary; push and PR only on the user's request."
|
||||||
|
|
||||||
|
**Context**: Workflow complete (no Operations phase)
|
||||||
|
|
||||||
|
---
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
# Build and Test Summary — Portfolio Page
|
||||||
|
|
||||||
|
## Build
|
||||||
|
- **Tool**: pnpm + Vite (`tsc && vite build`)
|
||||||
|
- **Status**: ✅ Success (9efa7fc)
|
||||||
|
- **Artifacts**: `web/dist/` — route chunk `portfolio-*.js` 2.6 kB gzip, lazy `Lightbox-*.js` 15.4 kB gzip, main bundle +0.1 kB gzip versus master
|
||||||
|
|
||||||
|
## Tests
|
||||||
|
| Kind | Result |
|
||||||
|
|---|---|
|
||||||
|
| Unit + component + property-based | ✅ 82 files, 460 tests; coverage thresholds met (100% `lib/**`, `seo.ts`, `sitemap.ts`; 95.3% overall) |
|
||||||
|
| Integration (route tests, gallery) | ✅ 6 scenarios, see integration-test-instructions.md |
|
||||||
|
| Accessibility (axe in tests; Lighthouse 1.0) | ✅ incl. the open lightbox |
|
||||||
|
| Performance (Lighthouse) | ✅ CI run 580 (mobile + desktop); locally `/portfolio` 0.91; pre-existing local borderline on `/`, `/soorten-fotoshoots`, `/contact` (same on master) |
|
||||||
|
| Security | ✅ no new dependencies; `?shoot=` allowlisted and never rendered (tested with `<script>`); CSP unchanged; `pnpm audit:deps` passes (dev-tool findings are informational, NFR-SEC-05) |
|
||||||
|
| E2E / browser | Deployed to test (run 580); reviewed by the user before this stage |
|
||||||
|
|
||||||
|
## Extension compliance
|
||||||
|
- **Security Baseline**: SECURITY-04, 05, 09, 10, 11, 13, 15 compliant; others N/A (no data stores, auth, server or infrastructure)
|
||||||
|
- **PBT**: PBT-01..10 compliant (properties identified in functional design, generators in `src/test/arbitraries.ts`, seed logging, example tests alongside)
|
||||||
|
|
||||||
|
## Overall
|
||||||
|
- **Build**: Success · **Tests**: Pass · **Operations phase**: No (decided at Requirements Analysis)
|
||||||
|
|
||||||
|
## Next
|
||||||
|
Open a PR from `feature/portfolio-page` to master. Merging deploys master to test; production stays a manual `release/*` step.
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
# Build Instructions — Portfolio Page
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
- **Build tool**: pnpm 12.11.2 (`packageManager` in `web/package.json`), Node 24
|
||||||
|
- **Dependencies**: from `web/pnpm-lock.yaml`; no new dependency in this feature
|
||||||
|
- **Environment variables**: none
|
||||||
|
- **System**: any OS supported by Node 24; Chrome for Lighthouse
|
||||||
|
|
||||||
|
## Build Steps
|
||||||
|
```bash
|
||||||
|
cd web
|
||||||
|
pnpm install --frozen-lockfile # also runs `chakra typegen` (theme: swap duration, filterControl recipe)
|
||||||
|
pnpm build # tsc && vite build
|
||||||
|
```
|
||||||
|
|
||||||
|
## Verify
|
||||||
|
- `dist/` with, among others, `assets/portfolio-*.js` (route, ~2.6 kB gzip), `assets/Lightbox-*.js` (lazy chunk, ~15.4 kB gzip), `assets/index-*.js` (main, ~150 kB gzip; +0.1 kB gzip versus master), 20 portfolio photos and `og-portfolio.jpg`
|
||||||
|
- `sitemap.xml` lists `/portfolio`
|
||||||
|
- Known warning: chunk size > 500 kB for the main bundle (pre-existing)
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
- **Type errors on Chakra tokens/recipes** after a theme change: run `pnpm typegen`.
|
||||||
|
- **Missing photos**: the assets are committed in `web/src/assets/portfolio/`; they were produced once with a local `System.Drawing` script (not part of the build).
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
# Integration Test Instructions — Portfolio Page
|
||||||
|
|
||||||
|
The units meet in the route tests (`web/src/app.test.tsx`, real route tree and router) and in `PortfolioGallery.test.tsx`; both run in `pnpm test`.
|
||||||
|
|
||||||
|
## Scenarios
|
||||||
|
| # | Units | Scenario | Covered by |
|
||||||
|
|---|---|---|---|
|
||||||
|
| 1 | 1 + 3 | `/portfolio` and `/` both render the shared `InstagramGrid`; without a valid Instagram link it is left out | `app.test.tsx` (portfolio, homepage) |
|
||||||
|
| 2 | 2 + 3 | Filter → grid → lightbox: filtered list, caption from the shoot type, counter within the filter, lightbox closes on a filter change | `PortfolioGallery.test.tsx` |
|
||||||
|
| 3 | 3 + router | `?shoot=gezin` starts filtered; `onzin`, `loveshoot`, `<script>` show "Alles"; choosing a filter replaces the URL (no history entry); canonical without parameters | `app.test.tsx` |
|
||||||
|
| 4 | 3 + Soorten fotoshoots | "Bekijk meer …foto's" only for newborn, zwangerschap, gezin while `/portfolio` is indexed | `app.test.tsx` (shoot types page) |
|
||||||
|
| 5 | 3 + SEO registry | `/portfolio` indexed, in the sitemap and in Lighthouse's indexed paths (sync test) | `app.test.tsx`, `sitemap.test.ts` |
|
||||||
|
| 6 | 2 + hero | Hero swipe and wrap unchanged after moving to `useSwipe` / `wrapIndex` | Hero tests (unchanged) |
|
||||||
|
|
||||||
|
## Manual check on test
|
||||||
|
After `deploy_test` (done: run 580), open https://test.andreaslop.nl/portfolio on desktop and phone: masonry 1/2/3 columns without shifting, filter row on one line, lightbox (tap, swipe, bottom bar on phones, Escape, focus back to the photo), and the three links on /soorten-fotoshoots.
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
# Performance Test Instructions — Portfolio Page
|
||||||
|
|
||||||
|
No load testing: static site. Performance is measured with Lighthouse CI.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd web
|
||||||
|
pnpm lighthouse # lhci autorun (mobile) && lhci autorun --config=lighthouserc.desktop.cjs
|
||||||
|
```
|
||||||
|
|
||||||
|
## Targets and results
|
||||||
|
| Page | Mobile target | Local result | CI (run 580, Pi) |
|
||||||
|
|---|---|---|---|
|
||||||
|
| `/portfolio` | 0.9 | 0.91 (dedicated runs) | ✅ pass |
|
||||||
|
| `/` | 0.8 | 0.77 (master 0.78) | ✅ pass |
|
||||||
|
| `/soorten-fotoshoots` | 0.85 | 0.84–0.86 (master 0.84) | ✅ pass |
|
||||||
|
| `/contact` | 0.9 | 0.87 (master 0.87) | ✅ pass |
|
||||||
|
| all pages, desktop | 0.9 | ✅ | ✅ pass |
|
||||||
|
|
||||||
|
Accessibility, best practices and SEO: 1.0 on every page (mobile and desktop).
|
||||||
|
|
||||||
|
## Findings fixed in this feature
|
||||||
|
- Filter bar re-wrapping when the web font loaded caused CLS 0.119 → single non-wrapping row, CLS 0.001
|
||||||
|
- Three eager (but fading-in) grid photos delayed the fonts and the intro text (LCP 4.5 s) → no eager photos, LCP 2.9 s (user decision)
|
||||||
|
|
||||||
|
## Known, pre-existing
|
||||||
|
Locally `/`, `/soorten-fotoshoots` and `/contact` sit at or just below their mobile budgets on this PC, equally on master; CI on the Pi passes. Tracked in the memory note "Open follow-ups".
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
# Unit Test Execution — Portfolio Page
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd web
|
||||||
|
pnpm test # vitest run with v8 coverage; fast-check seed is logged (config/testSeed.ts)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Expected
|
||||||
|
- 82 test files, 460 tests, 0 failures (as of 9efa7fc)
|
||||||
|
- Coverage thresholds met: 100% for `src/lib/**`, `src/seo.ts`, `src/sitemap.ts` (incl. the new `portfolioFilters`, `wrapIndex`, `swipeDirection`, `masonryRowSpan`, `neighbourIndexes`, `lightboxReducer`, `galleryImages`); overall 95.3% statements
|
||||||
|
- Property-based tests (PBT-02..07): round-trip (`wrapIndex`, `shootFromSearch`), invariants, idempotence (`filterPhotos`, `wrapIndex`), oracles (`neighbourIndexes`, `shootTypesWithPhotos`, `toGalleryItems`), stateful (`lightboxReducer`); a failure prints the seed and the shrunk counterexample — rerun with that seed
|
||||||
|
|
||||||
|
## jsdom limits handled in tests (documented in the test files)
|
||||||
|
- The dialog's focus trap needs layout boxes: the focus test stubs `getClientRects`
|
||||||
|
- Chakra removes a closed dialog after its fade-out, which needs real animation events: tests check `data-state="closed"` and the callbacks
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
# Code Summary — Unit 2: Gallery building blocks
|
||||||
|
|
||||||
|
Plan: [gallery-blocks-code-generation-plan.md](../../plans/gallery-blocks-code-generation-plan.md) · Design: [functional-design/](../functional-design/)
|
||||||
|
|
||||||
|
## Created (`web/src/`)
|
||||||
|
| File | What |
|
||||||
|
|---|---|
|
||||||
|
| `lib/wrapIndex.ts` (+ test) | Position that wraps both ways; PBT: range, periodicity, idempotence, round-trip, oracle (step-by-step) |
|
||||||
|
| `lib/swipeDirection.ts` (+ test) | `next`/`prev`/`null` from two touch points, `SWIPE_THRESHOLD = 50`; PBT: mirror, translation, threshold rule |
|
||||||
|
| `lib/masonryRowSpan.ts` (+ test) | Row span from aspect ratio (`ROWS_PER_COLUMN_WIDTH = 40`, `GAP_ROWS = 2`); PBT: minimum, monotonic, scale invariance, ≤ ½ row crop |
|
||||||
|
| `lib/neighbourIndexes.ts` (+ test) | Large photos to preload around the current one; PBT: unique, excludes current, size, oracle (brute force) |
|
||||||
|
| `lib/lightboxReducer.ts` (+ test) | Lightbox state machine; stateful PBT against a model |
|
||||||
|
| `hooks/useSwipe.ts` (+ test) | Touch handlers on top of `swipeDirection` |
|
||||||
|
| `recipes/filterControl.ts` | Eyebrow-style toggle button, pressed = `accent.deep` + 2 px underline |
|
||||||
|
| `components/FilterBar/` (+ test) | Group of toggle buttons with `aria-pressed`; nothing for < 2 options |
|
||||||
|
| `components/PortfolioGrid/` (+ test) | CSS-only masonry in reading order (`--cols`, `--row` in container units), first 3 eager with `fetchPriority="high"`, tile = link to the large photo, modifier clicks left to the browser, `onIntent` once |
|
||||||
|
| `components/Lightbox/` (+ test) | Chakra `Dialog` (unstyled), wrap-around browsing with buttons/arrows/Home/End/swipe, counter, caption, announcement, thumb while loading, error note, preload 2 each side, phone bottom bar, crossfade (0.3 s, off under reduced motion); default export for `React.lazy` |
|
||||||
|
| `test/galleryFixtures.ts` | Gallery items from the homepage intro photos |
|
||||||
|
|
||||||
|
## Modified
|
||||||
|
| File | Change |
|
||||||
|
|---|---|
|
||||||
|
| `content/types.ts` | `ImageSource`, `GalleryItem`, `FilterOption` |
|
||||||
|
| `test/arbitraries.ts` | `point`, `imageSize`, `galleryItem`, `galleryItems`, `lightboxEvent` |
|
||||||
|
| `theme.ts` | Duration token `swap` (0.3 s); recipe `filterControl` registered (typegen run) |
|
||||||
|
| `components/Hero/useHeroSlider.ts` | Uses `useSwipe` (enabled with more than one slide) and `wrapIndex`; inline touch handlers and local threshold removed. Hero tests unchanged and passing |
|
||||||
|
|
||||||
|
Docs: own RE lines (code-structure, architecture, api-documentation).
|
||||||
|
|
||||||
|
## Verification
|
||||||
|
- `tsc`, ESLint, Prettier: clean. ESLint flagged `setState` inside effects in the first Lightbox version; fixed at the cause (load state lives in the keyed `Photo`; announcement reset during render when `open` changes), not by disabling the rule.
|
||||||
|
- Tests: ✅ 80 files, 426 tests (coverage thresholds met).
|
||||||
|
- Generated masonry CSS checked in jsdom: `--cols` 1/2/3 per breakpoint, `--row` uses `var(--slp-spacing-grid-gap)`, tiles `span n`, photo height `100% - 2 × --row`.
|
||||||
|
- jsdom limits, handled in the tests with comments: the focus trap needs layout boxes (focus test stubs `getClientRects`); Chakra unmounts after the fade-out, which needs real animation events, so the close test checks `data-state="closed"` and `onClose`.
|
||||||
|
- Lighthouse desktop: ✅ all 7 URLs.
|
||||||
|
- Lighthouse mobile: ❌ `/` (0.75, rerun 0.79; budget 0.8) and `/contact` (0.88; budget 0.9). **Pre-existing, not caused by this unit**: master measured right before on the same machine gives `/` 0.78 and `/contact` 0.88; this unit adds 0.54 kB (0.12 kB gzip) to the main bundle and no route of these pages renders the new components. Known open item (memory note "Open follow-ups", owner chose to handle it separately). Portfolio itself was not measured as a real page yet (still the placeholder until unit 3).
|
||||||
|
- Visual check: deferred to unit 3 (the components are on no page yet).
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
# Business Logic Model — Unit 2: Gallery building blocks
|
||||||
|
|
||||||
|
## Flow — open, browse, close
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
sequenceDiagram
|
||||||
|
box rgba(246,224,94,0.4) Visitor
|
||||||
|
participant V as Visitor
|
||||||
|
end
|
||||||
|
box rgba(99,179,237,0.4) Components
|
||||||
|
participant G as PortfolioGrid
|
||||||
|
participant P as Parent
|
||||||
|
participant L as Lightbox
|
||||||
|
end
|
||||||
|
V->>G: hover or focus a tile
|
||||||
|
G->>P: onIntent once
|
||||||
|
P->>P: start loading the lightbox code
|
||||||
|
V->>G: click tile n
|
||||||
|
G->>P: onOpen with index n
|
||||||
|
P->>L: render with index n
|
||||||
|
L->>L: focus close button, show thumb, load full, preload two each side
|
||||||
|
V->>L: arrow, Home, End or swipe
|
||||||
|
L->>P: onIndexChange with the wrapped index
|
||||||
|
L->>V: announce position and caption
|
||||||
|
V->>L: Escape, close button or backdrop
|
||||||
|
L->>P: onClose
|
||||||
|
P->>G: focus the tile of the last shown item
|
||||||
|
```
|
||||||
|
|
||||||
|
Text alternative: hovering or focusing a tile asks the parent to load the lightbox code; clicking a tile opens the lightbox at that index; the lightbox focuses its close button, shows the thumb while the large image and its neighbours load; browsing reports the wrapped index to the parent and announces the position; closing returns focus to the tile of the last shown item.
|
||||||
|
|
||||||
|
## Lightbox State Machine
|
||||||
|
|
||||||
|
The parent owns the state (application design: `PortfolioGallery` owns the open item). A pure reducer `lightboxReducer(state, event)` makes the transitions testable.
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
graph TD
|
||||||
|
Closed["closed"] -->|"open(i, count), count at least 1"| Open["open at index i"]
|
||||||
|
Open -->|"next / prev"| Open
|
||||||
|
Open -->|"first / last"| Open
|
||||||
|
Open -->|"close"| Closed
|
||||||
|
Open -->|"listChanged(count)"| Closed
|
||||||
|
Closed -->|"next, prev, first, last, close, listChanged"| Closed
|
||||||
|
classDef state fill:#2196F3,stroke:#0d47a1,color:#000;
|
||||||
|
class Closed,Open state;
|
||||||
|
```
|
||||||
|
|
||||||
|
Text alternative: a closed lightbox opens at an index when the list is not empty; while open, next/prev/first/last stay open at a new index and close or a list change closes it; every other event leaves a closed lightbox closed.
|
||||||
|
|
||||||
|
Rules: `open(i, count)` clamps `i` into range with `wrapIndex`; `count = 0` keeps it closed. `next`/`prev` use `wrapIndex(index ± 1, count)`; `first` → 0; `last` → count − 1.
|
||||||
|
|
||||||
|
## Pure Helpers and Testable Properties (PBT-01)
|
||||||
|
|
||||||
|
All in `web/src/lib/`, 100% coverage threshold, example-based tests plus property-based tests with generators in `src/test/arbitraries.ts` (PBT-07).
|
||||||
|
|
||||||
|
| Helper | Purpose | Properties (category) |
|
||||||
|
|---|---|---|
|
||||||
|
| `wrapIndex(index, count)` | Position in `0..count−1`, wrapping both ways | Result in range for any integer index and count ≥ 1 (invariant); `wrapIndex(wrapIndex(i)+1)−1` returns to `wrapIndex(i)` (round-trip); `wrapIndex(i + k·count) = wrapIndex(i)` (invariant, periodicity); `wrapIndex(wrapIndex(i)) = wrapIndex(i)` (idempotence); equals `((i % c) + c) % c` (oracle) |
|
||||||
|
| `swipeDirection(start, end, threshold = 50)` | `'next'`, `'prev'` or `null` | Mirroring dx flips `next` ↔ `prev` (invariant); below threshold or more vertical than horizontal → `null` (invariant); translating both points by the same offset does not change the result (invariant) |
|
||||||
|
| `masonryRowSpan({ width, height }, K = 40, gapRows = 2)` | Implicit rows an item spans | Always ≥ gapRows + 1 (range); non-decreasing in height/width (invariant, monotonic); scaling width and height by the same factor gives the same span (invariant); `|span − gapRows − K·h/w| ≤ 0.5` (easy verification) |
|
||||||
|
| `neighbourIndexes(index, count, radius = 2)` | Large images to preload | No duplicates, never contains `index`, all in range (invariant); size = `min(2·radius, count − 1)` (invariant); symmetric: contains `wrapIndex(index ± d)` for d ≤ radius when count is large enough (oracle against a brute-force set) |
|
||||||
|
| `lightboxReducer(state, event)` | Lightbox transitions | Stateful PBT: random event sequences against a simple model (`{open, index}` with modular arithmetic) — after every event the states match and an open index is in range (PBT-06) |
|
||||||
|
|
||||||
|
Components with no extra properties beyond these helpers: `PortfolioGrid`, `Lightbox`, `FilterBar` (presentational; example-based tests and axe cover them — PBT-10 complementary).
|
||||||
|
|
||||||
|
## Hero Refactor
|
||||||
|
- `useHeroSlider.go(to)` uses `wrapIndex(to, count)` instead of `(to + count) % count` (same results for the values it receives).
|
||||||
|
- Its inline `onTouchStart`/`onTouchEnd` are replaced by `useSwipe({ onPrev: prev, onNext: next, enabled: count > 1 })`. Existing hero tests must pass unchanged (oracle: today's behaviour).
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
# Business Rules — Unit 2: Gallery building blocks
|
||||||
|
|
||||||
|
Decisions: [gallery-blocks-fd-questions.md](../../plans/gallery-blocks-fd-questions.md) (answered 2026-10-25), requirements FR-PF-03, 05–07, NFR-PF-01/02/05, application design Q1–Q7.
|
||||||
|
|
||||||
|
## Grid (`PortfolioGrid`)
|
||||||
|
- **BR-GR-01 Order**: items render in the given order as `ul > li`; DOM, tab and reading order follow it (row order, left to right).
|
||||||
|
- **BR-GR-02 Columns**: 1 column on phones, 2 from `md`, 3 from `lg` (the design's 2/3 steps on the theme breakpoints); column gap `gridGap`.
|
||||||
|
- **BR-GR-03 Row span**: each item spans `masonryRowSpan(thumb) = round(K × height / width) + GAP_ROWS` implicit rows, with implicit row height = column width / K (container units). The photo fills the item minus the gap rows with `object-fit: cover`; the crop from rounding is at most half a row (≤ 1.25% of the height). No JavaScript measuring (Q6/6a).
|
||||||
|
- **BR-GR-04 Loading**: the first `EAGER_COUNT` (3) items of the list as given load immediately with `fetchPriority="high"`; the rest use `DeferredImage`. Intrinsic width/height on every image.
|
||||||
|
- **BR-GR-05 Tile = link**: each tile is `<a href={full.src}>`. A plain click or Enter calls `onOpen(index)` and prevents navigation. A click with Ctrl/Cmd/Shift/Alt or the middle button is left to the browser (opens the large image as a normal link). Without JavaScript the link opens the large image.
|
||||||
|
- **BR-GR-06 Name**: accessible name = alt text + " (groot bekijken)" (visually hidden suffix). *Q6 = A*
|
||||||
|
- **BR-GR-07 Intent**: the first pointer enter or focus on any tile calls `onIntent()` once per mount (preload the lightbox code).
|
||||||
|
- **BR-GR-08 Hover/focus**: zoom 1.05 + dark overlay (design `.portfolio-item`), `cursor: zoom-in`; under reduced motion no zoom, overlay only. The focus ring sits above neighbouring tiles.
|
||||||
|
- **BR-GR-09 List change**: when the list changes (another filter), tiles swap immediately without animation; tiles that were never in view show at once (no fade-in replay). *Q9 = A*
|
||||||
|
- **BR-GR-10 Empty list**: renders an empty list (no tiles, no error); the page decides whether to show the grid at all.
|
||||||
|
|
||||||
|
## Lightbox (`Lightbox`)
|
||||||
|
- **BR-LB-01 Dialog**: Chakra `Dialog`, modal, named "Foto groot bekijken" (overridable); background inert, page does not scroll; dark backdrop.
|
||||||
|
- **BR-LB-02 Image**: the current item's `full` image, whole (`object-fit: contain`), within the viewport; alt text from `thumb.alt`.
|
||||||
|
- **BR-LB-03 Navigation**: next/previous wrap around (`wrapIndex`); Home → first, End → last (*Q10 = A*); ← → as previous/next; swipe left = next, swipe right = previous (`swipeDirection`, threshold 50 px, |dx| ≥ |dy|). No swipe-down to close (*Q4 = A*).
|
||||||
|
- **BR-LB-04 Closing**: close button, Escape, click on the backdrop. Click/tap on the image itself does nothing (*Q3 = A*).
|
||||||
|
- **BR-LB-05 Controls layout**: phones: bottom bar "vorige · teller · volgende", close top right; from `md`: previous/next at the left and right edges halfway, close top right, counter under the image (design). Controls never cover the image on phones. All targets ≥ 44 × 44 px. *Q2 = A*
|
||||||
|
- **BR-LB-06 Counter and caption**: counter "n / total" (1-based); caption = `item.caption` when present. With one item: no previous/next, no counter, no Home/End/arrow handling.
|
||||||
|
- **BR-LB-07 Announcement**: after every navigation (not on open), a polite live region says "Foto n van total" plus ", {caption}" when there is a caption. *Q5 = A*
|
||||||
|
- **BR-LB-08 Focus**: on open, focus goes to the close button; Tab cycles inside the dialog; on close, focus returns to the grid tile of the item shown last (via the parent's `finalFocus`).
|
||||||
|
- **BR-LB-09 List change while open**: if the list changes (another filter) while open, the lightbox closes (the parent resets `index` to `null`). The state reducer treats `listChanged` the same way.
|
||||||
|
- **BR-LB-10 Transition**: a short crossfade (~0.3 s) on open, close and item change; none under `prefers-reduced-motion`. *Q1 = A*
|
||||||
|
- **BR-LB-11 Loading**: while the large image loads, the thumb (already cached) is shown in its place at the same size; no empty flash, no layout jump.
|
||||||
|
- **BR-LB-12 Load error**: if the large image fails, the thumb stays and a short message "Deze foto kon niet groot geladen worden" appears under it (in the caption area, polite live region); browsing keeps working and the message disappears on the next item. *Q7 = B*
|
||||||
|
- **BR-LB-13 Preloading**: while open, the large images of up to `PRELOAD_RADIUS` (2) items on each side (wrapping, no duplicates, never the current one) are requested. *Q8 = B*
|
||||||
|
|
||||||
|
## Filter bar (`FilterBar`)
|
||||||
|
- **BR-FB-01 Options**: one toggle button per option in the given order; exactly one is pressed (`aria-pressed="true"`), the one whose `id` equals `value`.
|
||||||
|
- **BR-FB-02 Group**: `role="group"` with an accessible name (prop `label`); every button is a tab stop.
|
||||||
|
- **BR-FB-03 Fewer than two options**: render nothing.
|
||||||
|
- **BR-FB-04 Choosing**: clicking (or Enter/Space on) a button that is not pressed calls `onChange(id)`; clicking the pressed one does nothing. Focus stays on the button.
|
||||||
|
- **BR-FB-05 Style**: eyebrow text style; pressed = `accent.deep` with a 2 px underline; others `ink.soft`; hover darkens to `ink`. Contrast ≥ 4.5:1 for text, ≥ 3:1 for the underline against `paper`. Targets ≥ 44 px high.
|
||||||
|
- **BR-FB-06 Unknown value**: if `value` matches no option, no button is pressed (the page must pass a valid value; unit 3 guarantees it).
|
||||||
|
|
||||||
|
## Swipe (`useSwipe`, `swipeDirection`)
|
||||||
|
- **BR-SW-01**: a swipe counts when |dx| ≥ 50 px and |dx| ≥ |dy|; dx < 0 → `next`, dx > 0 → `prev`; otherwise nothing.
|
||||||
|
- **BR-SW-02**: a touch end without a recorded start does nothing; the start is cleared after every touch end.
|
||||||
|
- **BR-SW-03 Hero**: `useHeroSlider` uses `useSwipe` and `wrapIndex`; its swipe and wrap behaviour are unchanged (existing hero tests pass unchanged). The hero keeps its own rule that swiping does nothing with fewer than two slides (`enabled`).
|
||||||
|
|
||||||
|
## Decision Flow — a key press in the open lightbox
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
graph TD
|
||||||
|
Key["Key press"] --> Esc{"Escape?"}
|
||||||
|
Esc -->|"yes"| Close["Close (Chakra)"]
|
||||||
|
Esc -->|"no"| Many{"More than one item?"}
|
||||||
|
Many -->|"no"| Ignore["Ignore"]
|
||||||
|
Many -->|"yes"| Which{"Which key?"}
|
||||||
|
Which -->|"ArrowRight"| Next["wrapIndex(index + 1)"]
|
||||||
|
Which -->|"ArrowLeft"| Prev["wrapIndex(index - 1)"]
|
||||||
|
Which -->|"Home"| First["index 0"]
|
||||||
|
Which -->|"End"| Last["index count - 1"]
|
||||||
|
Which -->|"other"| Ignore
|
||||||
|
Next --> Announce["Announce position and caption"]
|
||||||
|
Prev --> Announce
|
||||||
|
First --> Announce
|
||||||
|
Last --> Announce
|
||||||
|
classDef decision fill:#FF9800,stroke:#e65100,color:#000;
|
||||||
|
classDef action fill:#2196F3,stroke:#0d47a1,color:#000;
|
||||||
|
classDef stop fill:#e2e8f0,stroke:#4a5568,color:#000;
|
||||||
|
class Esc,Many,Which decision;
|
||||||
|
class Close,Next,Prev,First,Last,Announce action;
|
||||||
|
class Ignore stop;
|
||||||
|
```
|
||||||
|
|
||||||
|
Text alternative: Escape always closes; with a single item other keys are ignored; otherwise the arrow keys wrap to the next or previous item, Home and End jump to the first and last, any other key is ignored, and every move is announced with position and caption.
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
# Domain Entities — Unit 2: Gallery building blocks
|
||||||
|
|
||||||
|
Generic entities only; nothing here knows about shoot types, filters on the portfolio, or the URL (that is unit 3).
|
||||||
|
|
||||||
|
## Relationships
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
graph TD
|
||||||
|
Item["GalleryItem"] -->|"thumb"| Thumb["ContentImage (grid size, alt)"]
|
||||||
|
Item -->|"full"| Full["ImageSource (lightbox size)"]
|
||||||
|
Item -->|"caption?"| Caption["visible caption text"]
|
||||||
|
Grid["PortfolioGrid"] -->|"shows list of"| Item
|
||||||
|
Box["Lightbox"] -->|"shows one of"| Item
|
||||||
|
Box -->|"driven by"| State["LightboxState"]
|
||||||
|
Filter["FilterBar"] -->|"offers list of"| Option["FilterOption"]
|
||||||
|
Swipe["useSwipe"] -->|"compares"| Points["two Points"]
|
||||||
|
classDef entity fill:#2196F3,stroke:#0d47a1,color:#000;
|
||||||
|
classDef comp fill:#4CAF50,stroke:#2e7d32,color:#000;
|
||||||
|
classDef value fill:#e2e8f0,stroke:#4a5568,color:#000;
|
||||||
|
class Item,State,Option entity;
|
||||||
|
class Grid,Box,Filter,Swipe comp;
|
||||||
|
class Thumb,Full,Caption,Points value;
|
||||||
|
```
|
||||||
|
|
||||||
|
Text alternative: a GalleryItem has a grid image with alt text, a large image and an optional caption; the grid shows a list of items, the lightbox shows one item at a time driven by a LightboxState; the filter bar offers FilterOptions; useSwipe compares two touch points.
|
||||||
|
|
||||||
|
## Entities
|
||||||
|
|
||||||
|
### GalleryItem
|
||||||
|
| Field | Type | Rule |
|
||||||
|
|---|---|---|
|
||||||
|
| `id` | `string` | Unique within a list; used as React key and test id suffix |
|
||||||
|
| `thumb` | `ContentImage` (`src`, `alt`, `width`, `height`) | Grid size (~800 px wide), photo's own aspect ratio; `alt` is the description for both sizes |
|
||||||
|
| `full` | `ImageSource` (`src`, `width`, `height`) | Lightbox size (~1600–2000 px); same aspect ratio as `thumb` (± rounding) |
|
||||||
|
| `caption?` | `string` | Visible under the large image; empty or missing → no caption element |
|
||||||
|
|
||||||
|
### ImageSource
|
||||||
|
`{ src: string; width: number; height: number }` — `width`, `height` positive integers (intrinsic size).
|
||||||
|
|
||||||
|
### FilterOption
|
||||||
|
| Field | Type | Rule |
|
||||||
|
|---|---|---|
|
||||||
|
| `id` | `string` | Unique within the options |
|
||||||
|
| `label` | `string` | Visible text (Dutch) |
|
||||||
|
|
||||||
|
### LightboxState
|
||||||
|
A closed lightbox, or an open one at a position in the current list.
|
||||||
|
|
||||||
|
| Variant | Shape | Meaning |
|
||||||
|
|---|---|---|
|
||||||
|
| closed | `{ open: false }` | No dialog |
|
||||||
|
| open | `{ open: true; index: number; count: number }` | Showing item `index` of a list of `count` (0 ≤ index < count, count ≥ 1) |
|
||||||
|
|
||||||
|
Events: `open(index, count)`, `next`, `prev`, `first`, `last`, `close`, `listChanged(count)` (see business-rules BR-LB-09).
|
||||||
|
|
||||||
|
### Point
|
||||||
|
`{ x: number; y: number }` — a touch position in CSS pixels (start and end of a swipe).
|
||||||
|
|
||||||
|
### Masonry dimensions
|
||||||
|
| Name | Value | Meaning |
|
||||||
|
|---|---|---|
|
||||||
|
| `ROWS_PER_COLUMN_WIDTH` (K) | 40 | One implicit grid row is 1/40 of the column width |
|
||||||
|
| `GAP_ROWS` | 2 | Vertical gap between photos, in rows (≈ 5% of the column width) |
|
||||||
|
| `EAGER_COUNT` | 3 | First items in the list that load immediately |
|
||||||
|
| `PRELOAD_RADIUS` | 2 | Large images preloaded on each side of the current one |
|
||||||
|
| `SWIPE_THRESHOLD` | 50 px | Minimum horizontal travel for a swipe (same as the hero today) |
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
# Frontend Components — Unit 2: Gallery building blocks
|
||||||
|
|
||||||
|
## Component Hierarchy (unit 2 parts, with the unit 3 parent for context)
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
graph TD
|
||||||
|
Parent["PortfolioGallery (unit 3, owns index)"] --> Filter["FilterBar"]
|
||||||
|
Parent --> Grid["PortfolioGrid"]
|
||||||
|
Parent --> Lazy["Suspense + lazy Lightbox"]
|
||||||
|
Grid --> Tile["tile link per item"]
|
||||||
|
Tile --> Deferred["DeferredImage or eager Image"]
|
||||||
|
Lazy --> Box["Lightbox"]
|
||||||
|
Box --> Dialog["Chakra Dialog"]
|
||||||
|
Box --> Figure["figure: image, caption, error message"]
|
||||||
|
Box --> Controls["close, previous, next, counter"]
|
||||||
|
Box --> Live["live region"]
|
||||||
|
Box --> SwipeHook["useSwipe"]
|
||||||
|
Hero["Hero / useHeroSlider"] --> SwipeHook
|
||||||
|
classDef root fill:#4CAF50,stroke:#2e7d32,color:#000;
|
||||||
|
classDef ui fill:#2196F3,stroke:#0d47a1,color:#000;
|
||||||
|
classDef hook fill:#9C27B0,stroke:#4a148c,color:#000;
|
||||||
|
class Parent root;
|
||||||
|
class Filter,Grid,Tile,Deferred,Lazy,Box,Dialog,Figure,Controls,Live,Hero ui;
|
||||||
|
class SwipeHook hook;
|
||||||
|
```
|
||||||
|
|
||||||
|
Text alternative: the unit 3 parent renders the FilterBar, the PortfolioGrid with one link tile per item, and the lazily loaded Lightbox inside Suspense; the Lightbox wraps a Chakra Dialog with the figure, the controls and a live region and uses useSwipe, which the hero also uses.
|
||||||
|
|
||||||
|
## PortfolioGrid
|
||||||
|
- **Props**: `items: readonly GalleryItem[]`, `eagerCount = 3`, `onOpen(index)`, `onIntent?()`, `'data-testid'?` (default `portfolio-grid`)
|
||||||
|
- **State**: none except a ref "intent already reported"
|
||||||
|
- **Markup**: wrapper with `container-type: inline-size`; `ul` grid (columns per BR-GR-02, `grid-auto-rows` = column width / 40 via `cqi`); `li` with `gridRowEnd: span {masonryRowSpan}`; `a` (`data-testid="portfolio-tile-{n}"`, 1-based) → image (`Image` with `fetchPriority="high"` for n ≤ eagerCount, else `DeferredImage`) + `VisuallyHidden` " (groot bekijken)"
|
||||||
|
- **Styling**: overlay via `_after`, zoom via `_groupHover`/`_groupFocusVisible` like `InstagramGrid`; `_motionReduce` removes zoom; `Reveal` around the list (not per tile, so a filter change does not replay fades — BR-GR-09)
|
||||||
|
|
||||||
|
## Lightbox
|
||||||
|
- **Props**: `items`, `index: number | null`, `onIndexChange(index)`, `onClose()`, `label = 'Foto groot bekijken'`, `finalFocusEl?: () => HTMLElement | null`
|
||||||
|
- **Internal state**: `loaded`/`failed` for the current full image (reset on index change); announcement text
|
||||||
|
- **Markup**: `Dialog.Root` (controlled `open={index !== null}`, `onOpenChange` → `onClose`, `initialFocusEl` → close button, `finalFocusEl`), `Dialog.Backdrop` (dark), `Dialog.Positioner` → `Dialog.Content` (`data-testid="lightbox"`) with: `figure` (image, `figcaption` with caption or the error message), close button (`lightbox-close`), previous (`lightbox-prev`), next (`lightbox-next`), counter (`lightbox-counter`), visually hidden live region (`aria-live="polite"`)
|
||||||
|
- **Buttons**: `iconControl` recipe on the dark backdrop (white, focus ring white), 44 px min; labels "Sluiten", "Vorige foto", "Volgende foto"; icons from `@iconify-icons/ant-design` (already a dependency)
|
||||||
|
- **Keyboard**: per the decision flow in business-rules (Escape via Chakra)
|
||||||
|
- **Swipe**: `useSwipe` handlers on the figure
|
||||||
|
- **Preloading**: `new Image().src = full.src` for `neighbourIndexes(index, count, 2)` while open
|
||||||
|
- **Theme**: a new duration token `swap` (0.3 s) for the crossfade; the dialog's z-index from Chakra's `modal` layer, above the header (verified in tests/visually)
|
||||||
|
|
||||||
|
## FilterBar
|
||||||
|
- **Props**: `options: readonly FilterOption[]`, `value: string`, `onChange(id)`, `label: string`
|
||||||
|
- **Markup**: `div role="group" aria-label={label}` (`data-testid="filter-bar"`) → `button type="button" aria-pressed` per option (`data-testid="filter-{id}"`)
|
||||||
|
- **Styling**: new recipe `filterControl` (eyebrow text style, pressed state per BR-FB-05)
|
||||||
|
|
||||||
|
## useSwipe
|
||||||
|
- **Signature**: `useSwipe({ onPrev, onNext, enabled = true }) → { onTouchStart, onTouchEnd }`
|
||||||
|
- **State**: a ref with the start point
|
||||||
|
|
||||||
|
## Accessibility Summary
|
||||||
|
| Element | Name | Role/state |
|
||||||
|
|---|---|---|
|
||||||
|
| Grid tile | alt + " (groot bekijken)" | link |
|
||||||
|
| Lightbox | "Foto groot bekijken" | dialog, modal |
|
||||||
|
| Lightbox buttons | "Sluiten", "Vorige foto", "Volgende foto" | button |
|
||||||
|
| Counter | visible "3 / 10" | text (announcement carries "Foto 3 van 10") |
|
||||||
|
| Live region | — | `aria-live="polite"`: position + caption, or the load error |
|
||||||
|
| Filter group | prop `label` | group of buttons with `aria-pressed` |
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
# Code Generation Plan — Unit 2: Gallery building blocks
|
||||||
|
|
||||||
|
Single source of truth for code generation of this unit. Workspace root: `K:\Development\SlpSoftware\Projects\AndreaSlopFotografie-portfolio` (worktree); all code in `web/src/`. Branch `feature/portfolio-page` (on master 1bf28cb).
|
||||||
|
|
||||||
|
## Unit Context
|
||||||
|
- **Requirements**: FR-PF-03 (filter bar), FR-PF-05 (masonry grid), FR-PF-06 (lightbox), FR-PF-07 (image loading), NFR-PF-01 (accessibility), NFR-PF-02 (reuse, generic APIs, helpers in `lib/`), NFR-PF-03 (example + property-based tests), NFR-PF-05 (performance)
|
||||||
|
- **Design**: [application design](../../inception/application-design/application-design.md) (unit 2 row), [functional design](../gallery-blocks/functional-design/) — business rules BR-GR/LB/FB/SW, state machine, helper properties
|
||||||
|
- **Dependencies**: none on unit 3 or other features. Unit 3 (`PortfolioGallery`, route) builds on everything here. Components are tested with fixture data; they are not on a page yet
|
||||||
|
- **Touches existing code**: `components/Hero/useHeroSlider.ts` (swipe + wrap extracted; behaviour unchanged), `theme.ts` (one duration token, one recipe), `content/types.ts`, `test/arbitraries.ts`
|
||||||
|
- **Comments in English** in new code and in new comments in existing files
|
||||||
|
|
||||||
|
## Steps
|
||||||
|
|
||||||
|
### Types and pure helpers (`lib/`, 100% coverage, example + PBT)
|
||||||
|
- [x] **Step 1** — `content/types.ts`: `ImageSource`, `GalleryItem`, `FilterOption` (domain-entities.md).
|
||||||
|
- [x] **Step 2** — `lib/wrapIndex.ts` + `wrapIndex.test.ts`: examples (−1, count, large negatives) and properties: range, periodicity, idempotence, next-then-previous round-trip, oracle `((i % c) + c) % c`.
|
||||||
|
- [x] **Step 3** — `lib/swipeDirection.ts` (exports `SWIPE_THRESHOLD = 50`) + test: examples (left, right, short, vertical, exactly 50) and properties: mirror flips, translation invariance, below threshold / more vertical → `null`.
|
||||||
|
- [x] **Step 4** — `lib/masonryRowSpan.ts` (exports `ROWS_PER_COLUMN_WIDTH = 40`, `GAP_ROWS = 2`) + test: examples (portrait 2:3, landscape 3:2, square) and properties: minimum, monotonic in h/w, scale invariance, `|span − gapRows − K·h/w| ≤ 0.5`.
|
||||||
|
- [x] **Step 5** — `lib/neighbourIndexes.ts` + test: examples (count 1, 2, 3, 10) and properties: no duplicates, excludes index, in range, size `min(2·radius, count − 1)`, oracle against a brute-force set.
|
||||||
|
- [x] **Step 6** — `lib/lightboxReducer.ts` (`LightboxState`, `LightboxEvent`, `closedLightbox`) + test: examples per transition and a stateful property: random event sequences against a model; open index always in range.
|
||||||
|
- [x] **Step 7** — `test/arbitraries.ts`: `imageSize` (positive integer width/height within realistic photo bounds), `galleryItem` / `galleryItems` (unique ids), `lightboxEvent`.
|
||||||
|
|
||||||
|
### Hook and hero refactor
|
||||||
|
- [x] **Step 8** — `hooks/useSwipe.ts` + `useSwipe.test.tsx`: calls `onNext`/`onPrev` per `swipeDirection`, nothing when `enabled` is false or without a start, start cleared after each end.
|
||||||
|
- [x] **Step 9** — `components/Hero/useHeroSlider.ts`: use `useSwipe({ onPrev: prev, onNext: next, enabled: count > 1 })` and `wrapIndex` in `go`; remove the inline touch handlers and the local threshold. Existing hero tests pass unchanged.
|
||||||
|
|
||||||
|
### Theme
|
||||||
|
- [x] **Step 10** — `theme.ts`: duration token `swap` (0.3 s, lightbox crossfade); new recipe `recipes/filterControl.ts` (eyebrow style, pressed state `accent.deep` + 2 px underline, hover `ink`, min height 44 px) registered under `recipes`; run `pnpm typegen`.
|
||||||
|
|
||||||
|
### Components (example-based tests + axe)
|
||||||
|
- [x] **Step 11** — `components/FilterBar/FilterBar.tsx` + test: group name, one pressed button, order, `onChange` only for a non-pressed button, nothing rendered for < 2 options, no button pressed for an unknown value, axe clean.
|
||||||
|
- [x] **Step 12** — `components/PortfolioGrid/PortfolioGrid.tsx` + test: list in order, tile names (alt + " (groot bekijken)"), href = full image, first 3 eager with `fetchpriority="high"` and the rest deferred, row spans from `masonryRowSpan`, plain click → `onOpen(index)` + prevented, Ctrl/Meta click not intercepted, `onIntent` once, empty list, axe clean.
|
||||||
|
- [x] **Step 13** — `components/Lightbox/Lightbox.tsx` (default export, for `React.lazy`) + test: closed renders nothing; open shows the item's full image with alt, caption, counter; next/prev buttons and keys wrap; Home/End; Escape and close button call `onClose`; image click does nothing; single item hides prev/next/counter; announcement text after navigation; load error shows the message and keeps the thumb; neighbours preloaded (2 each side); focus on the close button when opened; axe clean while open.
|
||||||
|
- [x] **Step 14** — `test/galleryFixtures.ts`: a few `GalleryItem`s built from existing assets (home intro photos) for the component tests.
|
||||||
|
|
||||||
|
### Verification and docs
|
||||||
|
- [x] **Step 15** — Search: no leftover inline swipe code or `SWIPE_THRESHOLD` duplicate in the hero; no duplicate component files.
|
||||||
|
- [x] **Step 16** — Check ListAgents for parallel sessions and follow the 4173 protocol if any is active; run `pnpm check` in `web/` (lint, format, build, tests with coverage, audits, Lighthouse). Fix and rerun until green. *Outcome: all green except mobile Lighthouse on `/` and `/contact`, which fail identically on master (pre-existing budget issue); see code summary.*
|
||||||
|
- [x] **Step 17** — Visual check: the components are not on a page yet; their look is verified in unit 3 (browser check on the portfolio page). The hero swipe is covered by its unchanged tests.
|
||||||
|
- [x] **Step 18** — Update the reverse engineering lines for the new shared components, hook and helpers (code-structure, architecture, api-documentation; own lines only).
|
||||||
|
- [x] **Step 19** — Write `aidlc-docs/features/portfolio-page/construction/gallery-blocks/code/code-summary.md`.
|
||||||
|
- [x] **Step 20** — Commit on `feature/portfolio-page` ("Adds the shared gallery building blocks"), together with the unit 2 functional design docs. No push until asked.
|
||||||
|
|
||||||
|
## Files
|
||||||
|
- **Created**: `lib/{wrapIndex,swipeDirection,masonryRowSpan,neighbourIndexes,lightboxReducer}.ts` + tests; `hooks/useSwipe.ts` + test; `recipes/filterControl.ts`; `components/{FilterBar,PortfolioGrid,Lightbox}/*.tsx` + tests; `test/galleryFixtures.ts`
|
||||||
|
- **Modified**: `content/types.ts`, `test/arbitraries.ts`, `theme.ts` (+ generated Chakra types), `components/Hero/useHeroSlider.ts`
|
||||||
|
- **Docs**: RE own lines, unit code summary
|
||||||
|
|
||||||
|
## Extension Compliance (unit 2)
|
||||||
|
| Rule | Status | Rationale |
|
||||||
|
|---|---|---|
|
||||||
|
| SECURITY-10 | Compliant | No new dependencies (Chakra `Dialog`, `@iconify-icons/ant-design` and fast-check are already present) |
|
||||||
|
| SECURITY-13 | Compliant | Lazy chunk is our own bundle; no external resources |
|
||||||
|
| Other SECURITY rules | N/A | Presentational components and pure helpers; no data, endpoints, headers or input from outside (the URL parameter is unit 3) |
|
||||||
|
| PBT-01 | Compliant | Properties identified in business-logic-model.md, mapped to steps 2–6 |
|
||||||
|
| PBT-02 | Planned | Round-trip: `wrapIndex` next-then-previous (step 2) |
|
||||||
|
| PBT-03 | Planned | Invariants: steps 2–5 |
|
||||||
|
| PBT-04 | Planned | Idempotence: `wrapIndex` (step 2) |
|
||||||
|
| PBT-05 | Planned | Oracles: `wrapIndex` modular formula, `neighbourIndexes` brute force, hero behaviour via unchanged tests |
|
||||||
|
| PBT-06 | Planned | Stateful: `lightboxReducer` against a model (step 6) |
|
||||||
|
| PBT-07 | Planned | Domain generators in `test/arbitraries.ts` (step 7) |
|
||||||
|
| PBT-08 / 09 | Compliant | Existing seed logging and fast-check |
|
||||||
|
| PBT-10 | Planned | Every helper and component also has example-based tests |
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
# Functional Design-vragen — Unit 2: Galerijbouwstenen
|
||||||
|
|
||||||
|
Al vastgelegd (geen vraag nodig):
|
||||||
|
|
||||||
|
- **Bladeren** loopt rond: na de laatste foto komt de eerste, en andersom. Escape en een klik op de donkere achtergrond sluiten; ← en → bladeren; vegen naar links of rechts bladert (zelfde drempel als de hero: 50 px, en meer horizontaal dan verticaal).
|
||||||
|
- **Eén foto in de lijst**: geen vorige/volgende-knoppen en geen teller.
|
||||||
|
- **Focus**: bij openen in het venster, bij sluiten terug naar de tegel van de foto die als laatste te zien was.
|
||||||
|
- **Direct laden** geldt voor de eerste 3 tegels van de lijst die op dat moment getoond wordt.
|
||||||
|
- **De hero** werkt na het uitlichten van de veeglogica precies zoals nu.
|
||||||
|
- Deze bouwstenen kennen geen shoottypes, filters of URL; dat komt in unit 3.
|
||||||
|
|
||||||
|
*Beantwoord in de chat op 2026-10-25 en hier vastgelegd.* Vul per vraag de letter in na `[Answer]:`. Past geen enkele optie, kies dan de laatste (Anders) en licht toe.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Vraag 1: Overgang tussen foto's in de lightbox
|
||||||
|
|
||||||
|
- A) **Korte overvloeier** (ongeveer 0,3 s) bij openen, sluiten en bladeren; bij "beweging beperken" in het besturingssysteem geen animatie (aanbevolen)
|
||||||
|
- B) **Geen animatie**: de foto wisselt direct
|
||||||
|
- C) **Schuiven** naar links of rechts, in de richting van het bladeren
|
||||||
|
- X) Anders (beschrijf hieronder na de [Answer]:-tag)
|
||||||
|
|
||||||
|
[Answer]: A
|
||||||
|
|
||||||
|
## Vraag 2: Plaats van de knoppen op een telefoon
|
||||||
|
|
||||||
|
In het ontwerp staan vorige en volgende halverwege links en rechts over de foto, en sluiten rechtsboven. Op een smal scherm liggen de knoppen dan over de foto heen.
|
||||||
|
|
||||||
|
- A) **Op telefoons een balk onderaan** (vorige · teller · volgende) en sluiten rechtsboven; **vanaf tablet** zoals het ontwerp, links en rechts naast de foto. Zo bedekken de knoppen de foto nergens en zitten ze binnen bereik van de duim (aanbevolen)
|
||||||
|
- B) **Overal zoals het ontwerp**: links en rechts halverwege, ook op telefoons
|
||||||
|
- X) Anders (beschrijf hieronder na de [Answer]:-tag)
|
||||||
|
|
||||||
|
[Answer]: A
|
||||||
|
|
||||||
|
## Vraag 3: Klikken of tikken op de grote foto zelf
|
||||||
|
|
||||||
|
- A) **Niets**: alleen de knoppen, toetsen, vegen en de achtergrond doen iets. Voorkomt per ongeluk sluiten of bladeren (aanbevolen)
|
||||||
|
- B) **Volgende foto**
|
||||||
|
- C) **Sluiten**
|
||||||
|
- X) Anders (beschrijf hieronder na de [Answer]:-tag)
|
||||||
|
|
||||||
|
[Answer]: A
|
||||||
|
|
||||||
|
## Vraag 4: Naar beneden vegen
|
||||||
|
|
||||||
|
- A) **Niet ondersteund**: sluiten gaat met de knop, Escape of de achtergrond (aanbevolen: eenvoudiger, geen conflict met scrollen of inzoomen)
|
||||||
|
- B) **Naar beneden vegen sluit** de lightbox, zoals in veel foto-apps
|
||||||
|
- X) Anders (beschrijf hieronder na de [Answer]:-tag)
|
||||||
|
|
||||||
|
[Answer]: A
|
||||||
|
|
||||||
|
## Vraag 5: Wat een screenreader hoort bij het bladeren
|
||||||
|
|
||||||
|
- A) **Positie en bijschrift**, bijvoorbeeld "Foto 3 van 10, Newbornshoot". De alt-tekst wordt voorgelezen als de focus op de foto komt (aanbevolen)
|
||||||
|
- B) **Positie, bijschrift en alt-tekst** in één keer. Volledig, maar lang bij snel bladeren
|
||||||
|
- C) **Alleen de positie**: "Foto 3 van 10"
|
||||||
|
- X) Anders (beschrijf hieronder na de [Answer]:-tag)
|
||||||
|
|
||||||
|
[Answer]: A
|
||||||
|
|
||||||
|
## Vraag 6: Naam van een tegel in het raster
|
||||||
|
|
||||||
|
Een tegel is een link die de lightbox opent. Zijn naam is de alt-tekst plus een aanwijzing.
|
||||||
|
|
||||||
|
- A) Alt-tekst + **"(groot bekijken)"**, bijvoorbeeld "Moeder met pasgeboren baby op bed (groot bekijken)" (aanbevolen)
|
||||||
|
- B) Alt-tekst + **"(vergroten)"**
|
||||||
|
- C) Alleen de alt-tekst
|
||||||
|
- X) Anders (beschrijf hieronder na de [Answer]:-tag)
|
||||||
|
|
||||||
|
[Answer]: A
|
||||||
|
|
||||||
|
## Vraag 7: Als de grote foto niet laadt
|
||||||
|
|
||||||
|
- A) De kleine foto uit het raster blijft staan (die is er al), zonder melding; bladeren blijft werken (aanbevolen)
|
||||||
|
- B) De kleine foto blijft staan met een korte melding "Deze foto kon niet groot geladen worden"
|
||||||
|
- X) Anders (beschrijf hieronder na de [Answer]:-tag)
|
||||||
|
|
||||||
|
[Answer]: B
|
||||||
|
|
||||||
|
## Vraag 8: Vooruit laden in de lightbox
|
||||||
|
|
||||||
|
- A) **De vorige en de volgende** grote foto (1 aan elke kant) (aanbevolen: snel bladeren, weinig extra data op een telefoon)
|
||||||
|
- B) **Twee aan elke kant**
|
||||||
|
- C) **Niets vooruit**; elke grote foto laadt pas als hij getoond wordt
|
||||||
|
- X) Anders (beschrijf hieronder na de [Answer]:-tag)
|
||||||
|
|
||||||
|
[Answer]: B
|
||||||
|
|
||||||
|
## Vraag 9: Het raster bij een ander filter
|
||||||
|
|
||||||
|
- A) **Direct wisselen** zonder animatie; nieuwe tegels verschijnen meteen, ook als ze nog niet in beeld waren geweest (aanbevolen: rustig, geen verspringende fade-ins)
|
||||||
|
- B) **Kort overvloeien** van het raster bij elke wissel
|
||||||
|
- X) Anders (beschrijf hieronder na de [Answer]:-tag)
|
||||||
|
|
||||||
|
[Answer]: A
|
||||||
|
|
||||||
|
## Vraag 10: Home en End in de lightbox
|
||||||
|
|
||||||
|
- A) **Ja**: Home springt naar de eerste foto, End naar de laatste (aanbevolen: handig en volgt het gebruikelijke patroon voor galerijen)
|
||||||
|
- B) **Nee**: alleen ← en →
|
||||||
|
- X) Anders (beschrijf hieronder na de [Answer]:-tag)
|
||||||
|
|
||||||
|
[Answer]: A
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
# Functional Design Plan — Unit 2: Gallery building blocks
|
||||||
|
|
||||||
|
Depth: standard. Scope from the execution plan: the rules and states of the generic `PortfolioGrid`, `Lightbox`, `FilterBar` and `useSwipe`, and the pure helpers behind them (`wrapIndex`, `swipeDirection`, `masonryRowSpan`, `neighbourIndexes`), with their testable properties (PBT-01). Questions: [gallery-blocks-fd-questions.md](gallery-blocks-fd-questions.md).
|
||||||
|
|
||||||
|
- [x] Collect and analyse the answers in `gallery-blocks-fd-questions.md`
|
||||||
|
- [x] `domain-entities.md` — `GalleryItem`, `ImageSource`, `FilterOption`, lightbox state (open index or closed), swipe points; how they relate
|
||||||
|
- [x] `business-rules.md` — grid rules (order, columns, row spans, eager count, link fallback, intent), lightbox rules (open/close, wrap, keys, swipe, counter, caption, focus return, preloading, single item, loading and error states, reduced motion), filter bar rules (options, active state, fewer than two options), swipe rules (threshold, direction), hero behaviour unchanged
|
||||||
|
- [x] `business-logic-model.md` — event flows (open from tile, browse, close, swipe) and the lightbox state machine; the pure helpers with their properties per PBT category (round-trip, invariant, idempotence, oracle, stateful)
|
||||||
|
- [x] `frontend-components.md` — component hierarchy, props and state per component, accessible names and live regions, keyboard map, test ids, recipes and tokens
|
||||||
|
- [x] Validate against requirements.md, application-design.md and the extension rules (Security Baseline, PBT)
|
||||||
@@ -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,47 @@
|
|||||||
|
# Code Generation Plan — Unit 1: Shared Instagram block
|
||||||
|
|
||||||
|
Single source of truth for code generation of this unit. Workspace root: `K:\Development\SlpSoftware\Projects\AndreaSlopFotografie-portfolio` (worktree); all code in `web/src/`. Branch `feature/portfolio-page`.
|
||||||
|
|
||||||
|
## Unit Context
|
||||||
|
- **Requirements**: FR-PF-08 (Instagram block shared, own content, same photos on home and portfolio), NFR-PF-02 (reuse, English comments), NFR-PF-03 (homepage `InstagramGrid` unchanged in output), NFR-PF-06 (content shaped for the API)
|
||||||
|
- **Design**: [components.md § Unit 1](../../inception/application-design/components.md), [component-methods.md](../../inception/application-design/component-methods.md) (`InstagramContent`, `InstagramGrid({ content: InstagramContent; profileUrl })`)
|
||||||
|
- **Dependencies**: none on other units or parallel features; unit 3 uses the moved component on the portfolio page
|
||||||
|
- **Behavioural contract**: the homepage renders exactly as before — same DOM roles, names, texts, test ids, styles and photos. Existing tests pass with only import paths and the content source changed.
|
||||||
|
- **No business logic, no new pure helpers** → no property-based tests in this unit (PBT N/A); example-based tests + axe.
|
||||||
|
- **Photos**: the Instagram tiles keep reusing the homepage's intro and testimonial photos (one description per photo). On the homepage they cost no extra download; on the portfolio they are deferred images below the grid.
|
||||||
|
|
||||||
|
## Steps
|
||||||
|
|
||||||
|
### Content
|
||||||
|
- [x] **Step 1** — `content/types.ts`: add `InstagramContent { title; handle; photos: ContentImage[] }` (comment: fixed selection until the API delivers the real feed, FR-HP-10); remove `instagram` from `HomeContent`.
|
||||||
|
- [x] **Step 2** — `content/homeContent.ts`: export the shared `introPhotos` (named export) and remove the `instagram` block.
|
||||||
|
- [x] **Step 3** — Create `content/instagramContent.ts`: `title`, `handle`, and `photos` = `introPhotos` + the testimonial images, in the current order (moves the existing comment, reworded for both pages).
|
||||||
|
|
||||||
|
### Component
|
||||||
|
- [x] **Step 4** — `git mv components/home/InstagramGrid → components/InstagramGrid` (component and test).
|
||||||
|
- [x] **Step 5** — `InstagramGrid.tsx`: props type `InstagramContent`; doc comment says it is used on the homepage and the portfolio. No markup or style change.
|
||||||
|
- [x] **Step 6** — `InstagramGrid.test.tsx`: content from `instagramContent`; same assertions. Add one test: the tiles are exactly the intro photos followed by the testimonial photos (guards the "one description per photo" reuse).
|
||||||
|
|
||||||
|
### Homepage
|
||||||
|
- [x] **Step 7** — `routes/index.tsx`: import `InstagramGrid` from its new path and pass `instagramContent`. `app.test.tsx` passes unchanged (Instagram region, hidden without a valid link).
|
||||||
|
|
||||||
|
### Verification and docs
|
||||||
|
- [x] **Step 8** — Search for leftovers: no `home/InstagramGrid` and no `homeContent.instagram` / `HomeContent['instagram']` references in `web/`; no duplicate component files.
|
||||||
|
- [x] **Step 9** — Run `pnpm check` in `web/` (lint, format, typecheck/build, tests with coverage, audits, Lighthouse). Fix and rerun until green.
|
||||||
|
- [x] **Step 10** — Visual check of the homepage Instagram block in the browser (desktop and phone width): no visible difference with master. *Outcome: no browser available in this session; verified by construction (diff = props type + comment) and unchanged tests; browser look recommended on test.*
|
||||||
|
- [x] **Step 11** — Update the reverse engineering lines about `InstagramGrid` and the content modules only (code-structure, architecture, api-documentation; team agreement: own lines only).
|
||||||
|
- [x] **Step 12** — Write `aidlc-docs/features/portfolio-page/construction/shared-instagram/code/code-summary.md` (created/modified/moved files, tests, verification outcome).
|
||||||
|
- [x] **Step 13** — Commit on `feature/portfolio-page`: first the inception docs ("Plans the portfolio page"), then this unit ("Shares the Instagram block between pages"). No push until asked.
|
||||||
|
|
||||||
|
## Files
|
||||||
|
- **Created**: `content/instagramContent.ts`
|
||||||
|
- **Moved + modified**: `components/home/InstagramGrid/InstagramGrid.tsx`, `InstagramGrid.test.tsx` → `components/InstagramGrid/`
|
||||||
|
- **Modified**: `content/types.ts`, `content/homeContent.ts`, `routes/index.tsx`
|
||||||
|
- **Docs**: `aidlc-docs/_shared/reverse-engineering/{code-structure,architecture,api-documentation}.md` (own lines), unit code summary
|
||||||
|
|
||||||
|
## Extension Compliance (unit 1)
|
||||||
|
| Rule | Status | Rationale |
|
||||||
|
|---|---|---|
|
||||||
|
| SECURITY-10 | Compliant | No new dependencies |
|
||||||
|
| Other SECURITY rules | N/A | Behaviour-preserving move; no data, endpoints, headers or config |
|
||||||
|
| PBT-01..10 | N/A | No pure functions or business logic in this unit; example-based component and route tests cover the contract |
|
||||||
@@ -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
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
# Code Summary — Unit 1: Shared Instagram block
|
||||||
|
|
||||||
|
Plan: [shared-instagram-code-generation-plan.md](../../plans/shared-instagram-code-generation-plan.md)
|
||||||
|
|
||||||
|
## Changes (`web/src/`)
|
||||||
|
| File | Change |
|
||||||
|
|---|---|
|
||||||
|
| `components/home/InstagramGrid/*` → `components/InstagramGrid/*` | Moved (`git mv`). Component: props type `HomeContent['instagram']` → `InstagramContent`, doc comment notes it is shared. Markup, styles and test ids unchanged |
|
||||||
|
| `components/InstagramGrid/InstagramGrid.test.tsx` | Content from `instagramContent`; new test: the tiles are the intro photos followed by the review photos |
|
||||||
|
| `content/types.ts` | New `InstagramContent`; `instagram` removed from `HomeContent` |
|
||||||
|
| `content/homeContent.ts` | `introPhotos` exported; `instagram` block and the `testimonials` import removed |
|
||||||
|
| `content/instagramContent.ts` | New: title, handle, photos (= `introPhotos` + review images, same order as before) |
|
||||||
|
| `routes/index.tsx` | Imports `InstagramGrid` from its new path and passes `instagramContent` |
|
||||||
|
|
||||||
|
Docs: own lines about `InstagramGrid` and the content modules in `_shared/reverse-engineering/{code-structure,architecture,api-documentation}.md`.
|
||||||
|
|
||||||
|
## Verification
|
||||||
|
- Leftover search: no `home/InstagramGrid`, `homeContent.instagram` or `HomeContent['instagram']` in `web/`.
|
||||||
|
- `pnpm check`: ✅ lint, format, build, audits, tests — 60 test files, 274 tests passed (coverage thresholds met), Lighthouse mobile and desktop: all assertions passed for 7 URLs.
|
||||||
|
- Homepage output: identical by construction. The component diff is only the props type and one comment line, and the photo list has the same values and order; the existing component and route tests (`app.test.tsx`: Instagram region, left out without a valid link) pass unchanged. A side-by-side look in a browser was **not** done in this session (no browser available); recommended once on test.
|
||||||
|
- PBT: N/A for this unit (no pure functions or business logic).
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
# Application Design — Portfolio Page
|
||||||
|
|
||||||
|
Consolidated view of [components.md](components.md), [component-methods.md](component-methods.md), [services.md](services.md) and [component-dependency.md](component-dependency.md). Decisions: [application-design-plan.md](../plans/application-design-plan.md).
|
||||||
|
|
||||||
|
## Decisions
|
||||||
|
| # | Decision |
|
||||||
|
|---|---|
|
||||||
|
| Q1 | Three independent shared pieces (`PortfolioGrid`, `Lightbox`, `FilterBar`) connected by a page-specific `PortfolioGallery` in `components/portfolio/` |
|
||||||
|
| Q2 | Filter bar = group of toggle buttons with `aria-pressed`, one tab stop per button |
|
||||||
|
| Q3 | Filter style = text links in eyebrow style, active underlined in `accent.deep` (new recipe) |
|
||||||
|
| Q4 | Filter changes replace the URL (no history entry per change) |
|
||||||
|
| Q5 | Swipe logic extracted from the hero into `useSwipe` + `lib/swipeDirection`; hero behaviour unchanged |
|
||||||
|
| Q6 + 6a | CSS-only masonry in row order (row spans from the aspect ratio, container units); no preparation for JS measuring — rebuild later if ever needed |
|
||||||
|
| Q7 | `Lightbox` loaded lazily on first open or on tile hover/focus |
|
||||||
|
| — | Names as agreed with the parallel sessions; generic APIs; generic `GalleryItem` so shared components never see shoot types |
|
||||||
|
|
||||||
|
## Component Overview
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
graph TD
|
||||||
|
Route["routes/portfolio.tsx"] --> Intro["PageIntro"]
|
||||||
|
Route --> Gallery["portfolio/PortfolioGallery"]
|
||||||
|
Route --> Insta["InstagramGrid (shared)"]
|
||||||
|
Gallery --> Section["PageSection"]
|
||||||
|
Gallery --> Filter["FilterBar"]
|
||||||
|
Gallery --> Grid["PortfolioGrid"]
|
||||||
|
Gallery --> Box["Lightbox (lazy)"]
|
||||||
|
Grid --> Deferred["DeferredImage + Reveal"]
|
||||||
|
Box --> Dialog["Chakra Dialog"]
|
||||||
|
Box --> Swipe["useSwipe"]
|
||||||
|
Hero["Hero / useHeroSlider"] --> Swipe
|
||||||
|
Home["routes/index.tsx"] --> Insta
|
||||||
|
classDef newpart fill:#FFA726,stroke:#E65100,stroke-width:1px,color:#000;
|
||||||
|
classDef changed fill:#63b3ed,stroke:#2b6cb0,stroke-width:1px,color:#000;
|
||||||
|
classDef existing fill:#e2e8f0,stroke:#4a5568,stroke-width:1px,color:#000;
|
||||||
|
class Gallery,Filter,Grid,Box,Swipe newpart;
|
||||||
|
class Route,Insta,Hero,Home changed;
|
||||||
|
class Intro,Section,Deferred,Dialog existing;
|
||||||
|
```
|
||||||
|
|
||||||
|
Text alternative: the portfolio route renders PageIntro, the page-specific PortfolioGallery and the shared InstagramGrid; the gallery composes PageSection, FilterBar, PortfolioGrid and the lazily loaded Lightbox; the grid reuses DeferredImage and Reveal, the lightbox builds on Chakra Dialog and the new useSwipe hook, which the hero also adopts; the homepage uses the moved InstagramGrid.
|
||||||
|
|
||||||
|
## Per Unit
|
||||||
|
| Unit | New | Changed |
|
||||||
|
|---|---|---|
|
||||||
|
| 1 Shared Instagram block | `content/instagramContent.ts`, `InstagramContent` | `InstagramGrid` moved, `homeContent` (instagram removed), homepage route |
|
||||||
|
| 2 Gallery building blocks | `PortfolioGrid`, `Lightbox`, `FilterBar`, `useSwipe`, recipe `filterControl`, `GalleryItem`/`ImageSource`, `lib/{wrapIndex, swipeDirection, masonryRowSpan, neighbourIndexes}`, arbitraries, possibly a `zIndex.lightbox` token | `useHeroSlider` (uses `useSwipe` and `wrapIndex`) |
|
||||||
|
| 3 Portfolio page | `PortfolioGallery`, `portfolioContent.ts`, `PortfolioPhoto`/`PortfolioContent`, `lib/{shootTypesWithPhotos, shootFromSearch, filterPhotos, filterOptions, toGalleryItems, photoCountLabel}`, `galleryImages` in `seo.ts`, 10 photos ×2, `og-portfolio.jpg` | portfolio route, `sitePages.ts`, `lighthouserc*.cjs`, LAYOUT.md, RE lines about `/portfolio` |
|
||||||
|
|
||||||
|
## State and Data Flow (summary)
|
||||||
|
- The **URL** owns the active filter (`?shoot=`, typed and allowlisted, replace navigation); **`PortfolioGallery`** owns which photo is open; everything else is derived by pure helpers.
|
||||||
|
- Shared components get data and report events through props; none import page content.
|
||||||
|
- See [services.md](services.md) and [component-dependency.md](component-dependency.md) for the flow diagram and the peer dependencies.
|
||||||
|
|
||||||
|
## Extension Compliance — Application Design
|
||||||
|
| Rule | Status | Note |
|
||||||
|
|---|---|---|
|
||||||
|
| SECURITY-04 headers | Compliant | No CSP change; no external resources |
|
||||||
|
| SECURITY-05 input validation | Compliant | `?shoot=` allowlisted in `validateSearch` and `shootFromSearch`; never rendered |
|
||||||
|
| SECURITY-10 supply chain | Compliant | No new dependency (Chakra `Dialog` is already in `@chakra-ui/react`) |
|
||||||
|
| SECURITY-11 secure design | Compliant | Misuse case (crafted parameter) handled by allowlist + fallback |
|
||||||
|
| SECURITY-13 integrity | Compliant | Lazy chunk is our own bundle; no CDN |
|
||||||
|
| Other SECURITY rules | N/A | No data stores, auth, server or infrastructure |
|
||||||
|
| PBT-01 | Planned | Every pure helper above is listed for property identification in Functional Design (units 2 and 3) |
|
||||||
|
| PBT-06 | Planned | Open-index state in `PortfolioGallery` + `Lightbox` navigation modelled in Functional Design |
|
||||||
|
| PBT-07 | Planned | Generators for `GalleryItem`, `PortfolioPhoto`, `ShootType` in `src/test/arbitraries.ts` |
|
||||||
|
| PBT-08 / 09 | Compliant | Existing seed logging and fast-check |
|
||||||
|
| Other PBT rules | Planned at Functional Design / Code Generation | |
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
# Component Dependencies — Portfolio Page
|
||||||
|
|
||||||
|
## Dependency Matrix
|
||||||
|
|
||||||
|
| Component | Depends on | Used by |
|
||||||
|
|---|---|---|
|
||||||
|
| `routes/portfolio.tsx` | `PageIntro`, `PortfolioGallery`, `InstagramGrid`, `portfolioContent`, `instagramContent`, `shootTypes`*, `siteContent`, `seo.ts` (`pageHead`, `webPage`*, `galleryImages`), `lib/visibleSocials`, `lib/shootFromSearch` | router |
|
||||||
|
| `routes/index.tsx` | … + `InstagramGrid` (new path), `instagramContent` | router |
|
||||||
|
| `PortfolioGallery` | `PageSection`, `FilterBar`, `PortfolioGrid`, `Lightbox` (lazy), `lib/` (filter/gallery helpers) | portfolio route |
|
||||||
|
| `PortfolioGrid` | `DeferredImage`, `Reveal`, `lib/masonryRowSpan`, theme tokens | `PortfolioGallery` (any page later) |
|
||||||
|
| `Lightbox` | Chakra `Dialog`, `useSwipe`, `lib/wrapIndex`, `lib/neighbourIndexes`, recipes `iconControl`/`carouselControl` | `PortfolioGallery` (any page later) |
|
||||||
|
| `FilterBar` | recipe `filterControl` (new) | `PortfolioGallery` |
|
||||||
|
| `useSwipe` | `lib/swipeDirection` | `useHeroSlider`, `Lightbox` |
|
||||||
|
| `useHeroSlider` | `useSwipe`, `lib/wrapIndex` (refactor, same behaviour) | `Hero` |
|
||||||
|
| `InstagramGrid` | `PageSection`, `SectionHeading`, `Reveal`, `DeferredImage` | home and portfolio routes |
|
||||||
|
| `seo.ts` `galleryImages` | `siteUrl`, `personId`, `businessId` | portfolio route |
|
||||||
|
|
||||||
|
\* delivered by a parallel feature (see below)
|
||||||
|
|
||||||
|
## Data Flow
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
graph LR
|
||||||
|
Url["URL ?shoot="] --> Route["routes/portfolio.tsx"]
|
||||||
|
Content["portfolioContent + shootTypes"] --> Route
|
||||||
|
Route -->|"shoot, photos, shootTypes"| Gallery["PortfolioGallery"]
|
||||||
|
Gallery -->|"options, value"| Filter["FilterBar"]
|
||||||
|
Filter -->|"onChange(id)"| Gallery
|
||||||
|
Gallery -->|"onShootChange"| Route
|
||||||
|
Route -->|"navigate replace"| Url
|
||||||
|
Gallery -->|"items"| Grid["PortfolioGrid"]
|
||||||
|
Grid -->|"onOpen(index), onIntent"| Gallery
|
||||||
|
Gallery -->|"items, index"| Box["Lightbox (lazy)"]
|
||||||
|
Box -->|"onIndexChange, onClose"| Gallery
|
||||||
|
Lib["lib/ pure helpers"] -.-> Gallery
|
||||||
|
Lib -.-> Grid
|
||||||
|
Lib -.-> Box
|
||||||
|
classDef state fill:#f6e05e,stroke:#c05621,stroke-width:1px,color:#000;
|
||||||
|
classDef comp fill:#9ae6b4,stroke:#2f855a,stroke-width:1px,color:#000;
|
||||||
|
classDef support fill:#e2e8f0,stroke:#4a5568,stroke-width:1px,color:#000;
|
||||||
|
class Url,Content state;
|
||||||
|
class Route,Gallery,Filter,Grid,Box comp;
|
||||||
|
class Lib support;
|
||||||
|
```
|
||||||
|
|
||||||
|
Text alternative: the route reads the `?shoot=` parameter and the content and passes the active filter, photos and shoot types to PortfolioGallery; the filter bar reports a choice back up to the route, which updates the URL with replace; the gallery gives the filtered items to the grid and the lightbox and keeps which item is open; pure helpers in lib support all three.
|
||||||
|
|
||||||
|
## Communication Patterns
|
||||||
|
- **Props down, callbacks up**; no context or global store. The URL is the source of truth for the filter, `PortfolioGallery` for the open item
|
||||||
|
- **Lazy boundary**: `Lightbox` behind `React.lazy` + `Suspense`; the chunk is requested on first `onIntent` or `onOpen`
|
||||||
|
- **No cross-page coupling**: `PortfolioGrid`, `Lightbox`, `FilterBar` and `useSwipe` import nothing page-specific
|
||||||
|
|
||||||
|
## Parallel-Feature Dependencies
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
graph TD
|
||||||
|
Contact["contact-page commit: webPage() + WebPageType"] --> U3["Unit 3 Portfolio page"]
|
||||||
|
Soorten["soorten-fotoshoots commit: ShootType, ShootTypeId, shootTypes.ts"] --> U3
|
||||||
|
U1["Unit 1 Shared Instagram block"] --> U3
|
||||||
|
U2["Unit 2 Gallery building blocks"] --> U3
|
||||||
|
U3 -.->|"?shoot= URL, shootTypesWithPhotos"| SoortenPage["Soorten fotoshoots links"]
|
||||||
|
classDef peer fill:#CE93D8,stroke:#6A1B9A,stroke-width:1px,color:#000;
|
||||||
|
classDef unit fill:#FFA726,stroke:#E65100,stroke-width:1px,color:#000;
|
||||||
|
class Contact,Soorten,SoortenPage peer;
|
||||||
|
class U1,U2,U3 unit;
|
||||||
|
```
|
||||||
|
|
||||||
|
Text alternative: units 1 and 2 have no outside dependency; unit 3 needs units 1 and 2 plus the cherry-picked commits from contact-page (webPage) and soorten-fotoshoots (shoot types); in return the portfolio offers the ?shoot= URL and a helper the Soorten fotoshoots page can link with.
|
||||||
|
|
||||||
|
- Unit 3 starts by cherry-picking both peer commits; if either is missing it stops and reports (no parallel copy)
|
||||||
|
- `useHeroSlider` is touched by unit 2 (swipe extraction); no other feature has claimed the hero
|
||||||
@@ -0,0 +1,120 @@
|
|||||||
|
# Component Methods — Portfolio Page
|
||||||
|
|
||||||
|
Signatures only; the rules behind them (edge cases, invariants, properties) follow in Functional Design for units 2 and 3. Types are TypeScript; names are working names.
|
||||||
|
|
||||||
|
## Types
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// content/types.ts (unit 2: GalleryItem lives next to ContentImage)
|
||||||
|
interface ImageSource { src: string; width: number; height: number }
|
||||||
|
|
||||||
|
// What the generic components show
|
||||||
|
interface GalleryItem {
|
||||||
|
id: string;
|
||||||
|
thumb: ContentImage; // grid size (~800 px), alt text included
|
||||||
|
full: ImageSource; // lightbox size (~1600–2000 px), same alt as thumb
|
||||||
|
caption?: string; // visible caption in the lightbox
|
||||||
|
}
|
||||||
|
|
||||||
|
// unit 3
|
||||||
|
interface PortfolioPhoto {
|
||||||
|
id: string;
|
||||||
|
shootType: ShootTypeId; // from the soorten-fotoshoots commit
|
||||||
|
thumb: ContentImage;
|
||||||
|
full: ImageSource;
|
||||||
|
}
|
||||||
|
interface PortfolioContent {
|
||||||
|
intro: { eyebrow: string; title: string; text: string };
|
||||||
|
photos: PortfolioPhoto[];
|
||||||
|
}
|
||||||
|
|
||||||
|
// unit 1
|
||||||
|
interface InstagramContent {
|
||||||
|
title: string;
|
||||||
|
handle: string;
|
||||||
|
photos: ContentImage[];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface FilterOption { id: string; label: string }
|
||||||
|
```
|
||||||
|
|
||||||
|
## Components (props)
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// unit 1
|
||||||
|
InstagramGrid({ content: InstagramContent; profileUrl: string })
|
||||||
|
|
||||||
|
// unit 2
|
||||||
|
PortfolioGrid({
|
||||||
|
items: readonly GalleryItem[];
|
||||||
|
eagerCount?: number; // default 3
|
||||||
|
onOpen: (index: number) => void;
|
||||||
|
onIntent?: () => void; // hover/focus: preload the lightbox code
|
||||||
|
'data-testid'?: string;
|
||||||
|
})
|
||||||
|
|
||||||
|
Lightbox({
|
||||||
|
items: readonly GalleryItem[];
|
||||||
|
index: number | null; // null = closed
|
||||||
|
onIndexChange: (index: number) => void;
|
||||||
|
onClose: () => void;
|
||||||
|
label?: string; // dialog name, default "Foto groot bekijken"
|
||||||
|
finalFocusRef?: RefObject<HTMLElement> // or a getter for the tile to return to
|
||||||
|
})
|
||||||
|
|
||||||
|
FilterBar({
|
||||||
|
options: readonly FilterOption[];
|
||||||
|
value: string;
|
||||||
|
onChange: (id: string) => void;
|
||||||
|
label: string; // group name, e.g. "Filter op soort shoot"
|
||||||
|
})
|
||||||
|
|
||||||
|
// unit 3
|
||||||
|
PortfolioGallery({
|
||||||
|
photos: readonly PortfolioPhoto[];
|
||||||
|
shootTypes: readonly ShootType[];
|
||||||
|
shoot: ShootTypeId | undefined; // active filter from the route
|
||||||
|
onShootChange: (shoot: ShootTypeId | undefined) => void;
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
## Hooks
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// hooks/useSwipe.ts (unit 2)
|
||||||
|
useSwipe(options: { onPrev: () => void; onNext: () => void; enabled?: boolean }):
|
||||||
|
{ onTouchStart: TouchEventHandler; onTouchEnd: TouchEventHandler }
|
||||||
|
```
|
||||||
|
|
||||||
|
## Pure helpers (`lib/`, 100% coverage threshold, example + property-based tests)
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// unit 2
|
||||||
|
wrapIndex(index: number, count: number): number
|
||||||
|
// position within 0..count-1, wrapping both ways (also used by useHeroSlider)
|
||||||
|
swipeDirection(start: Point, end: Point, threshold?: number): 'prev' | 'next' | null
|
||||||
|
masonryRowSpan(image: { width: number; height: number }, rowsPerColumnWidth: number): number
|
||||||
|
// number of implicit rows an item spans, from its aspect ratio
|
||||||
|
neighbourIndexes(index: number, count: number): number[]
|
||||||
|
// which large images to preload around the current one
|
||||||
|
|
||||||
|
// unit 3
|
||||||
|
shootTypesWithPhotos(shootTypes: readonly ShootType[], photos: readonly PortfolioPhoto[]): ShootType[]
|
||||||
|
// in list order; also offered to soorten-fotoshoots
|
||||||
|
shootFromSearch(value: unknown, available: readonly ShootTypeId[]): ShootTypeId | undefined
|
||||||
|
// allowlist check for ?shoot= (like packageFromSearch)
|
||||||
|
filterPhotos(photos: readonly PortfolioPhoto[], shoot: ShootTypeId | undefined): PortfolioPhoto[]
|
||||||
|
filterOptions(shootTypes: readonly ShootType[], allLabel: string): FilterOption[]
|
||||||
|
// "Alles" first, then one option per shoot type (label = name)
|
||||||
|
toGalleryItems(photos: readonly PortfolioPhoto[], shootTypes: readonly ShootType[]): GalleryItem[]
|
||||||
|
// caption = shootLabel
|
||||||
|
photoCountLabel(count: number): string // "1 foto" / "4 foto's"
|
||||||
|
```
|
||||||
|
|
||||||
|
## SEO (`seo.ts`, unit 3)
|
||||||
|
|
||||||
|
```ts
|
||||||
|
galleryImages(photos: readonly PortfolioPhoto[], base?: string): ImageObject[]
|
||||||
|
// contentUrl/thumbnailUrl absolute https, description = alt, creator → personId, copyrightHolder → businessId
|
||||||
|
// head: structuredDataScript(webPage('ImageGallery', '/portfolio', { associatedMedia: galleryImages(...) }))
|
||||||
|
```
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
# Components — Portfolio Page
|
||||||
|
|
||||||
|
New and changed components, grouped by unit. Shared building blocks live in their own folder directly under `web/src/components/`; page-specific parts under `components/portfolio/` (same pattern as `components/home/` and `components/about/`). *Source: plan Q1 = A*
|
||||||
|
|
||||||
|
## Unit 1 — Shared Instagram block
|
||||||
|
|
||||||
|
### InstagramGrid (moved)
|
||||||
|
- **From → to**: `components/home/InstagramGrid/` → `components/InstagramGrid/`
|
||||||
|
- **Purpose**: the Instagram section (design `.instagram`): heading with the handle as link, full-width row of square tiles linking to the profile
|
||||||
|
- **Change**: props type `HomeContent['instagram']` → `InstagramContent` (own content module). Markup, styling, test ids and behaviour unchanged
|
||||||
|
- **Used by**: homepage route, portfolio route
|
||||||
|
|
||||||
|
## Unit 2 — Gallery building blocks (generic, no shoot types)
|
||||||
|
|
||||||
|
### PortfolioGrid (new, shared)
|
||||||
|
- **Purpose**: masonry grid of photos in row order (design `.portfolio-grid` / `.portfolio-item`); every photo is a link to its large image that asks the page to open the lightbox instead
|
||||||
|
- **Responsibilities**:
|
||||||
|
- list semantics (`ul`/`li`) in the given order
|
||||||
|
- CSS-only masonry: tiny implicit rows whose height scales with the column width (container units); each item spans the number of rows derived from its intrinsic width/height by a pure helper. *Source: Q6 = A, 6a = B (no hook for JS measuring)*
|
||||||
|
- 3 / 2 / 1 columns on the theme breakpoints, gap `gridGap`
|
||||||
|
- the first `eagerCount` images load immediately with `fetchPriority="high"`; the rest via `DeferredImage`
|
||||||
|
- hover/focus effect (zoom + overlay, zoom off under reduced motion), focus ring above neighbours, `Reveal` fade-in
|
||||||
|
- click / Enter on a tile: `preventDefault` and report the index; without JavaScript the link opens the large image
|
||||||
|
- pointer enter / focus on a tile: report "intent" so the page can preload the lightbox code (Q7)
|
||||||
|
- **Knows nothing about**: shoot types, filters, URL
|
||||||
|
|
||||||
|
### Lightbox (new, shared, lazily loaded)
|
||||||
|
- **Purpose**: modal viewer over a list of gallery items (design `.lightbox`)
|
||||||
|
- **Responsibilities**:
|
||||||
|
- Chakra `Dialog` (controlled `open`), dark backdrop, accessible name; focus trap, Escape, inert background, scroll lock and focus return come from Chakra/Ark
|
||||||
|
- shows the current item's large image (`object-fit: contain`), visible caption (if given), counter "n / total"
|
||||||
|
- previous / next buttons (`iconControl`/`carouselControl` recipes, ≥ 44 px), ←/→ keys, swipe via `useSwipe`; wrap-around via a pure helper
|
||||||
|
- polite announcement of the position when browsing
|
||||||
|
- preloads the neighbouring large images; shows the (cached) thumb until the large image has loaded
|
||||||
|
- hides prev/next/counter when there is one item
|
||||||
|
- **Loaded**: with `React.lazy` on first open or on tile intent. *Source: Q7 = A*
|
||||||
|
- **Knows nothing about**: grids, filters, shoot types
|
||||||
|
|
||||||
|
### FilterBar (new, shared)
|
||||||
|
- **Purpose**: a row of single-choice filter controls
|
||||||
|
- **Responsibilities**: group of toggle buttons (`role="group"` with an accessible name, each button `aria-pressed`, one tab stop per button), labels in eyebrow style, active one underlined in `accent.deep`; reports the chosen id; renders nothing for fewer than two options. *Source: Q2 = A, Q3 = A*
|
||||||
|
- **Styling**: a new recipe `filterControl` (or a `filter` variant on the `link` recipe — decided in Code Generation, whichever keeps the eyebrow tokens in one place)
|
||||||
|
- **Knows nothing about**: what is filtered
|
||||||
|
|
||||||
|
### useSwipe (new hook, extracted)
|
||||||
|
- **Purpose**: horizontal swipe detection on touch devices, shared by the hero and the lightbox. *Source: Q5 = A*
|
||||||
|
- **Responsibilities**: touch start/end handlers; decides via a pure helper (threshold 50 px, horizontal movement larger than vertical); calls `onPrev` / `onNext`
|
||||||
|
- **Change to the hero**: `useHeroSlider` uses `useSwipe` instead of its inline handlers; behaviour identical (same threshold, same direction rules)
|
||||||
|
|
||||||
|
## Unit 3 — Portfolio page
|
||||||
|
|
||||||
|
### PortfolioGallery (new, page-specific, `components/portfolio/`)
|
||||||
|
- **Purpose**: connects filter bar, grid and lightbox for the portfolio. *Source: Q1 = A*
|
||||||
|
- **Responsibilities**:
|
||||||
|
- receives the photos, the shoot types and the active filter (from the route) plus a callback to change it
|
||||||
|
- derives the visible filters and the filtered photo list with pure helpers; maps photos to generic gallery items (caption = `shootLabel`)
|
||||||
|
- holds the open state (which item, or closed) and resets it when the filter changes
|
||||||
|
- announces the number of shown photos after a filter change
|
||||||
|
- renders the section frame (`PageSection`, visually hidden h2) with `FilterBar`, `PortfolioGrid` and the lazily loaded `Lightbox`
|
||||||
|
|
||||||
|
### Route `routes/portfolio.tsx` (rewritten)
|
||||||
|
- `validateSearch` → `{ shoot?: ShootTypeId }` (typed, allowlist check; agreed with soorten-fotoshoots)
|
||||||
|
- `head()` → `pageHead('/portfolio')` + `ImageGallery` structured data
|
||||||
|
- component: `PageIntro` → `PortfolioGallery` → `InstagramGrid`; changing the filter navigates with `replace: true`. *Source: Q4 = A*
|
||||||
|
|
||||||
|
### Content and types
|
||||||
|
- `content/portfolioContent.ts` — intro texts and the 10 photos (`PortfolioContent`, `PortfolioPhoto`)
|
||||||
|
- `content/instagramContent.ts` (unit 1) — `InstagramContent`
|
||||||
|
- `content/types.ts` — the types above; `ShootTypeId` / `ShootType` arrive with the soorten-fotoshoots commit
|
||||||
|
|
||||||
|
### SEO
|
||||||
|
- `seo.ts` — `galleryImages(...)` builder for the `ImageObject` list; uses `webPage()` from the contact-page commit
|
||||||
|
- `sitePages.ts` — `/portfolio`: `indexed: true`, `ogImage`
|
||||||
|
- `lighthouserc*.cjs` — `/portfolio` to the indexed paths
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
# Services — Portfolio Page
|
||||||
|
|
||||||
|
There is no service layer in this SPA (no back-end yet). "Orchestration" happens in the route and one page-specific component; everything that decides what is shown is a pure helper in `lib/`.
|
||||||
|
|
||||||
|
## Route as orchestrator (`routes/portfolio.tsx`)
|
||||||
|
- **Reads**: `portfolioContent`, `instagramContent`, `shootTypes`, `siteContent.socials`
|
||||||
|
- **URL state**: `validateSearch` turns `?shoot=` into `{ shoot?: ShootTypeId }` (allowlist). The component re-checks it against the shoot types that actually have photos (`shootFromSearch` with `shootTypesWithPhotos`), so a valid id without photos falls back to "Alles"
|
||||||
|
- **Changes**: `navigate({ search: shoot ? { shoot } : {}, replace: true, resetScroll: false })` — no history entry per filter (Q4 = A), no scroll jump
|
||||||
|
- **Head**: `pageHead('/portfolio')` + gallery JSON-LD
|
||||||
|
- **Renders**: `PageIntro` → `PortfolioGallery` → `InstagramGrid` (only with a valid Instagram link, as on the homepage)
|
||||||
|
|
||||||
|
## PortfolioGallery as page controller
|
||||||
|
- **Derives** (pure, memoised on input): filter options, filtered photos, gallery items
|
||||||
|
- **Holds** the only UI state of the page: `openIndex: number | null`; closes the lightbox when the filter changes
|
||||||
|
- **Coordinates**: grid `onOpen` → `openIndex`; grid `onIntent` → start loading the lightbox chunk; lightbox `onIndexChange` / `onClose`; filter `onChange` → route callback + polite count announcement
|
||||||
|
- **Focus return**: on close, focus goes to the tile of the item shown last (requirements FR-PF-06)
|
||||||
|
|
||||||
|
## Future API
|
||||||
|
- `GET /api/portfolio` can return `PortfolioContent` 1-to-1; the route then loads it instead of importing the module. Shoot types come from the same API as the Soorten fotoshoots page. Nothing else changes.
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
# Application Design Plan — Portfolio Page
|
||||||
|
|
||||||
|
Depth: standard. Business rules (filtering, wrap-around, lightbox states, masonry spans, `?shoot=` parsing, gallery structured data) follow in Functional Design for units 2 and 3.
|
||||||
|
|
||||||
|
## Plan
|
||||||
|
|
||||||
|
- [x] Answer the design questions below
|
||||||
|
- [x] Generate `components.md` — new and changed components with responsibilities and interfaces
|
||||||
|
- [x] Generate `component-methods.md` — props, hooks and pure function signatures
|
||||||
|
- [x] Generate `services.md` — composition in the route (there is no service layer in this SPA)
|
||||||
|
- [x] Generate `component-dependency.md` — dependency matrix, data flow, and where the peer commits slot in
|
||||||
|
- [x] Generate `application-design.md` — consolidated design
|
||||||
|
- [x] Validate completeness and consistency against requirements.md
|
||||||
|
|
||||||
|
## Already decided (no question needed)
|
||||||
|
|
||||||
|
- **Names as claimed with the other sessions**: `PortfolioGrid`, `Lightbox`, and `InstagramGrid` (moved). Despite the name, `PortfolioGrid` gets a generic API (a list of images, no knowledge of shoot types), so other pages can use it.
|
||||||
|
- **Gallery data for the components**: the components work with a generic item, roughly `{ id, thumb: ContentImage, full: { src, width, height }, caption? }`. The page maps its portfolio photos (with `shootType`) to that, taking the caption from `shootLabel`. So `Lightbox` and `PortfolioGrid` never import shoot types.
|
||||||
|
- **Portfolio content**: `content/portfolioContent.ts` + a `PortfolioContent` / `PortfolioPhoto` type in `content/types.ts`; photos reference `ShootTypeId` only. Instagram content: `content/instagramContent.ts` + `InstagramContent` (split off from `HomeContent`); the homepage passes the same object.
|
||||||
|
- **URL state**: `?shoot=` is read through the route's `validateSearch` and checked by a pure function in `lib/` against the shoot types that have photos, like `packageFromSearch` for `?pakket=`. The route is the single source of truth for the active filter; it navigates to change it.
|
||||||
|
- **Lightbox on Chakra `Dialog`** (focus trap, focus return, Escape, inert background and scroll lock come from Chakra/Ark); our part is the content, prev/next, counter, caption, swipe and preloading.
|
||||||
|
- **SEO**: `galleryImages(...)`-style pure builders in `seo.ts` produce the `ImageObject` list; the route's `head()` combines `pageHead('/portfolio')` with one `structuredDataScript(webPage('ImageGallery', '/portfolio', { associatedMedia }))`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Vul per vraag de letter in na `[Answer]:`. Past geen enkele optie, kies dan de laatste (Anders) en licht toe.
|
||||||
|
|
||||||
|
## Vraag 1: Hoe raster, lightbox en filter samenwerken
|
||||||
|
|
||||||
|
- A) **Drie losse onderdelen plus één pagina-onderdeel dat ze verbindt**: `PortfolioGrid` toont foto's en meldt "foto X geopend"; `Lightbox` toont een lijst foto's vanaf een startpositie; de filterbalk meldt "filter gekozen". Een pagina-specifiek onderdeel in `components/portfolio/` (bijvoorbeeld `PortfolioGallery`) bewaart welke foto open is en geeft het gefilterde lijstje aan beide door. Elk onderdeel is los te testen en los te hergebruiken, bijvoorbeeld een `Lightbox` bij de shootfoto's op Soorten fotoshoots (aanbevolen)
|
||||||
|
- B) **Raster met ingebouwde lightbox**: `PortfolioGrid` opent zelf zijn `Lightbox`. Minder losse delen, maar de lightbox is dan niet zonder raster te gebruiken
|
||||||
|
- C) Alles in de route opbouwen, zonder pagina-specifiek onderdeel
|
||||||
|
- X) Anders (beschrijf hieronder na de [Answer]:-tag)
|
||||||
|
|
||||||
|
[Answer]: A
|
||||||
|
|
||||||
|
## Vraag 2: Hoe de filterbalk werkt (voor toetsenbord en screenreader)
|
||||||
|
|
||||||
|
- A) **Een groep schakelknoppen**: elke knop is een tab-stop, de actieve heeft `aria-pressed="true"`, en de groep heeft een naam ("Filter op soort shoot"). Eenvoudig en voorspelbaar (aanbevolen)
|
||||||
|
- B) **Een keuzerondjesgroep** (radiogroup): één tab-stop, je kiest met de pijltjestoetsen. Compacter voor het toetsenbord, maar minder bekend voor wie het niet kent
|
||||||
|
- C) **Tabbladen** (tablist): semantisch bedoeld voor wisselende inhoud in vaste panelen, wat hier niet helemaal past
|
||||||
|
- X) Anders (beschrijf hieronder na de [Answer]:-tag)
|
||||||
|
|
||||||
|
[Answer]: A
|
||||||
|
|
||||||
|
## Vraag 3: Hoe de filterbalk eruitziet
|
||||||
|
|
||||||
|
Het ontwerp heeft geen filters, dus dit is nieuw.
|
||||||
|
|
||||||
|
- A) **Tekstlinks in labelstijl** (zoals de eyebrows: kleine hoofdletters, ruime spatiëring), de actieve onderstreept in `accent.deep`. Rustig en past bij de typografie van de site; als nieuwe variant in een recipe (aanbevolen)
|
||||||
|
- B) **Omlijnde knoppen** in de stijl van `LinkButton` `outline`, de actieve gevuld met de accentkleur. Duidelijker als "knoppen", maar zwaarder boven een fotoraster
|
||||||
|
- X) Anders (beschrijf hieronder na de [Answer]:-tag)
|
||||||
|
|
||||||
|
[Answer]: A
|
||||||
|
|
||||||
|
## Vraag 4: Filter wisselen en de terugknop
|
||||||
|
|
||||||
|
- A) **Vervangen**: wisselen van filter past de URL aan zonder een stap in de geschiedenis. De terugknop verlaat de pagina, ook na vijf keer wisselen (aanbevolen)
|
||||||
|
- B) **Toevoegen**: elke filterwissel is een stap; de terugknop gaat terug naar het vorige filter
|
||||||
|
- X) Anders (beschrijf hieronder na de [Answer]:-tag)
|
||||||
|
|
||||||
|
[Answer]: A
|
||||||
|
|
||||||
|
## Vraag 5: Vegen in de lightbox
|
||||||
|
|
||||||
|
De hero heeft al veeglogica, maar die zit vast in `useHeroSlider`.
|
||||||
|
|
||||||
|
- A) **Uit de hero halen** naar een gedeelde hook (bijvoorbeeld `useSwipe({ onPrev, onNext })`) en die in de hero en de lightbox gebruiken. Eén plek voor drempel en gedrag; de hero blijft precies zo werken (aanbevolen)
|
||||||
|
- B) De lightbox krijgt eigen veeglogica; de hero blijft ongemoeid
|
||||||
|
- X) Anders (beschrijf hieronder na de [Answer]:-tag)
|
||||||
|
|
||||||
|
[Answer]: A
|
||||||
|
|
||||||
|
## Vraag 6: Techniek voor de masonry in rijvolgorde
|
||||||
|
|
||||||
|
- A) **Alleen CSS**: een raster met hele kleine rijen, waarbij elke foto zoveel rijen beslaat als past bij zijn verhouding. Dat aantal rekent een losse functie uit met de breedte en hoogte uit de data, en de rijhoogte schaalt mee met de kolombreedte (container-eenheden). Geen meten in de browser, dus geen verspringen bij het laden (aanbevolen)
|
||||||
|
- B) **Meten met JavaScript**: na het laden de echte hoogtes meten (ResizeObserver) en de foto's positioneren. Precies, maar het raster kan verspringen en het werkt pas als JavaScript draait
|
||||||
|
- X) Anders (beschrijf hieronder na de [Answer]:-tag)
|
||||||
|
|
||||||
|
[Answer]: A, als het later nodig kunnen we het alsnog ombouwen
|
||||||
|
|
||||||
|
## Vraag 7: Lightbox-code apart laden
|
||||||
|
|
||||||
|
- A) **Apart laden**: de code van de lightbox laadt pas zodra je een foto opent, of al vooruit als je met muis of focus op een foto komt. De eerste weergave van de pagina blijft lichter (helpt de prestatiescore) (aanbevolen)
|
||||||
|
- B) **Direct meeladen** met de pagina. Eenvoudiger, de eerste keer openen is altijd direct
|
||||||
|
- X) Anders (beschrijf hieronder na de [Answer]:-tag)
|
||||||
|
|
||||||
|
[Answer]: A
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Vervolgvraag 6a: "A, als het later nodig"
|
||||||
|
|
||||||
|
Je antwoord op vraag 6 lijkt halverwege afgebroken. Wat bedoel je?
|
||||||
|
|
||||||
|
- A) **CSS-masonry nu; meten met JavaScript alleen als CSS later tekortschiet.** Ik ontwerp de grid zo dat de berekening van de rijen op één plek zit, zodat die later vervangen kan worden zonder de rest aan te passen. Wat "tekortschiet" is, leg ik vast: zichtbare gaten groter dan één rij-eenheid, of verkeerd bijgesneden foto's in een browser die we ondersteunen (aanbevolen)
|
||||||
|
- B) **CSS-masonry, en verder niets voorbereiden.** Als het later nodig is, bouwen we het dan om
|
||||||
|
- X) Anders (beschrijf hieronder na de [Answer]:-tag)
|
||||||
|
|
||||||
|
[Answer]: B
|
||||||
@@ -0,0 +1,167 @@
|
|||||||
|
# Execution Plan — Portfolio Page
|
||||||
|
|
||||||
|
## Detailed Analysis Summary
|
||||||
|
|
||||||
|
### Transformation Scope (Brownfield)
|
||||||
|
- **Transformation Type**: Single component (`web/`), application-level only
|
||||||
|
- **Primary Changes**: replace the `/portfolio` placeholder with the real page; new shared gallery building blocks (masonry `PortfolioGrid`, `Lightbox`, a generic filter bar) with pure helpers in `lib/`; `InstagramGrid` moved to a shared component with its own content; page-specific SEO (indexing, `ImageGallery` JSON-LD via the shared `webPage()`, own preview image); 10 photos in two sizes
|
||||||
|
- **Related Components**: `web/src/routes/portfolio.tsx`, `web/src/routes/index.tsx`, `web/src/components/{home/InstagramGrid → InstagramGrid, PortfolioGrid, Lightbox, filter bar}`, `web/src/lib/`, `web/src/content/` (+ `types.ts`), `web/src/seo.ts`, `web/src/sitePages.ts`, `web/lighthouserc*.cjs`, `web/src/theme.ts` (possibly a `zIndex` token), `web/src/test/arbitraries.ts`, `web/public/`, `web/src/assets/portfolio/`, [LAYOUT.md](../../../../../LAYOUT.md)
|
||||||
|
|
||||||
|
### Change Impact Assessment
|
||||||
|
- **User-facing changes**: Yes — a new page with filters and a lightbox; the homepage Instagram block must look and behave exactly as before
|
||||||
|
- **Structural changes**: Minor — one component moved, new shared components; no architectural change
|
||||||
|
- **Data model changes**: Yes — new portfolio photo content (two image sizes, `ShootTypeId`), `InstagramContent` split from `HomeContent`
|
||||||
|
- **API changes**: No external API; new URL search parameter `?shoot=` on `/portfolio`; internal props for the new components
|
||||||
|
- **NFR impact**: Yes — SEO (indexed, structured data, preview image), accessibility (modal dialog, focus management, announcements), performance (photo-heavy page, Lighthouse budget 0.9 on mobile)
|
||||||
|
|
||||||
|
### Component Relationships
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
graph TD
|
||||||
|
Route["routes/portfolio.tsx"] --> PageIntro["PageIntro (existing)"]
|
||||||
|
Route --> Filter["Filter bar (new, generic)"]
|
||||||
|
Route --> Grid["PortfolioGrid (new, masonry)"]
|
||||||
|
Grid --> Lightbox["Lightbox (new, Chakra Dialog)"]
|
||||||
|
Grid --> Deferred["DeferredImage + Reveal (existing)"]
|
||||||
|
Route --> Insta["InstagramGrid (moved to shared)"]
|
||||||
|
Home["routes/index.tsx"] --> Insta
|
||||||
|
Insta --> InstaContent["content/instagramContent.ts (new)"]
|
||||||
|
Route --> PfContent["content/portfolioContent.ts (new)"]
|
||||||
|
PfContent --> ShootTypes["content/shootTypes.ts (from soorten-fotoshoots)"]
|
||||||
|
Filter --> Lib["lib/ helpers (new, pure)"]
|
||||||
|
Grid --> Lib
|
||||||
|
Lightbox --> Lib
|
||||||
|
Route --> Seo["seo.ts webPage() (from contact-page) + sitePages.ts"]
|
||||||
|
Seo --> Lhci["lighthouserc*.cjs (indexed paths)"]
|
||||||
|
classDef newpart fill:#FFA726,stroke:#E65100,stroke-width:1px,color:#000;
|
||||||
|
classDef changed fill:#63b3ed,stroke:#2b6cb0,stroke-width:1px,color:#000;
|
||||||
|
classDef existing fill:#e2e8f0,stroke:#4a5568,stroke-width:1px,color:#000;
|
||||||
|
classDef peer fill:#CE93D8,stroke:#6A1B9A,stroke-width:1px,color:#000;
|
||||||
|
class Route,Filter,Grid,Lightbox,InstaContent,PfContent,Lib newpart;
|
||||||
|
class Insta,Home,Seo,Lhci changed;
|
||||||
|
class PageIntro,Deferred existing;
|
||||||
|
class ShootTypes peer;
|
||||||
|
```
|
||||||
|
|
||||||
|
Text alternative: the new route composes PageIntro, a generic filter bar, the new masonry PortfolioGrid (which opens the new Lightbox and reuses DeferredImage and Reveal) and the shared InstagramGrid (also used by the homepage, with its own content); portfolio content references the shoot types delivered by soorten-fotoshoots (purple); filter, grid and lightbox rely on new pure helpers in lib; SEO uses contact-page's webPage() and the Lighthouse config follows the page registry.
|
||||||
|
|
||||||
|
- **Primary Component**: `web` (front-end SPA)
|
||||||
|
- **Shared Components**: `InstagramGrid` (Minor: moved, content type split), `PortfolioGrid`, `Lightbox`, filter bar (new, generic), `lib/` (new helpers), `seo.ts` (Minor: gallery JSON-LD on top of `webPage()`)
|
||||||
|
- **Dependent Components**: the homepage route (import path and content source of `InstagramGrid` only)
|
||||||
|
- **Supporting Components**: Lighthouse CI config (Configuration-only), `theme.ts` (possibly one token), LAYOUT.md (documentation)
|
||||||
|
- **Peer dependencies**: contact-page (`webPage()` commit), soorten-fotoshoots-page (`shootTypes.ts` commit)
|
||||||
|
|
||||||
|
### Risk Assessment
|
||||||
|
- **Risk Level**: Medium — the lightbox (focus trap, inert background, swipe, preloading) and the row-order masonry are the most intricate UI in the site so far; two pieces come from parallel branches
|
||||||
|
- **Rollback Complexity**: Easy (one branch, commits per unit)
|
||||||
|
- **Testing Complexity**: Moderate — dialog behaviour in jsdom (focus, keys), URL state, stateful PBT for the lightbox; Lighthouse for a photo-heavy page
|
||||||
|
|
||||||
|
## Workflow Visualization
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
flowchart TD
|
||||||
|
Start(["User Request"])
|
||||||
|
|
||||||
|
subgraph INCEPTION["🔵 INCEPTION PHASE"]
|
||||||
|
WD["Workspace Detection<br/><b>COMPLETED</b>"]
|
||||||
|
RE["Reverse Engineering<br/><b>SKIP</b>"]
|
||||||
|
RA["Requirements Analysis<br/><b>COMPLETED</b>"]
|
||||||
|
US["User Stories<br/><b>SKIP</b>"]
|
||||||
|
WP["Workflow Planning<br/><b>IN PROGRESS</b>"]
|
||||||
|
AD["Application Design<br/><b>EXECUTE</b>"]
|
||||||
|
UG["Units Generation<br/><b>SKIP</b>"]
|
||||||
|
end
|
||||||
|
|
||||||
|
subgraph CONSTRUCTION["🟢 CONSTRUCTION PHASE"]
|
||||||
|
FD["Functional Design<br/><b>EXECUTE (units 2 and 3)</b>"]
|
||||||
|
NFRA["NFR Requirements<br/><b>SKIP</b>"]
|
||||||
|
NFRD["NFR Design<br/><b>SKIP</b>"]
|
||||||
|
ID["Infrastructure Design<br/><b>SKIP</b>"]
|
||||||
|
CG["Code Generation<br/>(Planning + Generation)<br/><b>EXECUTE</b>"]
|
||||||
|
BT["Build and Test<br/><b>EXECUTE</b>"]
|
||||||
|
end
|
||||||
|
|
||||||
|
Start --> WD
|
||||||
|
WD --> RA
|
||||||
|
RA --> WP
|
||||||
|
WP --> AD
|
||||||
|
AD --> FD
|
||||||
|
FD --> CG
|
||||||
|
CG --> BT
|
||||||
|
BT --> End(["Complete"])
|
||||||
|
|
||||||
|
style WD fill:#4CAF50,stroke:#1B5E20,stroke-width:3px,color:#fff
|
||||||
|
style RA fill:#4CAF50,stroke:#1B5E20,stroke-width:3px,color:#fff
|
||||||
|
style WP fill:#4CAF50,stroke:#1B5E20,stroke-width:3px,color:#fff
|
||||||
|
style CG fill:#4CAF50,stroke:#1B5E20,stroke-width:3px,color:#fff
|
||||||
|
style BT fill:#4CAF50,stroke:#1B5E20,stroke-width:3px,color:#fff
|
||||||
|
style AD fill:#FFA726,stroke:#E65100,stroke-width:3px,stroke-dasharray: 5 5,color:#000
|
||||||
|
style FD fill:#FFA726,stroke:#E65100,stroke-width:3px,stroke-dasharray: 5 5,color:#000
|
||||||
|
style RE fill:#BDBDBD,stroke:#424242,stroke-width:2px,stroke-dasharray: 5 5,color:#000
|
||||||
|
style US fill:#BDBDBD,stroke:#424242,stroke-width:2px,stroke-dasharray: 5 5,color:#000
|
||||||
|
style UG fill:#BDBDBD,stroke:#424242,stroke-width:2px,stroke-dasharray: 5 5,color:#000
|
||||||
|
style NFRA fill:#BDBDBD,stroke:#424242,stroke-width:2px,stroke-dasharray: 5 5,color:#000
|
||||||
|
style NFRD fill:#BDBDBD,stroke:#424242,stroke-width:2px,stroke-dasharray: 5 5,color:#000
|
||||||
|
style ID fill:#BDBDBD,stroke:#424242,stroke-width:2px,stroke-dasharray: 5 5,color:#000
|
||||||
|
style INCEPTION fill:#BBDEFB,stroke:#1565C0,stroke-width:3px,color:#000
|
||||||
|
style CONSTRUCTION fill:#C8E6C9,stroke:#2E7D32,stroke-width:3px,color:#000
|
||||||
|
style Start fill:#CE93D8,stroke:#6A1B9A,stroke-width:3px,color:#000
|
||||||
|
style End fill:#CE93D8,stroke:#6A1B9A,stroke-width:3px,color:#000
|
||||||
|
|
||||||
|
linkStyle default stroke:#333,stroke-width:2px
|
||||||
|
```
|
||||||
|
|
||||||
|
Text alternative: completed Workspace Detection and Requirements Analysis lead to Workflow Planning, then Application Design, Functional Design (units 2 and 3), Code Generation per unit and Build and Test; Reverse Engineering, User Stories, Units Generation, NFR Requirements, NFR Design, Infrastructure Design and the Operations phase are skipped.
|
||||||
|
|
||||||
|
## Phases to Execute
|
||||||
|
|
||||||
|
### 🔵 INCEPTION PHASE
|
||||||
|
- [x] Workspace Detection (COMPLETED)
|
||||||
|
- [x] Reverse Engineering (SKIPPED)
|
||||||
|
- **Rationale**: shared artifacts are current with the over-mij blocks; team agreement that each feature only updates the lines about its own route/components (done during Code Generation)
|
||||||
|
- [x] Requirements Analysis (COMPLETED)
|
||||||
|
- [x] User Stories (SKIPPED)
|
||||||
|
- **Rationale**: one persona (the visitor); concrete FRs with behaviour, texts and edge cases; stories would restate the requirements
|
||||||
|
- [x] Execution Plan (IN PROGRESS)
|
||||||
|
- [ ] Application Design - EXECUTE (standard depth)
|
||||||
|
- **Rationale**: several new shared components need agreed boundaries and props before code, generic enough for other pages: `PortfolioGrid`, `Lightbox`, the filter bar, the moved `InstagramGrid` and its content type, the portfolio content model (two image sizes, `ShootTypeId`), which pure helpers go into `lib/`, where URL state lives (route search params vs. component state), whether the hero's swipe logic is extracted, and how the peer commits slot in
|
||||||
|
- [ ] Units Generation - SKIP
|
||||||
|
- **Rationale**: the split is fixed below (three units); no separate unit-of-work artifacts needed
|
||||||
|
|
||||||
|
### 🟢 CONSTRUCTION PHASE
|
||||||
|
- [ ] Functional Design - EXECUTE for units 2 and 3 (standard depth)
|
||||||
|
- **Rationale**: unit 2 has real logic (filtering, wrap-around navigation, lightbox state machine, masonry spans, preloading) whose rules and properties must be defined first (PBT-01). Unit 3 has the photo proposals (shoot type and alt text per photo, to be approved by the user — clarification 4), the OG photo choice, the `?shoot=` parsing rules and the `ImageGallery` structured data rules. Unit 1 is a behaviour-preserving move with nothing to design beyond Application Design
|
||||||
|
- [ ] NFR Requirements - SKIP
|
||||||
|
- **Rationale**: NFRs are set at requirements level (NFR-PF-01..06) and the stack is fixed (no new dependencies)
|
||||||
|
- [ ] NFR Design - SKIP
|
||||||
|
- **Rationale**: no new NFR patterns beyond what Application/Functional Design covers; existing ones (DeferredImage, Reveal, theme focus ring, `jsonLdScript`, reduced motion) are reused
|
||||||
|
- [ ] Infrastructure Design - SKIP
|
||||||
|
- **Rationale**: static assets only; no server config, CSP or deployment changes
|
||||||
|
- [ ] Code Generation - EXECUTE (ALWAYS, per unit)
|
||||||
|
- **Rationale**: implementation and tests
|
||||||
|
- [ ] Build and Test - EXECUTE (ALWAYS)
|
||||||
|
- **Rationale**: full `pnpm check` incl. Lighthouse for `/` and `/portfolio`; browser check of the lightbox on desktop and phone
|
||||||
|
|
||||||
|
### 🟡 OPERATIONS PHASE
|
||||||
|
- [ ] Deployment Setup, Monitoring Setup, Production Readiness Validation - SKIP
|
||||||
|
- **Rationale**: Operations Configuration = No (decided at Requirements Analysis); the existing pipeline deploys to test on merge
|
||||||
|
|
||||||
|
## Units of Work (in order)
|
||||||
|
|
||||||
|
| # | Unit | Scope | Requirements | Peer dependency |
|
||||||
|
|---|---|---|---|---|
|
||||||
|
| 1 | **Shared Instagram block** | Move `InstagramGrid` to `components/InstagramGrid/` with its own `InstagramContent` (`content/instagramContent.ts`); homepage switched over with unchanged output | FR-PF-08, NFR-PF-02 | none |
|
||||||
|
| 2 | **Gallery building blocks** | Generic `PortfolioGrid` (row-order masonry, eager first N, link fallback), `Lightbox` (dialog, prev/next/wrap, keys, swipe, counter, caption, focus, preloading), generic filter bar; pure helpers in `lib/` with example and property-based tests; arbitraries; possibly a `zIndex` token and an extracted swipe hook. Tested with fixture data; not yet on a page | FR-PF-03, 05, 06, 07; NFR-PF-01..03, 05 | none |
|
||||||
|
| 3 | **Portfolio page** | 10 photos (download, two sizes, alt texts and shoot types as approved), `portfolioContent.ts` + types; route with intro, filters wired to shoot types and `?shoot=`, grid, lightbox, Instagram; SEO (indexed, `ImageGallery` JSON-LD, `ogImage`, Lighthouse indexed paths); LAYOUT.md; RE lines about `/portfolio` and the new components | FR-PF-01, 02, 04, 09; SEO-PF-01..05; NFR-PF-04, 06 | `webPage()` (contact-page) and `shootTypes.ts` (soorten-fotoshoots), cherry-picked at the start of the unit |
|
||||||
|
|
||||||
|
Units 1 and 2 have no peer dependency, so they can be built while the peers' commits are still pending. Unit 3 starts by cherry-picking both peer commits; if either is missing, it stops and reports (no parallel copy). Each unit: one or more commits on `feature/portfolio-page`, full `pnpm check` (incl. Lighthouse) before its completion message; one PR to master at the end. Whichever parallel feature merges first, the others rebase onto master; the hot files (`sitePages.ts`, `lighthouserc*.cjs`, `active-features.md`) only carry each feature's own entries.
|
||||||
|
|
||||||
|
## Estimated Timeline
|
||||||
|
- **Total stages to execute from here**: 7 (Application Design, Functional Design ×2 units, Code Generation ×3 units, Build and Test)
|
||||||
|
- **Estimated Duration**: two to three working sessions, plus waiting time on the two peer commits before unit 3
|
||||||
|
|
||||||
|
## Success Criteria
|
||||||
|
- **Primary Goal**: a finished, indexed portfolio page with filters and an accessible lightbox, matching the design, with the live photos
|
||||||
|
- **Key Deliverables**: `/portfolio` page; shared `PortfolioGrid`, `Lightbox`, filter bar and `InstagramGrid`; `portfolioContent.ts` and `instagramContent.ts`; pure helpers with example and property-based tests; 10 photos in two sizes with approved alt texts and a 1200×630 preview image; updated LAYOUT.md, Lighthouse config and RE lines
|
||||||
|
- **Quality Gates**: `pnpm check` passes (lint, format, tests with coverage thresholds, build, audits, Lighthouse: accessibility 1.0, best practices 1.0, SEO 1.0, performance ≥ 0.9 for `/portfolio`, homepage budgets unchanged); axe clean incl. the open lightbox; homepage output unchanged after unit 1
|
||||||
|
- **Integration Testing**: route tests render `/` and `/portfolio` in the shell; `/portfolio?shoot=<id>` starts filtered and an invalid value falls back to "Alles"; the lightbox opens from the grid and returns focus; canonical URL has no parameters
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
# Verduidelijkingsvragen — Portfoliopagina
|
||||||
|
|
||||||
|
Je antwoorden zijn compleet. Drie keuzes beïnvloeden elkaar: **masonry** (vraag 2: B), **filters per shoottype** (vraag 9: B) en **een eigen bijschrift per foto** (vraag 4: C). Daarnaast botst masonry met "eerste rij direct laden" (vraag 7: A), want bij masonry is er geen vaste eerste rij. Deze vragen lossen dat op.
|
||||||
|
|
||||||
|
Vul per vraag de letter in na `[Answer]:`. Past geen enkele optie, kies dan de laatste (Anders) en licht toe.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Verduidelijking 1: Hoe de masonry werkt
|
||||||
|
|
||||||
|
Er zijn twee manieren, en die verschillen in volgorde en toegankelijkheid.
|
||||||
|
|
||||||
|
- A) **Masonry in rijvolgorde**: een raster waarin elke foto zijn eigen hoogte krijgt naar zijn verhouding, terwijl de volgorde links-naar-rechts, rij voor rij blijft. Toetsenbord, screenreader en de "eerste rij" volgen dan de volgorde die Andrea kiest. Er kunnen kleine gaatjes onderaan de kolommen ontstaan (aanbevolen)
|
||||||
|
- B) **Masonry in kolommen** (CSS-kolommen): de kolommen sluiten perfect aan, maar de volgorde loopt per kolom van boven naar beneden. Foto 2 staat dan onder foto 1 in plaats van ernaast, en tab-volgorde springt over de pagina
|
||||||
|
- X) Anders (beschrijf hieronder na de [Answer]:-tag)
|
||||||
|
|
||||||
|
[Answer]: A
|
||||||
|
|
||||||
|
## Verduidelijking 2: Welke foto's laden direct
|
||||||
|
|
||||||
|
Dit geldt bij masonry in plaats van "de eerste rij" uit vraag 7.
|
||||||
|
|
||||||
|
- A) De eerste foto's in de volgorde, zoveel als op desktop bovenaan in beeld staan (3, één per kolom), direct en met hoge prioriteit; de rest uitgesteld zoals afgesproken (aanbevolen)
|
||||||
|
- B) Alleen de allereerste foto direct, de rest uitgesteld
|
||||||
|
- X) Anders (beschrijf hieronder na de [Answer]:-tag)
|
||||||
|
|
||||||
|
[Answer]: A
|
||||||
|
|
||||||
|
## Verduidelijking 3: Bijschrift en shoottype
|
||||||
|
|
||||||
|
Bij vraag 4 koos je een eigen kort bijschrift per foto, en bij vraag 9 filters per shoottype. Elke foto krijgt dus toch al een shoottype.
|
||||||
|
|
||||||
|
- A) Het bijschrift is de naam van het shoottype ("Newbornshoot", "Gezinsshoot"), uit dezelfde data als de filters. Eén gegeven per foto, nooit tegenstrijdig (aanbevolen)
|
||||||
|
- B) Een vrij bijschrift per foto (bijvoorbeeld "Gezinsshoot in de Gooise heide"), los van het shoottype voor de filters
|
||||||
|
- X) Anders (beschrijf hieronder na de [Answer]:-tag)
|
||||||
|
|
||||||
|
[Answer]: A
|
||||||
|
|
||||||
|
## Verduidelijking 4: Welk shoottype elke foto heeft
|
||||||
|
|
||||||
|
Van de 10 live foto's heeft er maar één een omschrijving ("Zwanger koppel fotoshoot").
|
||||||
|
|
||||||
|
- A) Ik download de foto's, stel per foto een shoottype en alt-tekst voor in het functioneel ontwerp, en jij (of Andrea) keurt ze goed (aanbevolen)
|
||||||
|
- B) Ik vul ze nu in op basis van de bestandsnamen en de live site, zonder aparte controle
|
||||||
|
- X) Anders (beschrijf hieronder na de [Answer]:-tag)
|
||||||
|
|
||||||
|
[Answer]: A
|
||||||
|
|
||||||
|
## Verduidelijking 5: Het gekozen filter in de URL
|
||||||
|
|
||||||
|
Bij vraag 5 koos je geen link naar één foto. Een link naar een **filter** is iets anders: de pagina Soorten fotoshoots zou dan per shoot kunnen linken naar "Bekijk meer newbornfoto's" → `/portfolio?shoot=newborn`.
|
||||||
|
|
||||||
|
- A) Ja: het filter staat in de URL (`?shoot=newborn`), zoals `?pakket=` op de homepage. Een ongeldige waarde toont gewoon "Alles". De canonieke URL blijft `/portfolio`, zodat zoekmachines geen dubbele pagina's zien (aanbevolen)
|
||||||
|
- B) Nee: het filter is alleen een weergave op de pagina en begint altijd op "Alles"
|
||||||
|
- X) Anders (beschrijf hieronder na de [Answer]:-tag)
|
||||||
|
|
||||||
|
[Answer]: A
|
||||||
|
|
||||||
|
## Verduidelijking 6: Lightbox en filter
|
||||||
|
|
||||||
|
- A) De lightbox bladert alleen door de foto's van het gekozen filter, en de teller telt die ("2 / 4") (aanbevolen)
|
||||||
|
- B) De lightbox bladert altijd door alle foto's, ook als er een filter aan staat
|
||||||
|
- X) Anders (beschrijf hieronder na de [Answer]:-tag)
|
||||||
|
|
||||||
|
[Answer]: A
|
||||||
|
|
||||||
|
## Verduidelijking 7: Filters zonder foto's
|
||||||
|
|
||||||
|
Bij 10 foto's heeft niet elk shoottype per se een foto (er is bijvoorbeeld misschien geen portretfoto).
|
||||||
|
|
||||||
|
- A) Alleen filters tonen voor shoottypes met minstens één foto, plus "Alles"; is er maar één shoottype, dan geen filterbalk (aanbevolen)
|
||||||
|
- B) Altijd alle shoottypes tonen; een leeg filter toont een korte melding
|
||||||
|
- X) Anders (beschrijf hieronder na de [Answer]:-tag)
|
||||||
|
|
||||||
|
[Answer]: A
|
||||||
@@ -0,0 +1,188 @@
|
|||||||
|
# Verificatievragen — Portfoliopagina
|
||||||
|
|
||||||
|
Al vastgelegd (geen vraag nodig):
|
||||||
|
|
||||||
|
- **Route** `/portfolio` bestaat al als placeholder ([portfolio.tsx](../../../../../web/src/routes/portfolio.tsx)) en wordt de echte pagina. De navigatie, de footer en de link "mijn portfolio" op Over mij verwijzen er al naar.
|
||||||
|
- **Layout en stijl** komen uit het ontwerp ([portfolio.html](../../../../../design/andreaslop-static/portfolio.html)): paginakop (eyebrow "Werk", h1 "Portfolio", intro) → fotoraster → Instagram. Foto's en teksten komen als vaste data in `web/src/content/`, in de vorm die de API straks levert (`/api/portfolio` in het ontwerp-README).
|
||||||
|
- **Hergebruik eerst**: `PageIntro` (h1), `PageSection`, `SectionHeading`, `DeferredImage`, `Reveal`, `InstagramGrid`, plus de theme-tokens en recipes (o.a. `carouselControl`/`iconControl` voor de knoppen). Geen hardgecodeerde kleuren, geen CSS-bestanden en geen nieuwe dependencies.
|
||||||
|
- **Toegankelijkheid**: dezelfde lat als bij homepage en Over mij: één h1, secties met een toegankelijke naam, contrast ≥ 4.5:1, zichtbare focus, doelen ≥ 44px, `prefers-reduced-motion`, axe in de tests en Lighthouse accessibility 1.0.
|
||||||
|
- **Indexeren**: de pagina gaat live, dus `indexed: true` in `sitePages.ts`, in de sitemap, en in `lighthouserc.cjs` naar de geïndexeerde paden (SEO 1.0).
|
||||||
|
- **Teamafspraken** (parallelle features): de JSON-LD loopt via de gedeelde `webPage()`-helper van contact-page; `PortfolioGrid`, `Lightbox` en het verplaatsen van `InstagramGrid` zijn van deze feature; foto's alleen voor portfolio komen in `web/src/assets/portfolio/`, shootfoto's (newborn, zwangerschap, gezin, loveshoot, portret) levert soorten-fotoshoots in `web/src/assets/shoots/`.
|
||||||
|
- **LAYOUT.md** heeft voor Portfolio al de blokken Portfolio → Instagram; dat klopt met het ontwerp (de paginakop hoort bij het blok Portfolio, zoals op de andere pagina's).
|
||||||
|
- **Codecommentaar** in het Engels in nieuwe code; teksten voor bezoekers in het Nederlands.
|
||||||
|
|
||||||
|
Wat ik op de live site (andreaslop.nl/portfolio) zag en wat afwijkt van het ontwerp:
|
||||||
|
|
||||||
|
| Onderdeel | Ontwerp | Live site |
|
||||||
|
| --------------------- | -------------------------------------------------------------------------------------------------------------- | ------------------------------------------- |
|
||||||
|
| Paginakop | eyebrow "Werk", h1 "Portfolio", intro "Een selectie uit mijn werk. Klik op een foto om hem groot te bekijken." | **geen h1 en geen intro** |
|
||||||
|
| Foto's | **8** foto's (deels de homepagefoto's intro-2 en intro-4, plus newborn, portret en vier portfoliofoto's) | **10** andere, recentere foto's (2019–2026) |
|
||||||
|
| Raster | 3 kolommen, alles bijgesneden tot 3:4; 2 kolommen op tablet, 1 op telefoon | raster zonder bijschriften |
|
||||||
|
| Groot bekijken | lightbox met vorige/volgende, sluiten, bijschrift (= alt-tekst) en teller "3 / 8" | niet duidelijk aanwezig |
|
||||||
|
| Alt-teksten | algemeen ("Natuurlijke lifestylefoto") | **9 van de 10 zonder alt-tekst** |
|
||||||
|
| Filters / categorieën | geen | geen |
|
||||||
|
| Instagram | zelfde blok als op de homepage | zelfde blok als op de homepage |
|
||||||
|
|
||||||
|
Vul per vraag de letter in na `[Answer]:`. Past geen enkele optie, kies dan de laatste (Anders) en licht toe.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Vraag 1: Welke foto's
|
||||||
|
|
||||||
|
Welke foto's komen in het portfolio?
|
||||||
|
|
||||||
|
- A) De **10 foto's van de live site**, in dezelfde volgorde: originelen downloaden, eenmalig verkleinen en comprimeren (zoals bij homepage en Over mij), en per foto een beschrijvende Nederlandse alt-tekst die Andrea later kan nalezen (aanbevolen)
|
||||||
|
- B) De **8 foto's uit het ontwerp**, met beschrijvende alt-teksten
|
||||||
|
- C) De 10 live foto's, aangevuld met de shootfoto's die soorten-fotoshoots toch al verwerkt (newborn, zwangerschap, gezin, loveshoot, portret)
|
||||||
|
- X) Anders (beschrijf hieronder na de [Answer]:-tag)
|
||||||
|
|
||||||
|
[Answer]: A
|
||||||
|
|
||||||
|
## Vraag 2: Opbouw van het raster
|
||||||
|
|
||||||
|
Het ontwerp snijdt elke foto bij tot 3:4 (staand). Liggende foto's verliezen dan veel van het beeld; in de lightbox is de hele foto wel te zien.
|
||||||
|
|
||||||
|
- A) Zoals het ontwerp: gelijke tegels van 3:4, 3 kolommen op desktop, 2 op tablet, 1 op telefoon. Rustig en voorspelbaar; per foto een instelbaar focuspunt zodat het bijsnijden goed uitvalt (aanbevolen)
|
||||||
|
- B) Masonry: elke foto in zijn eigen verhouding, kolommen van ongelijke hoogte (meer van elke foto te zien, onrustiger, en de leesvolgorde voor toetsenbord en screenreader loopt per kolom in plaats van per rij)
|
||||||
|
- C) Gelijke tegels met af en toe een dubbel-hoge tegel (`portfolio-item--tall` staat al in de CSS van het ontwerp, maar wordt niet gebruikt)
|
||||||
|
- X) Anders (beschrijf hieronder na de [Answer]:-tag)
|
||||||
|
|
||||||
|
[Answer]: B
|
||||||
|
|
||||||
|
## Vraag 3: Groot bekijken (lightbox)
|
||||||
|
|
||||||
|
- A) Een toegankelijke lightbox zoals in het ontwerp: modaal dialoogvenster op Chakra `Dialog` met sluiten, vorige/volgende (knoppen, pijltjestoetsen, vegen op telefoon), teller "3 / 10", Escape sluit, focus blijft in het venster en keert na sluiten terug naar de aangeklikte foto, rondgaan na de laatste foto. Zonder JavaScript of vóór het laden opent de link gewoon de grote foto (aanbevolen)
|
||||||
|
- B) Geen lightbox: alleen het raster
|
||||||
|
- C) Elke foto opent de grote versie in een nieuw tabblad
|
||||||
|
- X) Anders (beschrijf hieronder na de [Answer]:-tag)
|
||||||
|
|
||||||
|
[Answer]: A
|
||||||
|
|
||||||
|
## Vraag 4: Bijschrift in de lightbox
|
||||||
|
|
||||||
|
Het ontwerp toont de alt-tekst ook als zichtbaar bijschrift. Een goede alt-tekst beschrijft wat er te zien is ("Moeder tilt haar lachende dochter op in het bos"); als bijschrift leest dat soms wat klinisch.
|
||||||
|
|
||||||
|
- A) Geen zichtbaar bijschrift, alleen de teller; de alt-tekst blijft voor screenreaders (aanbevolen)
|
||||||
|
- B) De alt-tekst ook zichtbaar als bijschrift (zoals het ontwerp)
|
||||||
|
- C) Een apart, kort bijschrift per foto (bijvoorbeeld het soort shoot: "Gezinsshoot")
|
||||||
|
- X) Anders (beschrijf hieronder na de [Answer]:-tag)
|
||||||
|
|
||||||
|
[Answer]: C
|
||||||
|
|
||||||
|
## Vraag 5: Link naar één foto (deeplink)
|
||||||
|
|
||||||
|
- A) Nee: de lightbox is alleen een weergave op de pagina; de terugknop van de browser verlaat de pagina (aanbevolen: eenvoudiger, geen extra URL's om te indexeren)
|
||||||
|
- B) Ja: de open foto staat in de URL (bijvoorbeeld `/portfolio?foto=3`), zodat je één foto kunt delen en de terugknop (ook op telefoon) de lightbox sluit, zoals `?pakket=` op de homepage
|
||||||
|
- X) Anders (beschrijf hieronder na de [Answer]:-tag)
|
||||||
|
|
||||||
|
[Answer]: A
|
||||||
|
|
||||||
|
## Vraag 6: Formaat van de foto's
|
||||||
|
|
||||||
|
- A) Twee formaten per foto: een kleine voor het raster (ca. 800 px breed) en een grote voor de lightbox (ca. 1600–2000 px), die pas laadt als je de foto opent; de volgende en vorige foto worden vast vooruit geladen (aanbevolen)
|
||||||
|
- B) Eén formaat (groot) voor raster én lightbox: eenvoudiger, maar zwaarder voor telefoons en de prestatiescore
|
||||||
|
- X) Anders (beschrijf hieronder na de [Answer]:-tag)
|
||||||
|
|
||||||
|
[Answer]: A
|
||||||
|
|
||||||
|
## Vraag 7: Laden van het raster
|
||||||
|
|
||||||
|
De eerste rij foto's staat op desktop direct in beeld en telt mee voor de laadsnelheid (LCP).
|
||||||
|
|
||||||
|
- A) De foto's van de eerste rij direct laden met hoge prioriteit, de rest pas na het laden van de pagina en als ze bijna in beeld komen (`DeferredImage`, zoals op de homepage) (aanbevolen)
|
||||||
|
- B) Alle foto's uitgesteld laden
|
||||||
|
- X) Anders (beschrijf hieronder na de [Answer]:-tag)
|
||||||
|
|
||||||
|
[Answer]: A
|
||||||
|
|
||||||
|
## Vraag 8: Introtekst
|
||||||
|
|
||||||
|
- A) Eyebrow "Werk", h1 "Portfolio" en de intro uit het ontwerp, met "Klik" aangepast zodat het ook op telefoon klopt: "Een selectie uit mijn werk. Klik of tik op een foto om hem groot te bekijken." (aanbevolen)
|
||||||
|
- B) Precies de tekst uit het ontwerp
|
||||||
|
- C) Een intro zonder instructie, bijvoorbeeld alleen "Een selectie uit mijn werk."
|
||||||
|
- X) Anders (beschrijf hieronder na de [Answer]:-tag)
|
||||||
|
|
||||||
|
[Answer]: A
|
||||||
|
|
||||||
|
## Vraag 9: Categorieën of filters
|
||||||
|
|
||||||
|
Ontwerp en live site hebben geen filters. Soorten-fotoshoots maakt wel een lijst met shoottypen (`shootTypes.ts`).
|
||||||
|
|
||||||
|
- A) Geen filters; één raster, de volgorde bepaalt Andrea (aanbevolen)
|
||||||
|
- B) Filters per shoottype (Alles, Newborn, Zwangerschap, Gezin, Loveshoot, Portret), op basis van `shootTypes.ts`; elke foto krijgt een shoottype
|
||||||
|
- C) Geen filters nu, maar wel per foto het shoottype vastleggen in de data, zodat filters later makkelijk kunnen
|
||||||
|
- X) Anders (beschrijf hieronder na de [Answer]:-tag)
|
||||||
|
|
||||||
|
[Answer]: B
|
||||||
|
|
||||||
|
## Vraag 10: Instagram-blok
|
||||||
|
|
||||||
|
`InstagramGrid` staat nu in `components/home/` en krijgt zijn tekst en foto's uit `homeContent`.
|
||||||
|
|
||||||
|
- A) `InstagramGrid` verplaatsen naar een gedeelde plek (`components/InstagramGrid/`) met zijn inhoud in eigen content (bijvoorbeeld `instagramContent.ts`), en op de homepage en het portfolio hetzelfde blok met dezelfde foto's tonen (aanbevolen)
|
||||||
|
- B) Zelfde gedeelde component, maar met andere foto's op het portfolio
|
||||||
|
- C) Geen Instagram-blok op het portfolio
|
||||||
|
- X) Anders (beschrijf hieronder na de [Answer]:-tag)
|
||||||
|
|
||||||
|
[Answer]: A
|
||||||
|
|
||||||
|
## Vraag 11: Titel en beschrijving (SEO)
|
||||||
|
|
||||||
|
Nu: titel "Portfolio | Andrea Slop Fotografie", beschrijving "Bekijk het portfolio van Andrea Slop Fotografie: spontane lifestylefoto's van gezinnen, stellen, zwangerschappen en newborns in Huizen en omgeving."
|
||||||
|
|
||||||
|
- A) Titel met zoekwoorden, bijvoorbeeld "Portfolio – lifestyle fotografie in Huizen", en de beschrijving controleren tegen de gekozen foto's. Ik stel ze voor in requirements.md en jij keurt ze goed (aanbevolen)
|
||||||
|
- B) Titel en beschrijving laten zoals ze zijn
|
||||||
|
- X) Anders (beschrijf hieronder na de [Answer]:-tag)
|
||||||
|
|
||||||
|
[Answer]: B
|
||||||
|
|
||||||
|
## Vraag 12: Gestructureerde data (JSON-LD)
|
||||||
|
|
||||||
|
- A) Een `ImageGallery` via de gedeelde `webPage()`-helper, met per foto een `ImageObject` (URL, beschrijving = alt-tekst, maker = Andrea via de bestaande `Person`, rechthebbende = het bedrijf). Zo kan Google de foto's aan Andrea en het bedrijf koppelen (aanbevolen)
|
||||||
|
- B) Alleen een `ImageGallery` zonder lijst met foto's
|
||||||
|
- C) Geen extra gestructureerde data
|
||||||
|
- X) Anders (beschrijf hieronder na de [Answer]:-tag)
|
||||||
|
|
||||||
|
[Answer]: A
|
||||||
|
|
||||||
|
## Vraag 13: Preview-afbeelding bij delen (Open Graph)
|
||||||
|
|
||||||
|
- A) Een eigen preview voor deze pagina: een van de portfoliofoto's, bijgesneden tot 1200×630 in `web/public/` (ik stel er een voor, jij kiest) (aanbevolen)
|
||||||
|
- B) De standaardafbeelding van de site houden
|
||||||
|
- X) Anders (beschrijf hieronder na de [Answer]:-tag)
|
||||||
|
|
||||||
|
[Answer]: A
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Vraag: Beveiligingsextensies
|
||||||
|
|
||||||
|
Moeten de beveiligingsregels als harde vereisten worden afgedwongen voor dit project?
|
||||||
|
|
||||||
|
- A) Ja — dwing alle BEVEILIGINGSREGELS af als blokkerende vereisten (aanbevolen voor productietoepassingen)
|
||||||
|
- B) Nee — sla alle BEVEILIGINGSREGELS over (geschikt voor PoC's, prototypes en experimentele projecten)
|
||||||
|
- X) Anders (beschrijf hieronder na de [Answer]:-tag)
|
||||||
|
|
||||||
|
[Answer]: A
|
||||||
|
|
||||||
|
## Vraag: Property-Based Testing Extensie
|
||||||
|
|
||||||
|
Moeten de property-based testing (PBT) regels worden afgedwongen voor dit project?
|
||||||
|
|
||||||
|
- A) Ja — dwing alle PBT-regels af als blokkerende vereisten (aanbevolen voor projecten met bedrijfslogica, datatransformaties, serialisatie of stateful componenten)
|
||||||
|
- B) Gedeeltelijk — dwing PBT-regels alleen af voor pure functies en serialisatie round-trips (geschikt voor projecten met beperkte algoritmische complexiteit)
|
||||||
|
- C) Nee — sla alle PBT-regels over (geschikt voor eenvoudige CRUD-applicaties, UI-only projecten of dunne integratielagen zonder significante bedrijfslogica)
|
||||||
|
- X) Anders (beschrijf hieronder na de [Answer]:-tag)
|
||||||
|
|
||||||
|
[Answer]: A
|
||||||
|
|
||||||
|
## Vraag: Operations-fase
|
||||||
|
|
||||||
|
Moet deze feature na Construction door de Operations-fase (deployment en monitoring inrichten)? Deployment naar test en productie en de monitoring (Sentry, Umami, UptimeRobot) bestaan al.
|
||||||
|
|
||||||
|
- A) Ja — na Construction de Operations-fase doorlopen (deployment + monitoring inrichten)
|
||||||
|
- B) Nee — stoppen na Build and Test (deployment en monitoring vallen buiten deze feature)
|
||||||
|
- C) Weet ik nog niet — vraag het opnieuw na de Construction-fase
|
||||||
|
- X) Anders (beschrijf hieronder na de [Answer]:-tag)
|
||||||
|
|
||||||
|
[Answer]: B
|
||||||
@@ -0,0 +1,217 @@
|
|||||||
|
# Requirements — Portfolio Page
|
||||||
|
|
||||||
|
## Intent Analysis
|
||||||
|
- **User Request**: build the portfolio page, again with attention to SEO, accessibility, reusability of code elements, Chakra and theming, like the previous feature (Over mij page).
|
||||||
|
- **Request Type**: New Feature (replaces the `/portfolio` placeholder with the real page) with a small supporting refactor (`InstagramGrid` moved to a shared component with its own content)
|
||||||
|
- **Scope Estimate**: Multiple components within one package (`web/`), plus [LAYOUT.md](../../../../../LAYOUT.md)
|
||||||
|
- **Complexity Estimate**: Moderate — a filterable masonry photo grid, an accessible lightbox (dialog, keyboard, swipe, focus management), URL state for the filter, two image sizes per photo, structured data for an image gallery, and coordination with two parallel features (shared `webPage()` helper, shared shoot types)
|
||||||
|
- **Requirements Depth**: Standard
|
||||||
|
|
||||||
|
## Source of Truth
|
||||||
|
- **Layout and styling**: [design/andreaslop-static/portfolio.html](../../../../../design/andreaslop-static/portfolio.html), `assets/css/style.css` (`.page-head`, `.section--flush-top`, `.portfolio-grid`, `.portfolio-item`, `.lightbox*`, `.instagram*`) and the lightbox behaviour in `assets/js/main.js` (`initLightbox`).
|
||||||
|
- **Photos**: the 10 photos of the live page https://andreaslop.nl/portfolio/ as of 2026-10-24, in that order. *Source: Q1 = A*
|
||||||
|
- **Decisions**: [requirement-verification-questions.md](requirement-verification-questions.md), [requirement-clarification-questions.md](requirement-clarification-questions.md)
|
||||||
|
- **Parallel-work agreements**: [aidlc-state.md § Parallel Work Agreements](../../aidlc-state.md)
|
||||||
|
|
||||||
|
## Page Structure
|
||||||
|
Shell header → **Intro** (page head, h1) → **Portfolio** (filter bar + masonry grid; lightbox on demand) → **Instagram** → shell footer.
|
||||||
|
|
||||||
|
## Dependencies on Parallel Features
|
||||||
|
- **`webPage(type: WebPageType, path, extra)`** in `seo.ts`, delivered by contact-page as a separate commit; this feature cherry-picks it and does not write its own page-level JSON-LD helper.
|
||||||
|
- **`ShootTypeId` / `ShootType` and `content/shootTypes.ts`**, delivered by soorten-fotoshoots-page as a separate commit (types, list, their shoot photos); this feature cherry-picks it and references shoot types only by `ShootTypeId`. Order of the list: newborn, zwangerschap, gezin, loveshoot, portret.
|
||||||
|
- If a dependency is not available when its unit starts, Code Generation stops at that point and reports it; no parallel copy is written.
|
||||||
|
|
||||||
|
## Out of Scope
|
||||||
|
- A link to a single photo (deep link); the lightbox is a view on the page only. *Source: Q5 = A*
|
||||||
|
- Changing the page title or meta description. *Source: Q11 = B*
|
||||||
|
- The "Bekijk meer …foto's" links on the Soorten fotoshoots page (that feature's scope; this feature only provides the `?shoot=` URL they can link to).
|
||||||
|
- A responsive image pipeline (srcset/WebP generated at build time); the two fixed sizes per photo are prepared once by hand.
|
||||||
|
- Operations phase. *Source: Operations = B*
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Functional Requirements
|
||||||
|
|
||||||
|
### FR-PF-01 Intro (page head)
|
||||||
|
- Eyebrow **"Werk"**, the page's only h1 **"Portfolio"**, and the intro **"Een selectie uit mijn werk. Klik of tik op een foto om hem groot te bekijken."**, via the existing `PageIntro` (design `.page-head`). *Source: Q8 = A*
|
||||||
|
|
||||||
|
### FR-PF-02 Photo data
|
||||||
|
- 10 portfolio photos, in the live order, as API-shaped static content in `web/src/content/` (e.g. `portfolioContent.ts`, interfaces in `content/types.ts`). Per photo:
|
||||||
|
- a stable `id`;
|
||||||
|
- `shootType: ShootTypeId`;
|
||||||
|
- a **grid image** (≈ 800 px wide) and a **large image** (≈ 1600–2000 px wide), each with intrinsic `width`/`height`; the grid image keeps the photo's own aspect ratio (no crop);
|
||||||
|
- a descriptive Dutch **alt text** (shared by both sizes).
|
||||||
|
- Photos are downloaded from andreaslop.nl in their original size, resized once to both sizes, compressed and stored in `web/src/assets/portfolio/` — same approach as homepage and Over mij, no new dependency. *Source: Q1 = A, Q6 = A*
|
||||||
|
- The shoot type and alt text of every photo are **proposed in Functional Design after looking at the photo**, and approved by the user (or Andrea) before code generation. *Source: clarification 4 = A*
|
||||||
|
|
||||||
|
### FR-PF-03 Filter bar
|
||||||
|
- A row of filter controls above the grid: **"Alles"** first, then one control per shoot type **that has at least one photo**, in the order of `shootTypes.ts`, labelled with the shoot type's short `name` (e.g. "Newborn", "Gezin"). *Source: Q9 = B, clarification 7 = A*
|
||||||
|
- If the photos cover only one shoot type, the filter bar is not shown.
|
||||||
|
- Exactly one filter is active; the active control is visually and programmatically marked (e.g. `aria-pressed` or a radio group — decided in design).
|
||||||
|
- Choosing a filter shows only that shoot type's photos, in their original relative order; "Alles" shows all photos.
|
||||||
|
- The number of shown photos is announced politely to screen readers after a change (e.g. "4 foto's").
|
||||||
|
- Focus stays on the chosen control; the page does not scroll.
|
||||||
|
|
||||||
|
### FR-PF-04 Filter in the URL
|
||||||
|
- The active filter is reflected as a search parameter: `/portfolio?shoot=<ShootTypeId>`; "Alles" has no parameter. *Source: clarification 5 = A*
|
||||||
|
- Opening the page with `?shoot=<id>` starts with that filter active.
|
||||||
|
- A missing, unknown or empty value, or a shoot type without photos, shows "Alles" (no error, no message); the value is never rendered.
|
||||||
|
- Changing the filter updates the URL without adding a history entry per click (decided in design: replace vs. push), and without a page reload or scroll jump.
|
||||||
|
- The canonical URL stays `https://andreaslop.nl/portfolio` for every filter (no duplicate pages for search engines); the sitemap lists only `/portfolio`.
|
||||||
|
|
||||||
|
### FR-PF-05 Masonry grid
|
||||||
|
- A masonry grid in **row order**: every photo is shown whole in its own aspect ratio, with columns of uneven height, while the DOM, tab and reading order stay left-to-right, row by row (the order Andrea chooses). Small gaps at the bottom of columns are acceptable. *Source: Q2 = B, clarification 1 = A*
|
||||||
|
- Columns: 3 on desktop, 2 on tablet, 1 on phones (the design's breakpoints on the theme breakpoints); gap from the theme (`gridGap` or the design's `--gap`).
|
||||||
|
- Each photo is a link-like control (`<a href>` to the large image) that opens the lightbox (FR-PF-06); without JavaScript, or before the app has loaded, it opens the large image itself. Its accessible name is the photo's alt text plus a hint that it opens a larger view.
|
||||||
|
- Hover and keyboard focus show the design's effect (slight zoom + darkening overlay, `cursor: zoom-in`); zoom is left out under `prefers-reduced-motion`; the theme focus ring is visible above neighbouring tiles.
|
||||||
|
- Photos fade in with the existing `Reveal`, content always in the DOM.
|
||||||
|
|
||||||
|
### FR-PF-06 Lightbox
|
||||||
|
- A modal dialog (Chakra `Dialog`, design `.lightbox`) showing the large image whole (`object-fit: contain`, fits the viewport) on a dark backdrop. *Source: Q3 = A*
|
||||||
|
- Controls: **close**, **previous**, **next** (buttons with Dutch accessible names, ≥ 44×44 px), keyboard **Escape** (close), **←/→** (previous/next), **swipe** left/right on touch devices; a click on the backdrop closes.
|
||||||
|
- Browsing **wraps around** (after the last photo comes the first, and vice versa) and covers **only the photos of the active filter**; the counter shows position and total within that set, e.g. "2 / 4". *Source: clarification 6 = A*
|
||||||
|
- **Caption**: the shoot type's full label (`shootLabel`, e.g. "Newbornshoot") as a visible caption; the alt text stays on the image for screen readers. *Source: Q4 = C, clarification 3 = A*
|
||||||
|
- Focus moves into the dialog on open, is trapped while open, and returns to the photo that was opened (or, after browsing, to the tile of the photo shown last) on close. Background content is inert and does not scroll.
|
||||||
|
- The dialog has an accessible name (e.g. "Foto groot bekijken"); the position change ("Foto 3 van 10") is announced politely when browsing.
|
||||||
|
- With a single photo in the active set, previous/next and the counter are hidden.
|
||||||
|
- Opening and switching respect `prefers-reduced-motion` (no fade/slide).
|
||||||
|
|
||||||
|
### FR-PF-07 Image loading
|
||||||
|
- **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
|
||||||
|
- Move `InstagramGrid` from `components/home/` to a shared `components/InstagramGrid/`, with its texts and photos in their own content module (e.g. `content/instagramContent.ts` with an `InstagramContent` type) instead of `homeContent.instagram`. *Source: Q10 = A*
|
||||||
|
- Use it on the homepage (unchanged output and behaviour) and on this page below the grid, with the same photos and the same profile link (checked https link via `visibleSocials`; without a valid link the block is left out, as on the homepage).
|
||||||
|
|
||||||
|
### FR-PF-09 LAYOUT.md
|
||||||
|
- Update the "Portfolio" diagram to **Intro → Portfolio → Instagram**, following [.ai/layout-conventions.md](../../../../../.ai/layout-conventions.md). "Intro" is added for consistency with the other page diagrams (About me, Types of shoots, Contact), which start with their page head. The filter bar is part of the Portfolio block.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## SEO Requirements
|
||||||
|
|
||||||
|
### SEO-PF-01 Indexing
|
||||||
|
- `/portfolio` becomes **indexed** when this feature merges: `indexed: true` in `sitePages.ts` (no `robots noindex`, included in `sitemap.xml`), and moved to the indexed paths in `web/lighthouserc.cjs` / `.desktop.cjs` (the existing sync test must pass). Only this feature's own entries are changed (team agreement).
|
||||||
|
|
||||||
|
### SEO-PF-02 Title and description
|
||||||
|
- Unchanged: title "Portfolio" (rendered "Portfolio | Andrea Slop Fotografie") and the existing description. *Source: Q11 = B*
|
||||||
|
|
||||||
|
### SEO-PF-03 Structured data
|
||||||
|
- An `ImageGallery` JSON-LD for `/portfolio`, built with the shared `webPage('ImageGallery', '/portfolio', extra)` helper. `extra` holds the photo list as `ImageObject`s (e.g. `associatedMedia`), each with:
|
||||||
|
- `contentUrl`: absolute https URL of the large image;
|
||||||
|
- `thumbnailUrl`: absolute https URL of the grid image (optional, decided in design);
|
||||||
|
- `description`: the alt text;
|
||||||
|
- `creator`: Andrea, by `@id` (`personId`);
|
||||||
|
- `copyrightHolder`: the business, by `@id` (`businessId`).
|
||||||
|
- Always all 10 photos, independent of the active filter. No e-mail address. Escaped through the existing `jsonLdScript`. Built by pure functions in `seo.ts` (100% coverage threshold applies). *Source: Q12 = A*
|
||||||
|
|
||||||
|
### SEO-PF-04 Preview image (Open Graph)
|
||||||
|
- A page-specific preview image: one portfolio photo cropped to **1200×630**, stored in `web/public/` (stable URL, outside the bundle), set as the page's `ogImage` in `sitePages.ts` with its own alt text. The photo is proposed in Functional Design; the user chooses. *Source: Q13 = A*
|
||||||
|
|
||||||
|
### SEO-PF-05 Semantic structure
|
||||||
|
- One h1; `section` landmarks named by their heading; heading outline h1 Portfolio → h2 for the grid section (visually hidden if the design shows no heading, e.g. "Foto's") → h2 Instagram; images with width/height and descriptive alt texts; grid photos as a list (`ul`/`li`).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Non-Functional Requirements
|
||||||
|
|
||||||
|
### NFR-PF-01 Accessibility (WCAG 2.1 AA as guideline)
|
||||||
|
- Heading outline and landmarks as in SEO-PF-05; no skipped levels.
|
||||||
|
- Text contrast ≥ 4.5:1 (also the lightbox caption and counter on the dark backdrop); non-text contrast ≥ 3:1 for the filter controls' active state and the lightbox buttons.
|
||||||
|
- All controls keyboard operable with the theme focus ring; targets ≥ 44×44 px; nothing depends on hover or on swiping alone.
|
||||||
|
- Lightbox as specified in FR-PF-06 (dialog semantics, focus trap and return, Escape, inert background, announcements); filter changes announced (FR-PF-03).
|
||||||
|
- `prefers-reduced-motion` respected (reveal, tile zoom, lightbox transitions).
|
||||||
|
- Works at 200% zoom and from 320 px wide; the lightbox controls stay reachable on small and landscape phones.
|
||||||
|
- Axe checks in the component and route tests (including the open lightbox); Lighthouse accessibility 1.0 for `/portfolio` (mobile and desktop).
|
||||||
|
|
||||||
|
### NFR-PF-02 Styling and reuse
|
||||||
|
- Reuse before building: `PageIntro`, `PageSection`, `SectionHeading`, `DeferredImage`, `Reveal`, `InstagramGrid` (shared), `RouterLink`, the recipes `iconControl` / `carouselControl` for the lightbox buttons, theme tokens (`paper.deep`, `gridGap`, durations, easing, z-index) and text styles. A new `zIndex` token for the lightbox if needed.
|
||||||
|
- Swipe handling: reuse or extract the existing swipe logic of the hero slider (`useHeroSlider`) instead of writing a second one, if it fits; decided in design.
|
||||||
|
- New shared components get a generic API so other pages can use them: **`PortfolioGrid`** (masonry grid of photos that open a lightbox) and **`Lightbox`** (dialog over a list of images with prev/next, counter and caption). The filter bar is generic over its options (id + label), not tied to shoot types.
|
||||||
|
- Logic that decides what is shown lives in pure helpers in `lib/` (e.g. visible filters, filtered photos, URL parameter parsing, wrap-around navigation, masonry row spans), not in components.
|
||||||
|
- No hard-coded colours, CSS files or Tailwind; Chakra primitives where they fit (`Dialog`, `Grid`, `Image`).
|
||||||
|
- Components in their own folders under `components/`, Prettier style; code comments in English; visitor-facing texts in Dutch.
|
||||||
|
- Responsive from 320 px to ultrawide, mobile-first, no horizontal scroll.
|
||||||
|
|
||||||
|
### NFR-PF-03 Testing
|
||||||
|
- **Example-based**: page content and structure (heading outline, section names, list of photos, intro text), filter bar (which filters appear, active state, URL sync, invalid parameter → "Alles", announcements), grid (order, link targets, first 3 eager), lightbox (open from a tile, prev/next/wrap, counter, caption, Escape, backdrop close, focus trap and return, filtered set, single photo), the homepage `InstagramGrid` unchanged in output, head tags (title, description, no `noindex`, canonical without parameters, `og:image`), structured data, axe checks.
|
||||||
|
- **Property-based** (fast-check, shared arbitraries in `src/test/arbitraries.ts`, domain generators for portfolio photos and shoot types) for the pure helpers, e.g.: filtering preserves order and only returns photos of that type (invariant), filtering twice equals filtering once (idempotence), "Alles" returns all; visible filters are a subset of the shoot types in list order and exactly those with photos; URL parameter parse/format round-trip for every valid id and fallback for everything else; wrap-around navigation stays in range and next-then-previous returns to the start (round-trip); the lightbox state (open/next/previous/close/filter change) against a simple model (stateful); masonry spans are positive and grow with the photo's height ratio; the gallery JSON-LD has one `ImageObject` per photo, only absolute https URLs and never an e-mail address. *Source: PBT extension = A (full)*
|
||||||
|
- `pnpm check` (lint, format, tests incl. coverage thresholds, build, audits, Lighthouse) passes.
|
||||||
|
|
||||||
|
### NFR-PF-04 Security (Security Baseline extension enabled)
|
||||||
|
- No new third parties: no external scripts, fonts, embeds, lightbox libraries or endpoints; CSP in `web/config/securityHeaders.ts` unchanged. All photos self-hosted.
|
||||||
|
- The `?shoot=` parameter is validated against the allowlist of `ShootTypeId`s before use; any other value falls back to "Alles" and is never rendered or put into the DOM, head or structured data (misuse scenario: crafted or oversized parameter values).
|
||||||
|
- No e-mail address in markup, bundle, content or structured data.
|
||||||
|
- Structured data goes through `jsonLdScript` (escapes `<`, `>`, `&`).
|
||||||
|
- No new runtime dependencies; image processing is a one-off local step, not a build dependency.
|
||||||
|
|
||||||
|
### NFR-PF-05 Performance
|
||||||
|
- Lighthouse performance for `/portfolio`: ≥ 0.9 on mobile and desktop (the default budget for pages other than the homepage).
|
||||||
|
- Grid images ≈ 800 px wide and compressed; only the first 3 load before the load event; large images only on demand (FR-PF-07).
|
||||||
|
- No layout shift from images (intrinsic sizes) or from the filter bar.
|
||||||
|
- The lightbox code may be split from the initial bundle if that measurably helps; decided in design.
|
||||||
|
|
||||||
|
### NFR-PF-06 Content for the future API
|
||||||
|
- Portfolio content (photos with id, shoot type, two image sizes, alt text; intro texts) and Instagram content are plain data so the API (`/api/portfolio` in the design README) can deliver them 1-to-1; shoot types are referenced by id only.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Extension Compliance — Requirements Level
|
||||||
|
|
||||||
|
### Security Baseline
|
||||||
|
| Rule | Status | Rationale |
|
||||||
|
|---|---|---|
|
||||||
|
| SECURITY-01 Encryption | N/A | No data stores |
|
||||||
|
| SECURITY-02 Access logging | N/A | No intermediaries added; hosting unchanged |
|
||||||
|
| SECURITY-03 Application logging | N/A | No server-side component; client errors already go to Sentry |
|
||||||
|
| SECURITY-04 HTTP security headers | Compliant | Existing header set unchanged; no CSP loosening (NFR-PF-04) |
|
||||||
|
| SECURITY-05 Input validation | Compliant | The only input is the `?shoot=` URL parameter, validated against an allowlist with a safe fallback (FR-PF-04, NFR-PF-04); no API endpoint |
|
||||||
|
| SECURITY-06 Least privilege | N/A | No IAM |
|
||||||
|
| SECURITY-07 Network configuration | N/A | No network infrastructure |
|
||||||
|
| SECURITY-08 Access control | N/A | Public content |
|
||||||
|
| SECURITY-09 Hardening | Compliant | No debug output; no new configuration |
|
||||||
|
| SECURITY-10 Supply chain | Compliant | No new dependencies (no lightbox or masonry library) |
|
||||||
|
| SECURITY-11 Secure design | Compliant | Misuse scenario (crafted `?shoot=`) addressed; structured data escaped; e-mail kept out of the page |
|
||||||
|
| SECURITY-12 Authentication | N/A | No authentication |
|
||||||
|
| SECURITY-13 Integrity | Compliant | No external CDN resources; all assets self-hosted |
|
||||||
|
| SECURITY-14 Alerting | N/A | No server-side component; existing monitoring unchanged |
|
||||||
|
| SECURITY-15 Exception handling | Compliant | Existing global error handling and error page; invalid input falls back safely |
|
||||||
|
|
||||||
|
### Property-Based Testing
|
||||||
|
| Rule | Status | Rationale |
|
||||||
|
|---|---|---|
|
||||||
|
| PBT-01 Property identification | Planned | Properties of the filter, URL, navigation, masonry and JSON-LD helpers identified in Functional Design |
|
||||||
|
| PBT-02 Round-trip | Planned | `?shoot=` parse/format; next/previous navigation |
|
||||||
|
| PBT-03 Invariants | Planned | Filter order and membership, visible filters subset, index range, span positivity, JSON-LD photo count and URL form |
|
||||||
|
| PBT-04 Idempotency | Planned | Filtering twice equals filtering once |
|
||||||
|
| PBT-05 Oracle | Planned | Masonry row spans or filters checked against a simple reference where one is trivial to write; otherwise N/A with rationale in design |
|
||||||
|
| PBT-06 Stateful | Planned | Lightbox state (open/next/previous/close/filter change) against a model |
|
||||||
|
| PBT-07 Generators | Planned | Domain generators for portfolio photos and shoot types in `src/test/arbitraries.ts` |
|
||||||
|
| PBT-08 Shrinking/reproducibility | Compliant | Existing seed logging (`config/testSeed.ts`) |
|
||||||
|
| PBT-09 Framework | Compliant | fast-check already configured |
|
||||||
|
| PBT-10 Complementary testing | Planned | Example-based tests for the page and components alongside PBT |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Summary of Key Decisions
|
||||||
|
| # | Decision |
|
||||||
|
|---|---|
|
||||||
|
| Q1 | The 10 live photos, re-processed, descriptive alt texts |
|
||||||
|
| Q2 + C1 | Masonry in row order (whole photos, own aspect ratio, reading order kept) |
|
||||||
|
| Q3 | Accessible lightbox on Chakra `Dialog` (close, prev/next, keys, swipe, counter, wrap, focus management) |
|
||||||
|
| Q4 + C3 | Visible caption = shoot type label (`shootLabel`); alt text for screen readers |
|
||||||
|
| Q5 | No link to a single photo |
|
||||||
|
| Q6 | Two sizes per photo; large loads on open, neighbours preloaded |
|
||||||
|
| Q7 + C2 | First 3 photos eager with high priority, rest deferred |
|
||||||
|
| Q8 | Eyebrow "Werk", h1 "Portfolio", intro with "Klik of tik" |
|
||||||
|
| Q9 + C7 | Filters per shoot type from `shootTypes.ts`; only types with photos, plus "Alles" |
|
||||||
|
| C4 | Shoot type and alt text per photo proposed in Functional Design, approved by the user |
|
||||||
|
| C5 | Filter in the URL (`?shoot=`), canonical stays `/portfolio` |
|
||||||
|
| C6 | Lightbox browses within the active filter |
|
||||||
|
| Q10 | `InstagramGrid` shared with its own content; same block on home and portfolio |
|
||||||
|
| Q11 | Title and description unchanged |
|
||||||
|
| Q12 | `ImageGallery` with `ImageObject`s via the shared `webPage()` |
|
||||||
|
| Q13 | Own 1200×630 preview image from a portfolio photo |
|
||||||
|
| — | LAYOUT.md: Intro → Portfolio → Instagram (consistency with the other pages) |
|
||||||
|
| Ext. | Security Baseline: Yes · PBT: Yes (full) · Operations: No |
|
||||||
@@ -6,8 +6,14 @@
|
|||||||
const origin = 'http://localhost:4173';
|
const origin = 'http://localhost:4173';
|
||||||
|
|
||||||
// Moet gelijk lopen met src/sitePages.ts (een test bewaakt dat)
|
// Moet gelijk lopen met src/sitePages.ts (een test bewaakt dat)
|
||||||
const indexedPaths = ['/', '/over-mij', '/soorten-fotoshoots', '/contact'];
|
const indexedPaths = [
|
||||||
const noindexPaths = ['/portfolio', '/privacyverklaring'];
|
'/',
|
||||||
|
'/over-mij',
|
||||||
|
'/portfolio',
|
||||||
|
'/soorten-fotoshoots',
|
||||||
|
'/contact',
|
||||||
|
];
|
||||||
|
const noindexPaths = ['/privacyverklaring'];
|
||||||
const notFoundPath = '/bestaat-niet';
|
const notFoundPath = '/bestaat-niet';
|
||||||
|
|
||||||
// Homepage mobiel voorlopig 0,8: de foto's zijn nog niet responsive en de
|
// Homepage mobiel voorlopig 0,8: de foto's zijn nog niet responsive en de
|
||||||
|
|||||||
|
After Width: | Height: | Size: 68 KiB |
@@ -101,12 +101,17 @@ describe('app', () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
it('zet titel en noindex van een placeholder in de head', async () => {
|
it('zet titel en noindex van een placeholder in de head', async () => {
|
||||||
await renderApp('/portfolio');
|
await renderApp('/privacyverklaring');
|
||||||
await screen.findByRole('heading', { level: 1, name: 'Portfolio' });
|
await screen.findByRole('heading', {
|
||||||
expect(document.title).toBe('Portfolio | Andrea Slop Fotografie');
|
level: 1,
|
||||||
|
name: 'Privacyverklaring',
|
||||||
|
});
|
||||||
|
expect(document.title).toBe(
|
||||||
|
'Privacyverklaring | Andrea Slop Fotografie',
|
||||||
|
);
|
||||||
expect(
|
expect(
|
||||||
document.head.querySelector('link[rel="canonical"]'),
|
document.head.querySelector('link[rel="canonical"]'),
|
||||||
).toHaveAttribute('href', 'https://andreaslop.nl/portfolio');
|
).toHaveAttribute('href', 'https://andreaslop.nl/privacyverklaring');
|
||||||
expect(
|
expect(
|
||||||
document.head.querySelector('meta[name="robots"]'),
|
document.head.querySelector('meta[name="robots"]'),
|
||||||
).toHaveAttribute('content', 'noindex');
|
).toHaveAttribute('content', 'noindex');
|
||||||
@@ -265,7 +270,7 @@ describe('app', () => {
|
|||||||
'/contact',
|
'/contact',
|
||||||
]);
|
]);
|
||||||
// Links to the filtered portfolio only once that page is live
|
// 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(
|
expect(
|
||||||
within(main)
|
within(main)
|
||||||
.queryAllByRole('link', { name: /^Bekijk meer/ })
|
.queryAllByRole('link', { name: /^Bekijk meer/ })
|
||||||
@@ -276,8 +281,6 @@ describe('app', () => {
|
|||||||
'/portfolio?shoot=newborn',
|
'/portfolio?shoot=newborn',
|
||||||
'/portfolio?shoot=zwangerschap',
|
'/portfolio?shoot=zwangerschap',
|
||||||
'/portfolio?shoot=gezin',
|
'/portfolio?shoot=gezin',
|
||||||
'/portfolio?shoot=loveshoot',
|
|
||||||
'/portfolio?shoot=portret',
|
|
||||||
]
|
]
|
||||||
: [],
|
: [],
|
||||||
);
|
);
|
||||||
@@ -304,6 +307,82 @@ describe('app', () => {
|
|||||||
expect(await axeResults(container)).toHaveNoViolations();
|
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 () => {
|
it('toont een onbekende URL als 404 binnen de shell', async () => {
|
||||||
const { container } = await renderApp('/bestaat-niet');
|
const { container } = await renderApp('/bestaat-niet');
|
||||||
expect(
|
expect(
|
||||||
|
|||||||
|
After Width: | Height: | Size: 130 KiB |
|
After Width: | Height: | Size: 40 KiB |
|
After Width: | Height: | Size: 104 KiB |
|
After Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 292 KiB |
|
After Width: | Height: | Size: 143 KiB |
|
After Width: | Height: | Size: 187 KiB |
|
After Width: | Height: | Size: 60 KiB |
|
After Width: | Height: | Size: 206 KiB |
|
After Width: | Height: | Size: 115 KiB |
|
After Width: | Height: | Size: 259 KiB |
|
After Width: | Height: | Size: 141 KiB |
|
After Width: | Height: | Size: 152 KiB |
|
After Width: | Height: | Size: 78 KiB |
|
After Width: | Height: | Size: 191 KiB |
|
After Width: | Height: | Size: 110 KiB |
|
After Width: | Height: | Size: 144 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 129 KiB |
|
After Width: | Height: | Size: 40 KiB |
@@ -0,0 +1,104 @@
|
|||||||
|
import { screen, within } from '@testing-library/react';
|
||||||
|
import userEvent from '@testing-library/user-event';
|
||||||
|
import { describe, expect, it, vi } from 'vitest';
|
||||||
|
import { axeResults } from '@/test/axe';
|
||||||
|
import { renderWithProviders } from '@/test/renderWithProviders';
|
||||||
|
import FilterBar from './FilterBar';
|
||||||
|
|
||||||
|
const options = [
|
||||||
|
{ id: 'alles', label: 'Alles' },
|
||||||
|
{ id: 'newborn', label: 'Newborn' },
|
||||||
|
{ id: 'gezin', label: 'Gezin' },
|
||||||
|
];
|
||||||
|
const LABEL = 'Filter op soort shoot';
|
||||||
|
|
||||||
|
describe('FilterBar', () => {
|
||||||
|
it('shows a named group of toggle buttons in order, with the chosen one pressed', async () => {
|
||||||
|
const { container } = await renderWithProviders(
|
||||||
|
<FilterBar
|
||||||
|
options={options}
|
||||||
|
value="newborn"
|
||||||
|
onChange={() => {}}
|
||||||
|
label={LABEL}
|
||||||
|
/>,
|
||||||
|
);
|
||||||
|
const group = screen.getByRole('group', { name: LABEL });
|
||||||
|
const buttons = within(group).getAllByRole('button');
|
||||||
|
expect(buttons.map((b) => b.textContent)).toEqual([
|
||||||
|
'Alles',
|
||||||
|
'Newborn',
|
||||||
|
'Gezin',
|
||||||
|
]);
|
||||||
|
expect(
|
||||||
|
screen.getByRole('button', { name: 'Newborn', pressed: true }),
|
||||||
|
).toBeInTheDocument();
|
||||||
|
expect(screen.getAllByRole('button', { pressed: false })).toHaveLength(
|
||||||
|
2,
|
||||||
|
);
|
||||||
|
expect(await axeResults(container)).toHaveNoViolations();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('reports a new choice, but not a click on the chosen one', async () => {
|
||||||
|
const onChange = vi.fn();
|
||||||
|
await renderWithProviders(
|
||||||
|
<FilterBar
|
||||||
|
options={options}
|
||||||
|
value="alles"
|
||||||
|
onChange={onChange}
|
||||||
|
label={LABEL}
|
||||||
|
/>,
|
||||||
|
);
|
||||||
|
const user = userEvent.setup();
|
||||||
|
await user.click(screen.getByTestId('filter-alles'));
|
||||||
|
expect(onChange).not.toHaveBeenCalled();
|
||||||
|
await user.click(screen.getByTestId('filter-gezin'));
|
||||||
|
expect(onChange).toHaveBeenCalledWith('gezin');
|
||||||
|
// Focus stays on the button that was used
|
||||||
|
expect(screen.getByTestId('filter-gezin')).toHaveFocus();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('can be used with the keyboard, one tab stop per button', async () => {
|
||||||
|
const onChange = vi.fn();
|
||||||
|
await renderWithProviders(
|
||||||
|
<FilterBar
|
||||||
|
options={options}
|
||||||
|
value="alles"
|
||||||
|
onChange={onChange}
|
||||||
|
label={LABEL}
|
||||||
|
/>,
|
||||||
|
);
|
||||||
|
const user = userEvent.setup();
|
||||||
|
await user.tab();
|
||||||
|
expect(screen.getByTestId('filter-alles')).toHaveFocus();
|
||||||
|
await user.tab();
|
||||||
|
expect(screen.getByTestId('filter-newborn')).toHaveFocus();
|
||||||
|
await user.keyboard('{Enter}');
|
||||||
|
expect(onChange).toHaveBeenCalledWith('newborn');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('shows nothing with fewer than two options', async () => {
|
||||||
|
await renderWithProviders(
|
||||||
|
<FilterBar
|
||||||
|
options={[options[0]]}
|
||||||
|
value="alles"
|
||||||
|
onChange={() => {}}
|
||||||
|
label={LABEL}
|
||||||
|
/>,
|
||||||
|
);
|
||||||
|
expect(screen.queryByTestId('filter-bar')).not.toBeInTheDocument();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('presses no button for an unknown value', async () => {
|
||||||
|
await renderWithProviders(
|
||||||
|
<FilterBar
|
||||||
|
options={options}
|
||||||
|
value="portret"
|
||||||
|
onChange={() => {}}
|
||||||
|
label={LABEL}
|
||||||
|
/>,
|
||||||
|
);
|
||||||
|
expect(screen.queryAllByRole('button', { pressed: true })).toHaveLength(
|
||||||
|
0,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
import { chakra, useRecipe } from '@chakra-ui/react';
|
||||||
|
import type { FilterOption } from '@/content/types';
|
||||||
|
|
||||||
|
type FilterBarProps = {
|
||||||
|
options: readonly FilterOption[];
|
||||||
|
// The id of the chosen option
|
||||||
|
value: string;
|
||||||
|
onChange: (id: string) => void;
|
||||||
|
// Name of the group for assistive technology, e.g. "Filter op soort shoot"
|
||||||
|
label: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
// A row of single-choice toggle buttons (portfolio filters): every button is
|
||||||
|
// its own tab stop and the chosen one is aria-pressed. With fewer than two
|
||||||
|
// options there is nothing to choose, so nothing is shown.
|
||||||
|
export default function FilterBar({
|
||||||
|
options,
|
||||||
|
value,
|
||||||
|
onChange,
|
||||||
|
label,
|
||||||
|
}: FilterBarProps) {
|
||||||
|
const filterControl = useRecipe({ key: 'filterControl' });
|
||||||
|
|
||||||
|
if (options.length < 2) return null;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<chakra.div
|
||||||
|
role="group"
|
||||||
|
aria-label={label}
|
||||||
|
data-testid="filter-bar"
|
||||||
|
display="flex"
|
||||||
|
// 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) => {
|
||||||
|
const pressed = option.id === value;
|
||||||
|
return (
|
||||||
|
<chakra.button
|
||||||
|
key={option.id}
|
||||||
|
type="button"
|
||||||
|
css={filterControl()}
|
||||||
|
aria-pressed={pressed}
|
||||||
|
data-testid={`filter-${option.id}`}
|
||||||
|
onClick={() => {
|
||||||
|
if (!pressed) onChange(option.id);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{option.label}
|
||||||
|
</chakra.button>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</chakra.div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,8 +1,7 @@
|
|||||||
import { useEffect, useRef, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { useMediaQuery } from '@chakra-ui/react';
|
import { useMediaQuery } from '@chakra-ui/react';
|
||||||
|
import useSwipe from '@/hooks/useSwipe';
|
||||||
// Minimale horizontale afstand in px voordat een veeg als swipe telt
|
import { wrapIndex } from '@/lib/wrapIndex';
|
||||||
const SWIPE_THRESHOLD = 50;
|
|
||||||
|
|
||||||
// Houdt de actieve slide bij en of autoplay mag lopen. Het doorschuiven zelf
|
// Houdt de actieve slide bij en of autoplay mag lopen. Het doorschuiven zelf
|
||||||
// gebeurt via de animatie van de voortgangsbalk (zie Hero.tsx), zodat pauzeren
|
// gebeurt via de animatie van de voortgangsbalk (zie Hero.tsx), zodat pauzeren
|
||||||
@@ -27,7 +26,6 @@ export default function useHeroSlider(count: number) {
|
|||||||
ssr: false,
|
ssr: false,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
const touchStart = useRef<{ x: number; y: number } | null>(null);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const onVisibilityChange = () => setHidden(document.hidden);
|
const onVisibilityChange = () => setHidden(document.hidden);
|
||||||
@@ -43,11 +41,13 @@ export default function useHeroSlider(count: number) {
|
|||||||
const active = index < count ? index : 0;
|
const active = index < count ? index : 0;
|
||||||
|
|
||||||
const go = (to: number, visitor: boolean) => {
|
const go = (to: number, visitor: boolean) => {
|
||||||
setIndex((to + count) % count);
|
setIndex(wrapIndex(to, count));
|
||||||
setAnnouncement(visitor ? 'slide' : null);
|
setAnnouncement(visitor ? 'slide' : null);
|
||||||
};
|
};
|
||||||
const next = () => go(active + 1, true);
|
const next = () => go(active + 1, true);
|
||||||
const prev = () => go(active - 1, true);
|
const prev = () => go(active - 1, true);
|
||||||
|
// Swiping only makes sense with something to swipe to
|
||||||
|
const swipe = useSwipe({ onPrev: prev, onNext: next, enabled: count > 1 });
|
||||||
|
|
||||||
return {
|
return {
|
||||||
active,
|
active,
|
||||||
@@ -85,28 +85,7 @@ export default function useHeroSlider(count: number) {
|
|||||||
setFocused(false);
|
setFocused(false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onTouchStart: (event: React.TouchEvent<HTMLElement>) => {
|
...swipe,
|
||||||
const touch = event.touches[0];
|
|
||||||
touchStart.current = { x: touch.clientX, y: touch.clientY };
|
|
||||||
},
|
|
||||||
onTouchEnd: (event: React.TouchEvent<HTMLElement>) => {
|
|
||||||
const start = touchStart.current;
|
|
||||||
touchStart.current = null;
|
|
||||||
if (!start || count < 2) return;
|
|
||||||
|
|
||||||
const touch = event.changedTouches[0];
|
|
||||||
const dx = touch.clientX - start.x;
|
|
||||||
const dy = touch.clientY - start.y;
|
|
||||||
|
|
||||||
// Horizontaal genoeg, en niet bedoeld als verticaal scrollen
|
|
||||||
if (
|
|
||||||
Math.abs(dx) < SWIPE_THRESHOLD ||
|
|
||||||
Math.abs(dx) < Math.abs(dy)
|
|
||||||
)
|
|
||||||
return;
|
|
||||||
if (dx < 0) next();
|
|
||||||
else prev();
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
import { screen, within } from '@testing-library/react';
|
import { screen, within } from '@testing-library/react';
|
||||||
import { describe, expect, it } from 'vitest';
|
import { describe, expect, it } from 'vitest';
|
||||||
import homeContent from '@/content/homeContent';
|
import { introPhotos } from '@/content/homeContent';
|
||||||
|
import instagramContent from '@/content/instagramContent';
|
||||||
|
import testimonials from '@/content/testimonials';
|
||||||
import { axeResults } from '@/test/axe';
|
import { axeResults } from '@/test/axe';
|
||||||
import { renderWithProviders } from '@/test/renderWithProviders';
|
import { renderWithProviders } from '@/test/renderWithProviders';
|
||||||
import InstagramGrid from './InstagramGrid';
|
import InstagramGrid from './InstagramGrid';
|
||||||
|
|
||||||
const instagram = homeContent.instagram;
|
const instagram = instagramContent;
|
||||||
const PROFILE = 'https://www.instagram.com/andreaslopfotografie/';
|
const PROFILE = 'https://www.instagram.com/andreaslopfotografie/';
|
||||||
|
|
||||||
function expectExternal(link: HTMLElement) {
|
function expectExternal(link: HTMLElement) {
|
||||||
@@ -50,6 +52,13 @@ describe('InstagramGrid', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('reuses the intro photos and then the review photos, so each photo keeps one description', () => {
|
||||||
|
expect(instagram.photos).toEqual([
|
||||||
|
...introPhotos,
|
||||||
|
...testimonials.map((testimonial) => testimonial.image),
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
it('still renders the heading and handle when there are no photos', async () => {
|
it('still renders the heading and handle when there are no photos', async () => {
|
||||||
await renderWithProviders(
|
await renderWithProviders(
|
||||||
<InstagramGrid
|
<InstagramGrid
|
||||||
@@ -3,12 +3,12 @@ import DeferredImage from '@/components/DeferredImage/DeferredImage';
|
|||||||
import PageSection from '@/components/PageSection/PageSection';
|
import PageSection from '@/components/PageSection/PageSection';
|
||||||
import Reveal from '@/components/Reveal/Reveal';
|
import Reveal from '@/components/Reveal/Reveal';
|
||||||
import SectionHeading from '@/components/SectionHeading/SectionHeading';
|
import SectionHeading from '@/components/SectionHeading/SectionHeading';
|
||||||
import type { HomeContent } from '@/content/types';
|
import type { InstagramContent } from '@/content/types';
|
||||||
|
|
||||||
const TITLE_ID = 'instagram-title';
|
const TITLE_ID = 'instagram-title';
|
||||||
|
|
||||||
type InstagramGridProps = {
|
type InstagramGridProps = {
|
||||||
content: HomeContent['instagram'];
|
content: InstagramContent;
|
||||||
// A checked https link (visibleSocials); without one the route leaves
|
// A checked https link (visibleSocials); without one the route leaves
|
||||||
// the section out
|
// the section out
|
||||||
profileUrl: string;
|
profileUrl: string;
|
||||||
@@ -17,6 +17,7 @@ type InstagramGridProps = {
|
|||||||
// "Instagram" (design .instagram): the handle as a link to the profile and
|
// "Instagram" (design .instagram): the handle as a link to the profile and
|
||||||
// a row of square photos running from edge to edge, each linking to the
|
// a row of square photos running from edge to edge, each linking to the
|
||||||
// profile too. A fixed selection until the API delivers the real feed.
|
// profile too. A fixed selection until the API delivers the real feed.
|
||||||
|
// Shared by the homepage and the portfolio.
|
||||||
export default function InstagramGrid({
|
export default function InstagramGrid({
|
||||||
content,
|
content,
|
||||||
profileUrl,
|
profileUrl,
|
||||||
@@ -0,0 +1,220 @@
|
|||||||
|
import { useState } from 'react';
|
||||||
|
import { fireEvent, screen, waitFor } from '@testing-library/react';
|
||||||
|
import userEvent from '@testing-library/user-event';
|
||||||
|
import { afterEach, describe, expect, it, vi } from 'vitest';
|
||||||
|
import type { GalleryItem } from '@/content/types';
|
||||||
|
import { axeResults } from '@/test/axe';
|
||||||
|
import { galleryItems } from '@/test/galleryFixtures';
|
||||||
|
import { renderWithProviders } from '@/test/renderWithProviders';
|
||||||
|
import Lightbox from './Lightbox';
|
||||||
|
|
||||||
|
// A parent that owns the index, like the portfolio page will
|
||||||
|
function Harness({
|
||||||
|
items = galleryItems,
|
||||||
|
start = 0,
|
||||||
|
onClose = () => {},
|
||||||
|
}: {
|
||||||
|
items?: GalleryItem[];
|
||||||
|
start?: number | null;
|
||||||
|
onClose?: () => void;
|
||||||
|
}) {
|
||||||
|
const [index, setIndex] = useState<number | null>(start);
|
||||||
|
return (
|
||||||
|
<Lightbox
|
||||||
|
items={items}
|
||||||
|
index={index}
|
||||||
|
onIndexChange={setIndex}
|
||||||
|
onClose={() => {
|
||||||
|
setIndex(null);
|
||||||
|
onClose();
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function openAt(start = 0, items?: GalleryItem[], onClose?: () => void) {
|
||||||
|
const result = await renderWithProviders(
|
||||||
|
<Harness start={start} items={items} onClose={onClose} />,
|
||||||
|
);
|
||||||
|
await screen.findByTestId('lightbox');
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
const counter = () => screen.getByTestId('lightbox-counter');
|
||||||
|
const image = () => screen.getByTestId('lightbox-image');
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
vi.unstubAllGlobals();
|
||||||
|
vi.restoreAllMocks();
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Lightbox', () => {
|
||||||
|
it('renders nothing while closed', async () => {
|
||||||
|
await renderWithProviders(<Harness start={null} />);
|
||||||
|
expect(screen.queryByRole('dialog')).not.toBeInTheDocument();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('shows the chosen photo large in a named dialog, with caption and counter', async () => {
|
||||||
|
await openAt(0);
|
||||||
|
const dialog = screen.getByRole('dialog', {
|
||||||
|
name: 'Foto groot bekijken',
|
||||||
|
});
|
||||||
|
expect(dialog).toBeInTheDocument();
|
||||||
|
expect(image()).toHaveAttribute('src', galleryItems[0].full.src);
|
||||||
|
expect(screen.getByTestId('lightbox-caption')).toHaveTextContent(
|
||||||
|
'Newbornshoot',
|
||||||
|
);
|
||||||
|
expect(counter()).toHaveTextContent(`1 / ${galleryItems.length}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('moves focus to the close button when it opens', async () => {
|
||||||
|
// The dialog's focus trap only focuses elements with a layout box;
|
||||||
|
// jsdom has no layout, so give elements the box a browser would
|
||||||
|
vi.spyOn(HTMLElement.prototype, 'getClientRects').mockReturnValue([
|
||||||
|
{ width: 52, height: 52 },
|
||||||
|
] as unknown as DOMRectList);
|
||||||
|
await openAt(0);
|
||||||
|
await waitFor(() =>
|
||||||
|
expect(screen.getByTestId('lightbox-close')).toHaveFocus(),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('browses with the buttons and wraps around', async () => {
|
||||||
|
await openAt(0);
|
||||||
|
const user = userEvent.setup();
|
||||||
|
await user.click(screen.getByTestId('lightbox-prev'));
|
||||||
|
expect(counter()).toHaveTextContent(
|
||||||
|
`${galleryItems.length} / ${galleryItems.length}`,
|
||||||
|
);
|
||||||
|
await user.click(screen.getByTestId('lightbox-next'));
|
||||||
|
expect(counter()).toHaveTextContent(`1 / ${galleryItems.length}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('browses with the arrow keys, Home and End, and announces where it is', async () => {
|
||||||
|
await openAt(1);
|
||||||
|
const user = userEvent.setup();
|
||||||
|
await user.keyboard('{ArrowRight}');
|
||||||
|
expect(counter()).toHaveTextContent(`3 / ${galleryItems.length}`);
|
||||||
|
expect(screen.getByTestId('lightbox-announcement')).toHaveTextContent(
|
||||||
|
`Foto 3 van ${galleryItems.length}, Newbornshoot`,
|
||||||
|
);
|
||||||
|
await user.keyboard('{End}');
|
||||||
|
expect(counter()).toHaveTextContent(
|
||||||
|
`${galleryItems.length} / ${galleryItems.length}`,
|
||||||
|
);
|
||||||
|
await user.keyboard('{Home}');
|
||||||
|
expect(counter()).toHaveTextContent(`1 / ${galleryItems.length}`);
|
||||||
|
await user.keyboard('{ArrowLeft}');
|
||||||
|
expect(screen.getByTestId('lightbox-announcement')).toHaveTextContent(
|
||||||
|
`Foto ${galleryItems.length} van ${galleryItems.length}`,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('browses with a swipe', async () => {
|
||||||
|
await openAt(0);
|
||||||
|
const figure = image().closest('figure') as HTMLElement;
|
||||||
|
fireEvent.touchStart(figure, {
|
||||||
|
touches: [{ clientX: 300, clientY: 100 }],
|
||||||
|
});
|
||||||
|
fireEvent.touchEnd(figure, {
|
||||||
|
changedTouches: [{ clientX: 150, clientY: 100 }],
|
||||||
|
});
|
||||||
|
expect(counter()).toHaveTextContent(`2 / ${galleryItems.length}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('closes with the close button', async () => {
|
||||||
|
const onClose = vi.fn();
|
||||||
|
await openAt(0, undefined, onClose);
|
||||||
|
const user = userEvent.setup();
|
||||||
|
await user.click(screen.getByTestId('lightbox-close'));
|
||||||
|
expect(onClose).toHaveBeenCalledTimes(1);
|
||||||
|
// Closing: Chakra removes it after the fade-out, which needs real
|
||||||
|
// animation events that jsdom does not have
|
||||||
|
expect(screen.getByTestId('lightbox')).toHaveAttribute(
|
||||||
|
'data-state',
|
||||||
|
'closed',
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('closes with Escape', async () => {
|
||||||
|
const onClose = vi.fn();
|
||||||
|
await openAt(0, undefined, onClose);
|
||||||
|
await userEvent.setup().keyboard('{Escape}');
|
||||||
|
expect(onClose).toHaveBeenCalledTimes(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('closes on the dark area, but not on the photo itself', async () => {
|
||||||
|
const onClose = vi.fn();
|
||||||
|
await openAt(0, undefined, onClose);
|
||||||
|
fireEvent.click(image());
|
||||||
|
expect(onClose).not.toHaveBeenCalled();
|
||||||
|
fireEvent.click(screen.getByTestId('lightbox'));
|
||||||
|
expect(onClose).toHaveBeenCalledTimes(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('shows no browsing controls for a single photo', async () => {
|
||||||
|
await openAt(0, [galleryItems[0]]);
|
||||||
|
expect(screen.queryByTestId('lightbox-prev')).not.toBeInTheDocument();
|
||||||
|
expect(screen.queryByTestId('lightbox-next')).not.toBeInTheDocument();
|
||||||
|
expect(
|
||||||
|
screen.queryByTestId('lightbox-counter'),
|
||||||
|
).not.toBeInTheDocument();
|
||||||
|
const user = userEvent.setup();
|
||||||
|
await user.keyboard('{ArrowRight}');
|
||||||
|
expect(
|
||||||
|
screen.getByTestId('lightbox-announcement'),
|
||||||
|
).toBeEmptyDOMElement();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('shows the grid photo while the large one loads, then swaps', async () => {
|
||||||
|
await openAt(0);
|
||||||
|
const thumb = screen.getByTestId('lightbox-thumb');
|
||||||
|
expect(thumb).toHaveAttribute('src', galleryItems[0].thumb.src);
|
||||||
|
expect(thumb).toHaveAttribute('alt', galleryItems[0].thumb.alt);
|
||||||
|
expect(image()).toHaveAttribute('aria-hidden', 'true');
|
||||||
|
fireEvent.load(image());
|
||||||
|
expect(image()).toHaveAttribute('alt', galleryItems[0].thumb.alt);
|
||||||
|
expect(thumb).toHaveAttribute('aria-hidden', 'true');
|
||||||
|
expect(screen.getAllByRole('img')).toHaveLength(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('keeps the grid photo and says so when the large one fails', async () => {
|
||||||
|
await openAt(1);
|
||||||
|
fireEvent.error(image());
|
||||||
|
expect(screen.queryByTestId('lightbox-image')).not.toBeInTheDocument();
|
||||||
|
expect(screen.getByTestId('lightbox-thumb')).toHaveAttribute(
|
||||||
|
'alt',
|
||||||
|
galleryItems[1].thumb.alt,
|
||||||
|
);
|
||||||
|
expect(screen.getByTestId('lightbox-caption')).toHaveTextContent(
|
||||||
|
'Deze foto kon niet groot geladen worden',
|
||||||
|
);
|
||||||
|
// The next photo starts fresh
|
||||||
|
const user = userEvent.setup();
|
||||||
|
await user.click(screen.getByTestId('lightbox-next'));
|
||||||
|
expect(screen.getByTestId('lightbox-image')).toBeInTheDocument();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('loads two photos ahead on each side', async () => {
|
||||||
|
const requested: string[] = [];
|
||||||
|
vi.stubGlobal(
|
||||||
|
'Image',
|
||||||
|
class {
|
||||||
|
set src(value: string) {
|
||||||
|
requested.push(value);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
await openAt(0);
|
||||||
|
const n = galleryItems.length;
|
||||||
|
const expected = [1, n - 1, 2, n - 2].map(
|
||||||
|
(i) => galleryItems[i].full.src,
|
||||||
|
);
|
||||||
|
expect(new Set(requested)).toEqual(new Set(expected));
|
||||||
|
});
|
||||||
|
|
||||||
|
it('has no accessibility violations while open', async () => {
|
||||||
|
await openAt(0);
|
||||||
|
expect(await axeResults(document.body)).toHaveNoViolations();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,366 @@
|
|||||||
|
import {
|
||||||
|
useEffect,
|
||||||
|
useRef,
|
||||||
|
useState,
|
||||||
|
type KeyboardEvent,
|
||||||
|
type MouseEvent,
|
||||||
|
} from 'react';
|
||||||
|
import { Box, chakra, Dialog, Portal, Text, useRecipe } from '@chakra-ui/react';
|
||||||
|
import { Icon } from '@iconify/react/offline';
|
||||||
|
import closeOutlined from '@iconify-icons/ant-design/close-outlined';
|
||||||
|
import leftOutlined from '@iconify-icons/ant-design/left-outlined';
|
||||||
|
import rightOutlined from '@iconify-icons/ant-design/right-outlined';
|
||||||
|
import type { GalleryItem } from '@/content/types';
|
||||||
|
import useSwipe from '@/hooks/useSwipe';
|
||||||
|
import { neighbourIndexes } from '@/lib/neighbourIndexes';
|
||||||
|
import { wrapIndex } from '@/lib/wrapIndex';
|
||||||
|
|
||||||
|
type LightboxProps = {
|
||||||
|
items: readonly GalleryItem[];
|
||||||
|
// The photo on screen, or null when closed
|
||||||
|
index: number | null;
|
||||||
|
onIndexChange: (index: number) => void;
|
||||||
|
onClose: () => void;
|
||||||
|
// Name of the dialog for assistive technology
|
||||||
|
label?: string;
|
||||||
|
// Where focus goes on close: the grid tile of the photo shown last
|
||||||
|
finalFocusEl?: () => HTMLElement | null;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Large photos loaded ahead on each side of the one on screen (FD Q8 = B)
|
||||||
|
const PRELOAD_RADIUS = 2;
|
||||||
|
|
||||||
|
type LoadState = 'loading' | 'loaded' | 'failed';
|
||||||
|
|
||||||
|
// Shows one photo of a list large, in a modal dialog (design .lightbox).
|
||||||
|
// Chakra's Dialog traps focus, closes on Escape, makes the page behind it
|
||||||
|
// inert and stops it scrolling; this component adds browsing (buttons,
|
||||||
|
// arrow keys, Home/End, swipe), the counter, the caption and loading.
|
||||||
|
// Default export, so the page can load it lazily on first use.
|
||||||
|
export default function Lightbox({
|
||||||
|
items,
|
||||||
|
index,
|
||||||
|
onIndexChange,
|
||||||
|
onClose,
|
||||||
|
label = 'Foto groot bekijken',
|
||||||
|
finalFocusEl,
|
||||||
|
}: LightboxProps) {
|
||||||
|
const count = items.length;
|
||||||
|
const open = index !== null && count > 0;
|
||||||
|
const current = open ? wrapIndex(index, count) : 0;
|
||||||
|
const item = items[current];
|
||||||
|
const browsable = count > 1;
|
||||||
|
|
||||||
|
const closeButton = useRef<HTMLButtonElement>(null);
|
||||||
|
// Said after the visitor browses; not on opening (the dialog name and
|
||||||
|
// the focused close button are announced then)
|
||||||
|
const [announcement, setAnnouncement] = useState('');
|
||||||
|
|
||||||
|
// Clear the announcement when the dialog closes, so reopening is quiet.
|
||||||
|
// Adjusted during render, as React advises for state that follows a prop.
|
||||||
|
const [wasOpen, setWasOpen] = useState(open);
|
||||||
|
if (wasOpen !== open) {
|
||||||
|
setWasOpen(open);
|
||||||
|
if (!open) setAnnouncement('');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load the photos around this one, so browsing shows them at once
|
||||||
|
useEffect(() => {
|
||||||
|
if (!open) return;
|
||||||
|
for (const i of neighbourIndexes(current, count, PRELOAD_RADIUS)) {
|
||||||
|
const preload = new Image();
|
||||||
|
preload.src = items[i].full.src;
|
||||||
|
}
|
||||||
|
}, [open, current, count, items]);
|
||||||
|
|
||||||
|
const show = (to: number) => {
|
||||||
|
const next = wrapIndex(to, count);
|
||||||
|
onIndexChange(next);
|
||||||
|
const caption = items[next].caption;
|
||||||
|
setAnnouncement(
|
||||||
|
`Foto ${next + 1} van ${count}` + (caption ? `, ${caption}` : ''),
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const swipe = useSwipe({
|
||||||
|
onPrev: () => show(current - 1),
|
||||||
|
onNext: () => show(current + 1),
|
||||||
|
enabled: browsable,
|
||||||
|
});
|
||||||
|
|
||||||
|
const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {
|
||||||
|
if (!browsable) return;
|
||||||
|
const target: Record<string, number> = {
|
||||||
|
ArrowRight: current + 1,
|
||||||
|
ArrowLeft: current - 1,
|
||||||
|
Home: 0,
|
||||||
|
End: count - 1,
|
||||||
|
};
|
||||||
|
if (event.key in target) {
|
||||||
|
event.preventDefault();
|
||||||
|
show(target[event.key]);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// A click on the dark area around the photo closes; on the photo itself
|
||||||
|
// it does nothing (FD Q3)
|
||||||
|
const closeOnBackground = (event: MouseEvent<HTMLElement>) => {
|
||||||
|
if (event.target === event.currentTarget) onClose();
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Dialog.Root
|
||||||
|
unstyled
|
||||||
|
open={open}
|
||||||
|
onOpenChange={(details) => {
|
||||||
|
if (!details.open) onClose();
|
||||||
|
}}
|
||||||
|
initialFocusEl={() => closeButton.current}
|
||||||
|
finalFocusEl={finalFocusEl}
|
||||||
|
lazyMount
|
||||||
|
unmountOnExit
|
||||||
|
>
|
||||||
|
<Portal>
|
||||||
|
<Dialog.Backdrop
|
||||||
|
position="fixed"
|
||||||
|
inset={0}
|
||||||
|
zIndex="modal"
|
||||||
|
bg="rgba(20, 19, 18, 0.94)"
|
||||||
|
_open={{
|
||||||
|
animationName: 'fade-in',
|
||||||
|
animationDuration: 'swap',
|
||||||
|
}}
|
||||||
|
_closed={{
|
||||||
|
animationName: 'fade-out',
|
||||||
|
animationDuration: 'swap',
|
||||||
|
}}
|
||||||
|
_motionReduce={{ animation: 'none' }}
|
||||||
|
/>
|
||||||
|
<Dialog.Positioner position="fixed" inset={0} zIndex="modal">
|
||||||
|
{item && (
|
||||||
|
<Dialog.Content
|
||||||
|
data-testid="lightbox"
|
||||||
|
position="absolute"
|
||||||
|
inset={0}
|
||||||
|
display="flex"
|
||||||
|
alignItems="center"
|
||||||
|
justifyContent="center"
|
||||||
|
px={{ base: 3, md: 24 }}
|
||||||
|
pt={{ base: 16, md: 12 }}
|
||||||
|
pb={{ base: 24, md: 16 }}
|
||||||
|
color="white"
|
||||||
|
outline="none"
|
||||||
|
onKeyDown={handleKeyDown}
|
||||||
|
onClick={closeOnBackground}
|
||||||
|
_open={{
|
||||||
|
animationName: 'fade-in',
|
||||||
|
animationDuration: 'swap',
|
||||||
|
}}
|
||||||
|
_closed={{
|
||||||
|
animationName: 'fade-out',
|
||||||
|
animationDuration: 'swap',
|
||||||
|
}}
|
||||||
|
_motionReduce={{ animation: 'none' }}
|
||||||
|
>
|
||||||
|
<Dialog.Title srOnly>{label}</Dialog.Title>
|
||||||
|
|
||||||
|
{/* Keyed per photo: a new photo starts loading
|
||||||
|
from scratch */}
|
||||||
|
<Photo
|
||||||
|
key={`${current}-${item.full.src}`}
|
||||||
|
item={item}
|
||||||
|
swipe={swipe}
|
||||||
|
onBackground={closeOnBackground}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Dialog.CloseTrigger asChild>
|
||||||
|
<ControlButton
|
||||||
|
ref={closeButton}
|
||||||
|
aria-label="Sluiten"
|
||||||
|
data-testid="lightbox-close"
|
||||||
|
position="absolute"
|
||||||
|
top={{ base: 2, md: 4 }}
|
||||||
|
right={{ base: 2, md: 4 }}
|
||||||
|
>
|
||||||
|
<Icon icon={closeOutlined} aria-hidden />
|
||||||
|
</ControlButton>
|
||||||
|
</Dialog.CloseTrigger>
|
||||||
|
|
||||||
|
{browsable && (
|
||||||
|
// Phones: one bar at the bottom, within reach of
|
||||||
|
// the thumb and never over the photo (FD Q2).
|
||||||
|
// Larger screens: the bar dissolves and each
|
||||||
|
// control takes its place from the design.
|
||||||
|
<Box
|
||||||
|
display={{ base: 'flex', md: 'contents' }}
|
||||||
|
position="absolute"
|
||||||
|
insetX={0}
|
||||||
|
bottom={0}
|
||||||
|
px={2}
|
||||||
|
pb="max(0.5rem, env(safe-area-inset-bottom))"
|
||||||
|
alignItems="center"
|
||||||
|
justifyContent="space-between"
|
||||||
|
>
|
||||||
|
<ControlButton
|
||||||
|
aria-label="Vorige foto"
|
||||||
|
data-testid="lightbox-prev"
|
||||||
|
onClick={() => show(current - 1)}
|
||||||
|
position={{ md: 'absolute' }}
|
||||||
|
left={{ md: 4 }}
|
||||||
|
top={{ md: '50%' }}
|
||||||
|
transform={{ md: 'translateY(-50%)' }}
|
||||||
|
>
|
||||||
|
<Icon icon={leftOutlined} aria-hidden />
|
||||||
|
</ControlButton>
|
||||||
|
<Text
|
||||||
|
data-testid="lightbox-counter"
|
||||||
|
fontSize="sm"
|
||||||
|
letterSpacing="0.06em"
|
||||||
|
color="whiteAlpha.800"
|
||||||
|
fontVariantNumeric="tabular-nums"
|
||||||
|
position={{ md: 'absolute' }}
|
||||||
|
bottom={{ md: 5 }}
|
||||||
|
left={{ md: '50%' }}
|
||||||
|
transform={{ md: 'translateX(-50%)' }}
|
||||||
|
>
|
||||||
|
{current + 1} / {count}
|
||||||
|
</Text>
|
||||||
|
<ControlButton
|
||||||
|
aria-label="Volgende foto"
|
||||||
|
data-testid="lightbox-next"
|
||||||
|
onClick={() => show(current + 1)}
|
||||||
|
position={{ md: 'absolute' }}
|
||||||
|
right={{ md: 4 }}
|
||||||
|
top={{ md: '50%' }}
|
||||||
|
transform={{ md: 'translateY(-50%)' }}
|
||||||
|
>
|
||||||
|
<Icon
|
||||||
|
icon={rightOutlined}
|
||||||
|
aria-hidden
|
||||||
|
/>
|
||||||
|
</ControlButton>
|
||||||
|
</Box>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<chakra.p
|
||||||
|
srOnly
|
||||||
|
aria-live="polite"
|
||||||
|
data-testid="lightbox-announcement"
|
||||||
|
>
|
||||||
|
{announcement}
|
||||||
|
</chakra.p>
|
||||||
|
</Dialog.Content>
|
||||||
|
)}
|
||||||
|
</Dialog.Positioner>
|
||||||
|
</Portal>
|
||||||
|
</Dialog.Root>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
type PhotoProps = {
|
||||||
|
item: GalleryItem;
|
||||||
|
swipe: ReturnType<typeof useSwipe>;
|
||||||
|
onBackground: (event: MouseEvent<HTMLElement>) => void;
|
||||||
|
};
|
||||||
|
|
||||||
|
// The photo with its caption. Until the large version has loaded, the grid
|
||||||
|
// version (already in the browser cache) stands in at the same size; if
|
||||||
|
// the large one fails, the grid version stays and a short note says so.
|
||||||
|
function Photo({ item, swipe, onBackground }: PhotoProps) {
|
||||||
|
const [load, setLoad] = useState<LoadState>('loading');
|
||||||
|
const onLoad = () => setLoad('loaded');
|
||||||
|
const onError = () => setLoad('failed');
|
||||||
|
const caption =
|
||||||
|
load === 'failed'
|
||||||
|
? 'Deze foto kon niet groot geladen worden'
|
||||||
|
: item.caption;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<chakra.figure
|
||||||
|
m={0}
|
||||||
|
display="flex"
|
||||||
|
flexDirection="column"
|
||||||
|
alignItems="center"
|
||||||
|
maxW="min(1100px, 100%)"
|
||||||
|
maxH="100%"
|
||||||
|
onClick={onBackground}
|
||||||
|
animationName="fade-in"
|
||||||
|
animationDuration="swap"
|
||||||
|
_motionReduce={{ animation: 'none' }}
|
||||||
|
{...swipe}
|
||||||
|
>
|
||||||
|
<Box position="relative" maxH="100%" minH={0}>
|
||||||
|
<chakra.img
|
||||||
|
src={item.thumb.src}
|
||||||
|
alt={load === 'loaded' ? '' : item.thumb.alt}
|
||||||
|
aria-hidden={load === 'loaded' ? true : undefined}
|
||||||
|
width={item.full.width}
|
||||||
|
height={item.full.height}
|
||||||
|
data-testid="lightbox-thumb"
|
||||||
|
display="block"
|
||||||
|
maxW="100%"
|
||||||
|
maxH={{ base: 'calc(100dvh - 10rem)', md: '80svh' }}
|
||||||
|
w="auto"
|
||||||
|
h="auto"
|
||||||
|
objectFit="contain"
|
||||||
|
/>
|
||||||
|
{load !== 'failed' && (
|
||||||
|
<chakra.img
|
||||||
|
src={item.full.src}
|
||||||
|
alt={load === 'loaded' ? item.thumb.alt : ''}
|
||||||
|
aria-hidden={load === 'loaded' ? undefined : true}
|
||||||
|
width={item.full.width}
|
||||||
|
height={item.full.height}
|
||||||
|
data-testid="lightbox-image"
|
||||||
|
decoding="async"
|
||||||
|
onLoad={onLoad}
|
||||||
|
onError={onError}
|
||||||
|
position="absolute"
|
||||||
|
inset={0}
|
||||||
|
w="100%"
|
||||||
|
h="100%"
|
||||||
|
objectFit="contain"
|
||||||
|
opacity={load === 'loaded' ? 1 : 0}
|
||||||
|
transitionProperty="opacity"
|
||||||
|
transitionDuration="swap"
|
||||||
|
_motionReduce={{ transition: 'none' }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</Box>
|
||||||
|
{caption && (
|
||||||
|
<chakra.figcaption
|
||||||
|
data-testid="lightbox-caption"
|
||||||
|
aria-live={load === 'failed' ? 'polite' : undefined}
|
||||||
|
mt={4}
|
||||||
|
fontSize="sm"
|
||||||
|
letterSpacing="0.06em"
|
||||||
|
textAlign="center"
|
||||||
|
color="whiteAlpha.800"
|
||||||
|
>
|
||||||
|
{caption}
|
||||||
|
</chakra.figcaption>
|
||||||
|
)}
|
||||||
|
</chakra.figure>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
type ControlButtonProps = React.ComponentProps<typeof chakra.button>;
|
||||||
|
|
||||||
|
// Buttons over the dark backdrop: the iconControl look (white, half
|
||||||
|
// transparent, full on hover/focus, white focus ring) with a hairline
|
||||||
|
// square around it as in the design (.lightbox__btn)
|
||||||
|
function ControlButton(props: ControlButtonProps) {
|
||||||
|
const iconControl = useRecipe({ key: 'iconControl' });
|
||||||
|
return (
|
||||||
|
<chakra.button
|
||||||
|
type="button"
|
||||||
|
css={iconControl()}
|
||||||
|
w="52px"
|
||||||
|
h="52px"
|
||||||
|
borderWidth="1px"
|
||||||
|
borderColor="whiteAlpha.400"
|
||||||
|
fontSize="1.1rem"
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,109 @@
|
|||||||
|
import { fireEvent, screen, within } from '@testing-library/react';
|
||||||
|
import userEvent from '@testing-library/user-event';
|
||||||
|
import { describe, expect, it, vi } from 'vitest';
|
||||||
|
import { masonryRowSpan } from '@/lib/masonryRowSpan';
|
||||||
|
import { axeResults } from '@/test/axe';
|
||||||
|
import { galleryItems } from '@/test/galleryFixtures';
|
||||||
|
import { renderWithProviders } from '@/test/renderWithProviders';
|
||||||
|
import PortfolioGrid from './PortfolioGrid';
|
||||||
|
|
||||||
|
describe('PortfolioGrid', () => {
|
||||||
|
it('lists the photos in order as links to their large version', async () => {
|
||||||
|
const { container } = await renderWithProviders(
|
||||||
|
<PortfolioGrid items={galleryItems} onOpen={() => {}} />,
|
||||||
|
);
|
||||||
|
const items = within(screen.getByTestId('portfolio-grid')).getAllByRole(
|
||||||
|
'listitem',
|
||||||
|
);
|
||||||
|
expect(items).toHaveLength(galleryItems.length);
|
||||||
|
galleryItems.forEach((item, index) => {
|
||||||
|
const tile = screen.getByTestId(`portfolio-tile-${index + 1}`);
|
||||||
|
expect(items[index]).toContainElement(tile);
|
||||||
|
expect(tile).toHaveAttribute('href', item.full.src);
|
||||||
|
expect(tile).toHaveAccessibleName(
|
||||||
|
`${item.thumb.alt} (groot bekijken)`,
|
||||||
|
);
|
||||||
|
expect(items[index]).toHaveAttribute(
|
||||||
|
'data-row-span',
|
||||||
|
String(masonryRowSpan(item.thumb)),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
expect(await axeResults(container)).toHaveNoViolations();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('loads the first photos straight away and defers the rest', async () => {
|
||||||
|
await renderWithProviders(
|
||||||
|
<PortfolioGrid
|
||||||
|
items={galleryItems}
|
||||||
|
eagerCount={3}
|
||||||
|
onOpen={() => {}}
|
||||||
|
/>,
|
||||||
|
);
|
||||||
|
const images = screen.getAllByRole('img');
|
||||||
|
images.forEach((image, index) => {
|
||||||
|
if (index < 3) {
|
||||||
|
expect(image).toHaveAttribute('fetchpriority', 'high');
|
||||||
|
expect(image).toHaveAttribute(
|
||||||
|
'src',
|
||||||
|
galleryItems[index].thumb.src,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
expect(image).not.toHaveAttribute('fetchpriority');
|
||||||
|
expect(image).toHaveAttribute('loading', 'lazy');
|
||||||
|
}
|
||||||
|
expect(image).toHaveAttribute(
|
||||||
|
'width',
|
||||||
|
String(galleryItems[index].thumb.width),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('asks to open the lightbox on a plain click or Enter', async () => {
|
||||||
|
const onOpen = vi.fn();
|
||||||
|
await renderWithProviders(
|
||||||
|
<PortfolioGrid items={galleryItems} onOpen={onOpen} />,
|
||||||
|
);
|
||||||
|
const user = userEvent.setup();
|
||||||
|
await user.click(screen.getByTestId('portfolio-tile-2'));
|
||||||
|
expect(onOpen).toHaveBeenLastCalledWith(1);
|
||||||
|
screen.getByTestId('portfolio-tile-4').focus();
|
||||||
|
await user.keyboard('{Enter}');
|
||||||
|
expect(onOpen).toHaveBeenLastCalledWith(3);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('leaves a click with a modifier key to the browser', async () => {
|
||||||
|
const onOpen = vi.fn();
|
||||||
|
await renderWithProviders(
|
||||||
|
<PortfolioGrid items={galleryItems} onOpen={onOpen} />,
|
||||||
|
);
|
||||||
|
const tile = screen.getByTestId('portfolio-tile-1');
|
||||||
|
const ctrlClick = fireEvent.click(tile, { ctrlKey: true });
|
||||||
|
const metaClick = fireEvent.click(tile, { metaKey: true });
|
||||||
|
expect(onOpen).not.toHaveBeenCalled();
|
||||||
|
// Not prevented: the browser follows the link
|
||||||
|
expect(ctrlClick).toBe(true);
|
||||||
|
expect(metaClick).toBe(true);
|
||||||
|
expect(fireEvent.click(tile)).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('reports the first hover or focus once', async () => {
|
||||||
|
const onIntent = vi.fn();
|
||||||
|
await renderWithProviders(
|
||||||
|
<PortfolioGrid
|
||||||
|
items={galleryItems}
|
||||||
|
onOpen={() => {}}
|
||||||
|
onIntent={onIntent}
|
||||||
|
/>,
|
||||||
|
);
|
||||||
|
fireEvent.pointerEnter(screen.getByTestId('portfolio-tile-1'));
|
||||||
|
fireEvent.focus(screen.getByTestId('portfolio-tile-2'));
|
||||||
|
expect(onIntent).toHaveBeenCalledTimes(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('renders an empty list without photos', async () => {
|
||||||
|
await renderWithProviders(
|
||||||
|
<PortfolioGrid items={[]} onOpen={() => {}} />,
|
||||||
|
);
|
||||||
|
expect(screen.getByTestId('portfolio-grid')).toBeEmptyDOMElement();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,164 @@
|
|||||||
|
import { useRef, type MouseEvent } from 'react';
|
||||||
|
import { Box, chakra, Image, VisuallyHidden } from '@chakra-ui/react';
|
||||||
|
import DeferredImage from '@/components/DeferredImage/DeferredImage';
|
||||||
|
import Reveal from '@/components/Reveal/Reveal';
|
||||||
|
import type { GalleryItem } from '@/content/types';
|
||||||
|
import {
|
||||||
|
GAP_ROWS,
|
||||||
|
masonryRowSpan,
|
||||||
|
ROWS_PER_COLUMN_WIDTH,
|
||||||
|
} from '@/lib/masonryRowSpan';
|
||||||
|
|
||||||
|
type PortfolioGridProps = {
|
||||||
|
items: readonly GalleryItem[];
|
||||||
|
// How many photos at the start load straight away (the first row on
|
||||||
|
// desktop); the rest wait until the page has loaded and they are near
|
||||||
|
eagerCount?: number;
|
||||||
|
onOpen: (index: number) => void;
|
||||||
|
// First hover or focus on a photo: a good moment to load the lightbox
|
||||||
|
onIntent?: () => void;
|
||||||
|
'data-testid'?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Masonry grid of photos in reading order (design .portfolio-grid): every
|
||||||
|
// photo is shown whole in its own shape, row by row, so keyboard and screen
|
||||||
|
// reader follow the order Andrea chose. Pure CSS: the implicit rows are a
|
||||||
|
// fraction of the column width (container units) and each photo spans as
|
||||||
|
// many as its aspect ratio needs, so nothing shifts while photos load.
|
||||||
|
// Every photo is a link to its large version; a plain click asks the page
|
||||||
|
// to open the lightbox instead.
|
||||||
|
export default function PortfolioGrid({
|
||||||
|
items,
|
||||||
|
eagerCount = 3,
|
||||||
|
onOpen,
|
||||||
|
onIntent,
|
||||||
|
'data-testid': testId = 'portfolio-grid',
|
||||||
|
}: PortfolioGridProps) {
|
||||||
|
const intentReported = useRef(false);
|
||||||
|
const reportIntent = () => {
|
||||||
|
if (intentReported.current) return;
|
||||||
|
intentReported.current = true;
|
||||||
|
onIntent?.();
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleClick = (
|
||||||
|
event: MouseEvent<HTMLAnchorElement>,
|
||||||
|
index: number,
|
||||||
|
) => {
|
||||||
|
// Ctrl/Cmd/Shift/Alt or middle click: let the browser open the link
|
||||||
|
if (
|
||||||
|
event.button !== 0 ||
|
||||||
|
event.metaKey ||
|
||||||
|
event.ctrlKey ||
|
||||||
|
event.shiftKey ||
|
||||||
|
event.altKey
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
event.preventDefault();
|
||||||
|
onOpen(index);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Box containerType="inline-size">
|
||||||
|
<Reveal>
|
||||||
|
<chakra.ul
|
||||||
|
data-testid={testId}
|
||||||
|
listStyleType="none"
|
||||||
|
display="grid"
|
||||||
|
gridTemplateColumns={{
|
||||||
|
base: '1fr',
|
||||||
|
md: 'repeat(2, 1fr)',
|
||||||
|
lg: 'repeat(3, 1fr)',
|
||||||
|
}}
|
||||||
|
columnGap="gridGap"
|
||||||
|
// One implicit row = column width / ROWS_PER_COLUMN_WIDTH
|
||||||
|
gridAutoRows="var(--row)"
|
||||||
|
css={{
|
||||||
|
'--cols': '1',
|
||||||
|
md: { '--cols': '2' },
|
||||||
|
lg: { '--cols': '3' },
|
||||||
|
'--row': `calc((100cqi - (var(--cols) - 1) * {spacing.gridGap}) / var(--cols) / ${ROWS_PER_COLUMN_WIDTH})`,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{items.map((item, index) => {
|
||||||
|
const span = masonryRowSpan(item.thumb);
|
||||||
|
const imageStyle = {
|
||||||
|
display: 'block',
|
||||||
|
w: '100%',
|
||||||
|
h: '100%',
|
||||||
|
objectFit: 'cover',
|
||||||
|
transitionProperty: 'transform',
|
||||||
|
transitionDuration: 'interaction',
|
||||||
|
transitionTimingFunction: 'smooth',
|
||||||
|
_groupHover: { transform: 'scale(1.05)' },
|
||||||
|
_groupFocusVisible: { transform: 'scale(1.05)' },
|
||||||
|
_motionReduce: { transform: 'none !important' },
|
||||||
|
} as const;
|
||||||
|
return (
|
||||||
|
<chakra.li
|
||||||
|
key={item.id}
|
||||||
|
gridRowEnd={`span ${span}`}
|
||||||
|
data-row-span={span}
|
||||||
|
>
|
||||||
|
<chakra.a
|
||||||
|
href={item.full.src}
|
||||||
|
data-testid={`portfolio-tile-${index + 1}`}
|
||||||
|
className="group"
|
||||||
|
display="block"
|
||||||
|
position="relative"
|
||||||
|
overflow="hidden"
|
||||||
|
bg="paper.deep"
|
||||||
|
cursor="zoom-in"
|
||||||
|
// The photo; the last rows are the gap
|
||||||
|
h={`calc(100% - ${GAP_ROWS} * var(--row))`}
|
||||||
|
// Keeps the focus ring above neighbours
|
||||||
|
_focusVisible={{ zIndex: 1 }}
|
||||||
|
// Darkening overlay (design ::after)
|
||||||
|
_after={{
|
||||||
|
content: '""',
|
||||||
|
position: 'absolute',
|
||||||
|
inset: 0,
|
||||||
|
bg: 'ink',
|
||||||
|
opacity: 0,
|
||||||
|
transitionProperty: 'opacity',
|
||||||
|
transitionDuration: 'interaction',
|
||||||
|
pointerEvents: 'none',
|
||||||
|
}}
|
||||||
|
_hover={{ _after: { opacity: 0.25 } }}
|
||||||
|
onClick={(event) =>
|
||||||
|
handleClick(event, index)
|
||||||
|
}
|
||||||
|
onPointerEnter={reportIntent}
|
||||||
|
onFocus={reportIntent}
|
||||||
|
>
|
||||||
|
{index < eagerCount ? (
|
||||||
|
<Image
|
||||||
|
src={item.thumb.src}
|
||||||
|
alt={item.thumb.alt}
|
||||||
|
htmlWidth={item.thumb.width}
|
||||||
|
htmlHeight={item.thumb.height}
|
||||||
|
fetchPriority="high"
|
||||||
|
decoding="async"
|
||||||
|
{...imageStyle}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<DeferredImage
|
||||||
|
image={item.thumb}
|
||||||
|
{...imageStyle}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{/* The alt names the photo; this says what
|
||||||
|
the link does */}{' '}
|
||||||
|
<VisuallyHidden>
|
||||||
|
(groot bekijken)
|
||||||
|
</VisuallyHidden>
|
||||||
|
</chakra.a>
|
||||||
|
</chakra.li>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</chakra.ul>
|
||||||
|
</Reveal>
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -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 = (
|
const renderBlock = (
|
||||||
id: string,
|
id: string,
|
||||||
{ portfolioLive = false, reverse = false, priority = false } = {},
|
{ portfolioLink = false, reverse = false, priority = false } = {},
|
||||||
) =>
|
) =>
|
||||||
renderWithProviders(
|
renderWithProviders(
|
||||||
<ShootBlock
|
<ShootBlock
|
||||||
@@ -18,7 +18,7 @@ const renderBlock = (
|
|||||||
packages={packages}
|
packages={packages}
|
||||||
reverse={reverse}
|
reverse={reverse}
|
||||||
priority={priority}
|
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 () => {
|
it('links to the portfolio filtered on the shoot type when live', async () => {
|
||||||
await renderBlock('portret', { portfolioLive: true });
|
await renderBlock('portret', { portfolioLink: true });
|
||||||
expect(
|
expect(
|
||||||
screen.getByRole('link', { name: "Bekijk meer portretfoto's" }),
|
screen.getByRole('link', { name: "Bekijk meer portretfoto's" }),
|
||||||
).toHaveAttribute('href', '/portfolio?shoot=portret');
|
).toHaveAttribute('href', '/portfolio?shoot=portret');
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ type ShootBlockProps = {
|
|||||||
reverse: boolean;
|
reverse: boolean;
|
||||||
// The first photo on the page loads straight away
|
// The first photo on the page loads straight away
|
||||||
priority: boolean;
|
priority: boolean;
|
||||||
// Show "Bekijk meer …foto's" (BR-SF-04)
|
// Show "Bekijk meer …foto's" (BR-SF-04, BR-SL-01)
|
||||||
portfolioLive: boolean;
|
portfolioLink: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Links in the text column: room around them for a 44px touch target
|
// Links in the text column: room around them for a 44px touch target
|
||||||
@@ -28,7 +28,7 @@ export default function ShootBlock({
|
|||||||
packages,
|
packages,
|
||||||
reverse,
|
reverse,
|
||||||
priority,
|
priority,
|
||||||
portfolioLive,
|
portfolioLink,
|
||||||
}: ShootBlockProps) {
|
}: ShootBlockProps) {
|
||||||
const titleId = `shoot-${shoot.id}-title`;
|
const titleId = `shoot-${shoot.id}-title`;
|
||||||
|
|
||||||
@@ -74,7 +74,7 @@ export default function ShootBlock({
|
|||||||
Stuur een berichtje
|
Stuur een berichtje
|
||||||
</RouterLink>
|
</RouterLink>
|
||||||
</Link>
|
</Link>
|
||||||
{portfolioLive && (
|
{portfolioLink && (
|
||||||
<Link variant="underline" asChild {...linkStyle}>
|
<Link variant="underline" asChild {...linkStyle}>
|
||||||
<RouterLink
|
<RouterLink
|
||||||
{...shootPortfolioLink(shoot)}
|
{...shootPortfolioLink(shoot)}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ const renderList = () =>
|
|||||||
<ShootList
|
<ShootList
|
||||||
shoots={shootTypes}
|
shoots={shootTypes}
|
||||||
packages={packages}
|
packages={packages}
|
||||||
portfolioLive={false}
|
portfolioShoots={[]}
|
||||||
/>,
|
/>,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
import { Box } from '@chakra-ui/react';
|
import { Box } from '@chakra-ui/react';
|
||||||
import PageSection from '@/components/PageSection/PageSection';
|
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';
|
import ShootBlock from '../ShootBlock/ShootBlock';
|
||||||
|
|
||||||
type ShootListProps = {
|
type ShootListProps = {
|
||||||
shoots: readonly ShootType[];
|
shoots: readonly ShootType[];
|
||||||
packages: readonly PricingPackage[];
|
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:
|
// The shoot types below the page head, each in its own full-width band:
|
||||||
@@ -16,7 +18,7 @@ type ShootListProps = {
|
|||||||
export default function ShootList({
|
export default function ShootList({
|
||||||
shoots,
|
shoots,
|
||||||
packages,
|
packages,
|
||||||
portfolioLive,
|
portfolioShoots,
|
||||||
}: ShootListProps) {
|
}: ShootListProps) {
|
||||||
return (
|
return (
|
||||||
<Box data-testid="shoot-list">
|
<Box data-testid="shoot-list">
|
||||||
@@ -32,7 +34,7 @@ export default function ShootList({
|
|||||||
packages={packages}
|
packages={packages}
|
||||||
reverse={index % 2 === 1}
|
reverse={index % 2 === 1}
|
||||||
priority={index === 0}
|
priority={index === 0}
|
||||||
portfolioLive={portfolioLive}
|
portfolioLink={portfolioShoots.includes(shoot.id)}
|
||||||
/>
|
/>
|
||||||
</PageSection>
|
</PageSection>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import type { ContentImage, HomeContent } from './types';
|
import type { ContentImage, HomeContent } from './types';
|
||||||
import testimonials from './testimonials';
|
|
||||||
|
|
||||||
// Images
|
// Images
|
||||||
import intro1 from '../assets/home/intro-1.jpg';
|
import intro1 from '../assets/home/intro-1.jpg';
|
||||||
@@ -12,7 +11,7 @@ import deco2 from '../assets/home/deco-2.png';
|
|||||||
|
|
||||||
// Shared by the intro gallery and the Instagram tiles, so one photo keeps
|
// Shared by the intro gallery and the Instagram tiles, so one photo keeps
|
||||||
// one description
|
// one description
|
||||||
const introPhotos: ContentImage[] = [
|
export const introPhotos: ContentImage[] = [
|
||||||
{
|
{
|
||||||
src: intro1,
|
src: intro1,
|
||||||
alt: 'Babyhandje in de hand van de moeder, op een gebreid dekentje',
|
alt: 'Babyhandje in de hand van de moeder, op een gebreid dekentje',
|
||||||
@@ -78,16 +77,6 @@ const homeContent: HomeContent = {
|
|||||||
title: 'Contact',
|
title: 'Contact',
|
||||||
lead: 'Wil je meer informatie ontvangen? Neem gerust contact met mij op.',
|
lead: 'Wil je meer informatie ontvangen? Neem gerust contact met mij op.',
|
||||||
},
|
},
|
||||||
instagram: {
|
|
||||||
title: 'Instagram',
|
|
||||||
handle: '@andreaslopfotografie',
|
|
||||||
// Photos the page already loads, so the tiles cost no extra download;
|
|
||||||
// Andrea can swap them until the API delivers the real feed
|
|
||||||
photos: [
|
|
||||||
...introPhotos,
|
|
||||||
...testimonials.map((testimonial) => testimonial.image),
|
|
||||||
],
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default homeContent;
|
export default homeContent;
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
import { introPhotos } from './homeContent';
|
||||||
|
import testimonials from './testimonials';
|
||||||
|
import type { InstagramContent } from './types';
|
||||||
|
|
||||||
|
// The Instagram block on the homepage and the portfolio until the API
|
||||||
|
// delivers the real feed. Reuses photos the site already has, so each photo
|
||||||
|
// keeps one description and the homepage downloads nothing extra for them;
|
||||||
|
// Andrea can swap them in the meantime.
|
||||||
|
const instagramContent: InstagramContent = {
|
||||||
|
title: 'Instagram',
|
||||||
|
handle: '@andreaslopfotografie',
|
||||||
|
photos: [
|
||||||
|
...introPhotos,
|
||||||
|
...testimonials.map((testimonial) => testimonial.image),
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
export default instagramContent;
|
||||||
@@ -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;
|
||||||
@@ -48,6 +48,45 @@ export interface ContentImage {
|
|||||||
height: number;
|
height: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// An image file with its intrinsic size, without its own description (the
|
||||||
|
// larger size of a photo whose ContentImage already carries the alt text)
|
||||||
|
export interface ImageSource {
|
||||||
|
src: string;
|
||||||
|
width: number;
|
||||||
|
height: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
// One photo for the shared gallery blocks (PortfolioGrid, Lightbox): a grid
|
||||||
|
// size with the description, a large size for the lightbox, and an optional
|
||||||
|
// visible caption. The blocks know nothing about where the photos come from.
|
||||||
|
export interface GalleryItem {
|
||||||
|
id: string;
|
||||||
|
thumb: ContentImage;
|
||||||
|
full: ImageSource;
|
||||||
|
caption?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
// One choice in a FilterBar
|
||||||
|
export interface FilterOption {
|
||||||
|
id: string;
|
||||||
|
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
|
// A priced shoot offer. id is a stable slug: it goes into ?pakket= and is
|
||||||
// the shoot value the contact form sends.
|
// the shoot value the contact form sends.
|
||||||
export interface PricingPackage {
|
export interface PricingPackage {
|
||||||
@@ -128,12 +167,14 @@ export interface HomeContent {
|
|||||||
title: string;
|
title: string;
|
||||||
lead: string;
|
lead: string;
|
||||||
};
|
};
|
||||||
// A fixed selection until the API delivers the real feed (FR-HP-10)
|
}
|
||||||
instagram: {
|
|
||||||
|
// The Instagram block, shown on the homepage and the portfolio: a fixed
|
||||||
|
// selection until the API delivers the real feed (FR-HP-10)
|
||||||
|
export interface InstagramContent {
|
||||||
title: string;
|
title: string;
|
||||||
handle: string;
|
handle: string;
|
||||||
photos: ContentImage[];
|
photos: ContentImage[];
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Where a link goes: a route (a typo is a type error) and optionally an
|
// Where a link goes: a route (a typo is a type error) and optionally an
|
||||||
|
|||||||
@@ -0,0 +1,68 @@
|
|||||||
|
import { fireEvent, render, screen } from '@testing-library/react';
|
||||||
|
import { describe, expect, it, vi } from 'vitest';
|
||||||
|
import useSwipe from './useSwipe';
|
||||||
|
|
||||||
|
function Target({
|
||||||
|
onPrev,
|
||||||
|
onNext,
|
||||||
|
enabled,
|
||||||
|
}: {
|
||||||
|
onPrev: () => void;
|
||||||
|
onNext: () => void;
|
||||||
|
enabled?: boolean;
|
||||||
|
}) {
|
||||||
|
const handlers = useSwipe({ onPrev, onNext, enabled });
|
||||||
|
return <div data-testid="swipe-target" {...handlers} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
function swipe(target: HTMLElement, from: number, to: number, dy = 0) {
|
||||||
|
fireEvent.touchStart(target, {
|
||||||
|
touches: [{ clientX: from, clientY: 100 }],
|
||||||
|
});
|
||||||
|
fireEvent.touchEnd(target, {
|
||||||
|
changedTouches: [{ clientX: to, clientY: 100 + dy }],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function setup(enabled?: boolean) {
|
||||||
|
const onPrev = vi.fn();
|
||||||
|
const onNext = vi.fn();
|
||||||
|
render(<Target onPrev={onPrev} onNext={onNext} enabled={enabled} />);
|
||||||
|
return { onPrev, onNext, target: screen.getByTestId('swipe-target') };
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('useSwipe', () => {
|
||||||
|
it('calls onNext for a swipe to the left and onPrev for one to the right', () => {
|
||||||
|
const { onPrev, onNext, target } = setup();
|
||||||
|
swipe(target, 300, 200);
|
||||||
|
expect(onNext).toHaveBeenCalledTimes(1);
|
||||||
|
swipe(target, 200, 300);
|
||||||
|
expect(onPrev).toHaveBeenCalledTimes(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('ignores short and vertical touches', () => {
|
||||||
|
const { onPrev, onNext, target } = setup();
|
||||||
|
swipe(target, 300, 270);
|
||||||
|
swipe(target, 300, 200, 150);
|
||||||
|
expect(onNext).not.toHaveBeenCalled();
|
||||||
|
expect(onPrev).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('ignores a touch end without a start, and clears the start after each end', () => {
|
||||||
|
const { onNext, target } = setup();
|
||||||
|
fireEvent.touchEnd(target, {
|
||||||
|
changedTouches: [{ clientX: 0, clientY: 100 }],
|
||||||
|
});
|
||||||
|
swipe(target, 300, 200);
|
||||||
|
fireEvent.touchEnd(target, {
|
||||||
|
changedTouches: [{ clientX: 0, clientY: 100 }],
|
||||||
|
});
|
||||||
|
expect(onNext).toHaveBeenCalledTimes(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('does nothing while disabled', () => {
|
||||||
|
const { onNext, target } = setup(false);
|
||||||
|
swipe(target, 300, 200);
|
||||||
|
expect(onNext).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
import { useRef, type TouchEvent } from 'react';
|
||||||
|
import { type Point, swipeDirection } from '@/lib/swipeDirection';
|
||||||
|
|
||||||
|
type SwipeOptions = {
|
||||||
|
onPrev: () => void;
|
||||||
|
onNext: () => void;
|
||||||
|
// Off: touches are ignored (e.g. a slider with a single slide)
|
||||||
|
enabled?: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Horizontal swipes on touch screens: a swipe to the left calls onNext, to
|
||||||
|
// the right onPrev. Shared by the hero slider and the lightbox, so both
|
||||||
|
// react to the same distance and ignore vertical scrolling the same way.
|
||||||
|
export default function useSwipe({
|
||||||
|
onPrev,
|
||||||
|
onNext,
|
||||||
|
enabled = true,
|
||||||
|
}: SwipeOptions) {
|
||||||
|
const start = useRef<Point | null>(null);
|
||||||
|
|
||||||
|
return {
|
||||||
|
onTouchStart: (event: TouchEvent<HTMLElement>) => {
|
||||||
|
const touch = event.touches[0];
|
||||||
|
start.current = { x: touch.clientX, y: touch.clientY };
|
||||||
|
},
|
||||||
|
onTouchEnd: (event: TouchEvent<HTMLElement>) => {
|
||||||
|
const from = start.current;
|
||||||
|
start.current = null;
|
||||||
|
if (!from || !enabled) return;
|
||||||
|
|
||||||
|
const touch = event.changedTouches[0];
|
||||||
|
const direction = swipeDirection(from, {
|
||||||
|
x: touch.clientX,
|
||||||
|
y: touch.clientY,
|
||||||
|
});
|
||||||
|
if (direction === 'next') onNext();
|
||||||
|
if (direction === 'prev') onPrev();
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,130 @@
|
|||||||
|
import fc from 'fast-check';
|
||||||
|
import { describe, expect, it } from 'vitest';
|
||||||
|
import { lightboxEvent } from '../test/arbitraries';
|
||||||
|
import {
|
||||||
|
closedLightbox,
|
||||||
|
type LightboxEvent,
|
||||||
|
lightboxReducer,
|
||||||
|
type LightboxState,
|
||||||
|
} from './lightboxReducer';
|
||||||
|
|
||||||
|
const open = (index: number, count: number): LightboxState => ({
|
||||||
|
open: true,
|
||||||
|
index,
|
||||||
|
count,
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('lightboxReducer', () => {
|
||||||
|
it('opens at the chosen photo', () => {
|
||||||
|
expect(
|
||||||
|
lightboxReducer(closedLightbox, {
|
||||||
|
type: 'open',
|
||||||
|
index: 2,
|
||||||
|
count: 5,
|
||||||
|
}),
|
||||||
|
).toEqual(open(2, 5));
|
||||||
|
});
|
||||||
|
|
||||||
|
it('stays closed when there are no photos', () => {
|
||||||
|
expect(
|
||||||
|
lightboxReducer(closedLightbox, {
|
||||||
|
type: 'open',
|
||||||
|
index: 0,
|
||||||
|
count: 0,
|
||||||
|
}),
|
||||||
|
).toEqual(closedLightbox);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('wraps around when browsing past either end', () => {
|
||||||
|
expect(lightboxReducer(open(4, 5), { type: 'next' })).toEqual(
|
||||||
|
open(0, 5),
|
||||||
|
);
|
||||||
|
expect(lightboxReducer(open(0, 5), { type: 'prev' })).toEqual(
|
||||||
|
open(4, 5),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('jumps to the first and the last photo', () => {
|
||||||
|
expect(lightboxReducer(open(3, 5), { type: 'first' })).toEqual(
|
||||||
|
open(0, 5),
|
||||||
|
);
|
||||||
|
expect(lightboxReducer(open(1, 5), { type: 'last' })).toEqual(
|
||||||
|
open(4, 5),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('closes on close and when the list changes', () => {
|
||||||
|
expect(lightboxReducer(open(1, 5), { type: 'close' })).toEqual(
|
||||||
|
closedLightbox,
|
||||||
|
);
|
||||||
|
expect(
|
||||||
|
lightboxReducer(open(1, 5), { type: 'listChanged', count: 3 }),
|
||||||
|
).toEqual(closedLightbox);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('ignores browsing while closed', () => {
|
||||||
|
for (const type of [
|
||||||
|
'next',
|
||||||
|
'prev',
|
||||||
|
'first',
|
||||||
|
'last',
|
||||||
|
'close',
|
||||||
|
] as const) {
|
||||||
|
expect(lightboxReducer(closedLightbox, { type })).toBe(
|
||||||
|
closedLightbox,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Stateful property: any sequence of events gives the same result as a
|
||||||
|
// simple model that counts positions on a clock face
|
||||||
|
it('follows the model for any sequence of events (stateful)', () => {
|
||||||
|
type Model = { open: boolean; index: number; count: number };
|
||||||
|
const step = (model: Model, event: LightboxEvent): Model => {
|
||||||
|
if (event.type === 'open') {
|
||||||
|
return event.count < 1
|
||||||
|
? { open: false, index: 0, count: 0 }
|
||||||
|
: {
|
||||||
|
open: true,
|
||||||
|
index:
|
||||||
|
((event.index % event.count) + event.count) %
|
||||||
|
event.count,
|
||||||
|
count: event.count,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if (!model.open) return model;
|
||||||
|
if (event.type === 'next')
|
||||||
|
return { ...model, index: (model.index + 1) % model.count };
|
||||||
|
if (event.type === 'prev')
|
||||||
|
return {
|
||||||
|
...model,
|
||||||
|
index: (model.index + model.count - 1) % model.count,
|
||||||
|
};
|
||||||
|
if (event.type === 'first') return { ...model, index: 0 };
|
||||||
|
if (event.type === 'last')
|
||||||
|
return { ...model, index: model.count - 1 };
|
||||||
|
return { open: false, index: 0, count: 0 };
|
||||||
|
};
|
||||||
|
|
||||||
|
fc.assert(
|
||||||
|
fc.property(
|
||||||
|
fc.array(lightboxEvent, { maxLength: 40 }),
|
||||||
|
(events) => {
|
||||||
|
let state: LightboxState = closedLightbox;
|
||||||
|
let model: Model = { open: false, index: 0, count: 0 };
|
||||||
|
for (const event of events) {
|
||||||
|
state = lightboxReducer(state, event);
|
||||||
|
model = step(model, event);
|
||||||
|
expect(state.open).toBe(model.open);
|
||||||
|
if (state.open) {
|
||||||
|
expect(state.index).toBe(model.index);
|
||||||
|
expect(state.count).toBe(model.count);
|
||||||
|
expect(state.index).toBeGreaterThanOrEqual(0);
|
||||||
|
expect(state.index).toBeLessThan(state.count);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
import { wrapIndex } from './wrapIndex';
|
||||||
|
|
||||||
|
// Whether the lightbox is open, and if so which photo of how many it shows
|
||||||
|
export type LightboxState =
|
||||||
|
{ open: false } | { open: true; index: number; count: number };
|
||||||
|
|
||||||
|
export type LightboxEvent =
|
||||||
|
| { type: 'open'; index: number; count: number }
|
||||||
|
| { type: 'next' }
|
||||||
|
| { type: 'prev' }
|
||||||
|
| { type: 'first' }
|
||||||
|
| { type: 'last' }
|
||||||
|
| { type: 'close' }
|
||||||
|
// The list of photos changed, e.g. another filter: the photo on screen
|
||||||
|
// may no longer be in it, so the lightbox closes
|
||||||
|
| { type: 'listChanged'; count: number };
|
||||||
|
|
||||||
|
export const closedLightbox: LightboxState = { open: false };
|
||||||
|
|
||||||
|
// The lightbox's transitions (functional design, state machine). Browsing
|
||||||
|
// wraps around; anything but opening leaves a closed lightbox closed.
|
||||||
|
export function lightboxReducer(
|
||||||
|
state: LightboxState,
|
||||||
|
event: LightboxEvent,
|
||||||
|
): LightboxState {
|
||||||
|
if (event.type === 'open') {
|
||||||
|
if (event.count < 1) return closedLightbox;
|
||||||
|
return {
|
||||||
|
open: true,
|
||||||
|
index: wrapIndex(event.index, event.count),
|
||||||
|
count: event.count,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if (!state.open) return state;
|
||||||
|
|
||||||
|
switch (event.type) {
|
||||||
|
case 'next':
|
||||||
|
return { ...state, index: wrapIndex(state.index + 1, state.count) };
|
||||||
|
case 'prev':
|
||||||
|
return { ...state, index: wrapIndex(state.index - 1, state.count) };
|
||||||
|
case 'first':
|
||||||
|
return { ...state, index: 0 };
|
||||||
|
case 'last':
|
||||||
|
return { ...state, index: state.count - 1 };
|
||||||
|
case 'close':
|
||||||
|
case 'listChanged':
|
||||||
|
return closedLightbox;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
import fc from 'fast-check';
|
||||||
|
import { describe, expect, it } from 'vitest';
|
||||||
|
import { imageSize } from '../test/arbitraries';
|
||||||
|
import {
|
||||||
|
GAP_ROWS,
|
||||||
|
masonryRowSpan,
|
||||||
|
ROWS_PER_COLUMN_WIDTH,
|
||||||
|
} from './masonryRowSpan';
|
||||||
|
|
||||||
|
const K = ROWS_PER_COLUMN_WIDTH;
|
||||||
|
|
||||||
|
describe('masonryRowSpan', () => {
|
||||||
|
it('spans rows by aspect ratio plus the gap', () => {
|
||||||
|
// Portrait 2:3, landscape 3:2, square
|
||||||
|
expect(masonryRowSpan({ width: 800, height: 1200 })).toBe(
|
||||||
|
60 + GAP_ROWS,
|
||||||
|
);
|
||||||
|
expect(masonryRowSpan({ width: 1200, height: 800 })).toBe(
|
||||||
|
27 + GAP_ROWS,
|
||||||
|
);
|
||||||
|
expect(masonryRowSpan({ width: 800, height: 800 })).toBe(40 + GAP_ROWS);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('gives even a very wide photo at least one row', () => {
|
||||||
|
expect(masonryRowSpan({ width: 10000, height: 10 })).toBe(1 + GAP_ROWS);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('is at least one row plus the gap (invariant)', () => {
|
||||||
|
fc.assert(
|
||||||
|
fc.property(imageSize, (size) => {
|
||||||
|
expect(masonryRowSpan(size)).toBeGreaterThanOrEqual(
|
||||||
|
GAP_ROWS + 1,
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('grows with the photo height relative to its width (invariant)', () => {
|
||||||
|
fc.assert(
|
||||||
|
fc.property(imageSize, imageSize, (a, b) => {
|
||||||
|
const ratioA = a.height / a.width;
|
||||||
|
const ratioB = b.height / b.width;
|
||||||
|
if (ratioA <= ratioB) {
|
||||||
|
expect(masonryRowSpan(a)).toBeLessThanOrEqual(
|
||||||
|
masonryRowSpan(b),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('depends on the shape, not the file size (invariant)', () => {
|
||||||
|
fc.assert(
|
||||||
|
fc.property(
|
||||||
|
imageSize,
|
||||||
|
fc.integer({ min: 2, max: 4 }),
|
||||||
|
(size, factor) => {
|
||||||
|
expect(
|
||||||
|
masonryRowSpan({
|
||||||
|
width: size.width * factor,
|
||||||
|
height: size.height * factor,
|
||||||
|
}),
|
||||||
|
).toBe(masonryRowSpan(size));
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('crops at most half a row (easy verification)', () => {
|
||||||
|
fc.assert(
|
||||||
|
fc.property(imageSize, (size) => {
|
||||||
|
const exact = (K * size.height) / size.width;
|
||||||
|
if (exact >= 1) {
|
||||||
|
const rows = masonryRowSpan(size) - GAP_ROWS;
|
||||||
|
expect(Math.abs(rows - exact)).toBeLessThanOrEqual(0.5);
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
// The masonry grid is a CSS grid with very small implicit rows: one row is
|
||||||
|
// 1/ROWS_PER_COLUMN_WIDTH of the column width, so a photo's height in rows
|
||||||
|
// follows from its aspect ratio alone, at any screen width. No measuring in
|
||||||
|
// the browser, so nothing shifts while photos load.
|
||||||
|
export const ROWS_PER_COLUMN_WIDTH = 40;
|
||||||
|
|
||||||
|
// Vertical space between two photos, in rows (about 5% of the column width)
|
||||||
|
export const GAP_ROWS = 2;
|
||||||
|
|
||||||
|
// How many implicit rows a photo spans: its height at the column width, in
|
||||||
|
// rows, plus the gap below it. Rounding crops at most half a row.
|
||||||
|
export function masonryRowSpan(
|
||||||
|
image: { width: number; height: number },
|
||||||
|
rowsPerColumnWidth: number = ROWS_PER_COLUMN_WIDTH,
|
||||||
|
gapRows: number = GAP_ROWS,
|
||||||
|
): number {
|
||||||
|
const photoRows = Math.max(
|
||||||
|
1,
|
||||||
|
Math.round((rowsPerColumnWidth * image.height) / image.width),
|
||||||
|
);
|
||||||
|
return photoRows + gapRows;
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
import fc from 'fast-check';
|
||||||
|
import { describe, expect, it } from 'vitest';
|
||||||
|
import { neighbourIndexes } from './neighbourIndexes';
|
||||||
|
import { wrapIndex } from './wrapIndex';
|
||||||
|
|
||||||
|
// A list position together with the list length it belongs to
|
||||||
|
const position = fc.integer({ min: 1, max: 30 }).chain((count) =>
|
||||||
|
fc.record({
|
||||||
|
count: fc.constant(count),
|
||||||
|
index: fc.integer({ min: 0, max: count - 1 }),
|
||||||
|
radius: fc.integer({ min: 0, max: 4 }),
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
describe('neighbourIndexes', () => {
|
||||||
|
it('lists the two photos on each side, nearest first', () => {
|
||||||
|
expect(neighbourIndexes(5, 10)).toEqual([6, 4, 7, 3]);
|
||||||
|
expect(neighbourIndexes(0, 10)).toEqual([1, 9, 2, 8]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('lists each photo once in a short list', () => {
|
||||||
|
expect(neighbourIndexes(0, 1)).toEqual([]);
|
||||||
|
expect(neighbourIndexes(0, 2)).toEqual([1]);
|
||||||
|
expect(neighbourIndexes(1, 3)).toEqual([2, 0]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('never repeats a photo or includes the current one (invariant)', () => {
|
||||||
|
fc.assert(
|
||||||
|
fc.property(position, ({ index, count, radius }) => {
|
||||||
|
const result = neighbourIndexes(index, count, radius);
|
||||||
|
expect(new Set(result).size).toBe(result.length);
|
||||||
|
expect(result).not.toContain(index);
|
||||||
|
for (const i of result) {
|
||||||
|
expect(i).toBeGreaterThanOrEqual(0);
|
||||||
|
expect(i).toBeLessThan(count);
|
||||||
|
}
|
||||||
|
expect(result).toHaveLength(Math.min(2 * radius, count - 1));
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('matches all positions within the radius (oracle)', () => {
|
||||||
|
fc.assert(
|
||||||
|
fc.property(position, ({ index, count, radius }) => {
|
||||||
|
const expected = new Set<number>();
|
||||||
|
for (let d = -radius; d <= radius; d++) {
|
||||||
|
expected.add(wrapIndex(index + d, count));
|
||||||
|
}
|
||||||
|
expected.delete(index);
|
||||||
|
expect(new Set(neighbourIndexes(index, count, radius))).toEqual(
|
||||||
|
expected,
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
import { wrapIndex } from './wrapIndex';
|
||||||
|
|
||||||
|
// The positions around `index` whose large photos the lightbox loads ahead,
|
||||||
|
// nearest first and alternating next/previous (next, previous, next+1, …).
|
||||||
|
// The list wraps around, so in a short list each photo appears once and the
|
||||||
|
// current one never.
|
||||||
|
export function neighbourIndexes(
|
||||||
|
index: number,
|
||||||
|
count: number,
|
||||||
|
radius: number = 2,
|
||||||
|
): number[] {
|
||||||
|
const result: number[] = [];
|
||||||
|
for (let distance = 1; distance <= radius; distance++) {
|
||||||
|
for (const candidate of [
|
||||||
|
wrapIndex(index + distance, count),
|
||||||
|
wrapIndex(index - distance, count),
|
||||||
|
]) {
|
||||||
|
if (candidate !== index && !result.includes(candidate)) {
|
||||||
|
result.push(candidate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
@@ -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");
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -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`;
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
import fc from 'fast-check';
|
||||||
|
import { describe, expect, it } from 'vitest';
|
||||||
|
import { point } from '../test/arbitraries';
|
||||||
|
import { SWIPE_THRESHOLD, swipeDirection } from './swipeDirection';
|
||||||
|
|
||||||
|
const origin = { x: 200, y: 300 };
|
||||||
|
|
||||||
|
describe('swipeDirection', () => {
|
||||||
|
it('reads a swipe to the left as next and to the right as previous', () => {
|
||||||
|
expect(swipeDirection(origin, { x: 120, y: 310 })).toBe('next');
|
||||||
|
expect(swipeDirection(origin, { x: 280, y: 290 })).toBe('prev');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('ignores short and mostly vertical touches', () => {
|
||||||
|
expect(swipeDirection(origin, { x: 160, y: 300 })).toBeNull();
|
||||||
|
expect(swipeDirection(origin, { x: 120, y: 420 })).toBeNull();
|
||||||
|
expect(swipeDirection(origin, origin)).toBeNull();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('counts a swipe of exactly the threshold', () => {
|
||||||
|
expect(
|
||||||
|
swipeDirection(origin, { x: origin.x - SWIPE_THRESHOLD, y: 300 }),
|
||||||
|
).toBe('next');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('flips direction when the swipe is mirrored (invariant)', () => {
|
||||||
|
fc.assert(
|
||||||
|
fc.property(point, point, (start, end) => {
|
||||||
|
const mirrored = { x: 2 * start.x - end.x, y: end.y };
|
||||||
|
const flip = { next: 'prev', prev: 'next' } as const;
|
||||||
|
const result = swipeDirection(start, end);
|
||||||
|
expect(swipeDirection(start, mirrored)).toBe(
|
||||||
|
result === null ? null : flip[result],
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('does not depend on where on the screen the swipe happens (invariant)', () => {
|
||||||
|
fc.assert(
|
||||||
|
fc.property(point, point, point, (start, end, offset) => {
|
||||||
|
const moved = (p: { x: number; y: number }) => ({
|
||||||
|
x: p.x + offset.x,
|
||||||
|
y: p.y + offset.y,
|
||||||
|
});
|
||||||
|
expect(swipeDirection(moved(start), moved(end))).toBe(
|
||||||
|
swipeDirection(start, end),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('is no swipe when too short or more vertical than horizontal (invariant)', () => {
|
||||||
|
fc.assert(
|
||||||
|
fc.property(point, point, (start, end) => {
|
||||||
|
const dx = Math.abs(end.x - start.x);
|
||||||
|
const dy = Math.abs(end.y - start.y);
|
||||||
|
const result = swipeDirection(start, end);
|
||||||
|
expect(result === null).toBe(dx < SWIPE_THRESHOLD || dx < dy);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
export interface Point {
|
||||||
|
x: number;
|
||||||
|
y: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Minimum horizontal travel in px before a touch counts as a swipe
|
||||||
|
export const SWIPE_THRESHOLD = 50;
|
||||||
|
|
||||||
|
// Which way a touch from `start` to `end` browses: a swipe to the left shows
|
||||||
|
// the next photo, to the right the previous one. Too short, or more vertical
|
||||||
|
// than horizontal (the visitor is scrolling), is no swipe.
|
||||||
|
export function swipeDirection(
|
||||||
|
start: Point,
|
||||||
|
end: Point,
|
||||||
|
threshold: number = SWIPE_THRESHOLD,
|
||||||
|
): 'next' | 'prev' | null {
|
||||||
|
const dx = end.x - start.x;
|
||||||
|
const dy = end.y - start.y;
|
||||||
|
if (Math.abs(dx) < threshold || Math.abs(dx) < Math.abs(dy)) return null;
|
||||||
|
return dx < 0 ? 'next' : 'prev';
|
||||||
|
}
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
import fc from 'fast-check';
|
||||||
|
import { describe, expect, it } from 'vitest';
|
||||||
|
import { wrapIndex } from './wrapIndex';
|
||||||
|
|
||||||
|
const count = fc.integer({ min: 1, max: 50 });
|
||||||
|
const index = fc.integer({ min: -1000, max: 1000 });
|
||||||
|
|
||||||
|
describe('wrapIndex', () => {
|
||||||
|
it('wraps past either end of the list', () => {
|
||||||
|
expect(wrapIndex(0, 5)).toBe(0);
|
||||||
|
expect(wrapIndex(5, 5)).toBe(0);
|
||||||
|
expect(wrapIndex(-1, 5)).toBe(4);
|
||||||
|
expect(wrapIndex(-6, 5)).toBe(4);
|
||||||
|
expect(wrapIndex(12, 5)).toBe(2);
|
||||||
|
expect(wrapIndex(3, 1)).toBe(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('always lands inside the list (invariant)', () => {
|
||||||
|
fc.assert(
|
||||||
|
fc.property(index, count, (i, c) => {
|
||||||
|
const result = wrapIndex(i, c);
|
||||||
|
expect(Number.isInteger(result)).toBe(true);
|
||||||
|
expect(result).toBeGreaterThanOrEqual(0);
|
||||||
|
expect(result).toBeLessThan(c);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('is periodic in the list length (invariant)', () => {
|
||||||
|
fc.assert(
|
||||||
|
fc.property(
|
||||||
|
index,
|
||||||
|
count,
|
||||||
|
fc.integer({ min: -5, max: 5 }),
|
||||||
|
(i, c, k) => {
|
||||||
|
expect(wrapIndex(i + k * c, c)).toBe(wrapIndex(i, c));
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('changes nothing when applied twice (idempotence)', () => {
|
||||||
|
fc.assert(
|
||||||
|
fc.property(index, count, (i, c) => {
|
||||||
|
expect(wrapIndex(wrapIndex(i, c), c)).toBe(wrapIndex(i, c));
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('returns to the same photo after next then previous (round-trip)', () => {
|
||||||
|
fc.assert(
|
||||||
|
fc.property(index, count, (i, c) => {
|
||||||
|
const start = wrapIndex(i, c);
|
||||||
|
const next = wrapIndex(start + 1, c);
|
||||||
|
expect(wrapIndex(next - 1, c)).toBe(start);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('matches stepping one by one through the list (oracle)', () => {
|
||||||
|
fc.assert(
|
||||||
|
fc.property(fc.integer({ min: -60, max: 60 }), count, (i, c) => {
|
||||||
|
let position = 0;
|
||||||
|
for (let step = 0; step < Math.abs(i); step++) {
|
||||||
|
position =
|
||||||
|
i > 0
|
||||||
|
? position === c - 1
|
||||||
|
? 0
|
||||||
|
: position + 1
|
||||||
|
: position === 0
|
||||||
|
? c - 1
|
||||||
|
: position - 1;
|
||||||
|
}
|
||||||
|
expect(wrapIndex(i, c)).toBe(position);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
// A position in a list of `count` items that wraps around both ways: one
|
||||||
|
// past the last is the first, one before the first is the last. Used for
|
||||||
|
// browsing photos in the hero and the lightbox.
|
||||||
|
export function wrapIndex(index: number, count: number): number {
|
||||||
|
return ((index % count) + count) % count;
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
import { defineRecipe } from '@chakra-ui/react';
|
||||||
|
|
||||||
|
// The buttons of a FilterBar: small caps in the eyebrow style, the chosen
|
||||||
|
// one in accent.deep with an underline (aria-pressed). ink.soft and
|
||||||
|
// accent.deep both reach 4.5:1 on paper; the 2px underline marks the choice
|
||||||
|
// for those who cannot tell the colours apart.
|
||||||
|
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',
|
||||||
|
px: 1,
|
||||||
|
bg: 'transparent',
|
||||||
|
textStyle: 'eyebrow',
|
||||||
|
color: 'ink.soft',
|
||||||
|
cursor: 'pointer',
|
||||||
|
textDecoration: 'underline',
|
||||||
|
textDecorationColor: 'transparent',
|
||||||
|
textDecorationThickness: '2px',
|
||||||
|
textUnderlineOffset: '0.55em',
|
||||||
|
transitionProperty: 'color, text-decoration-color',
|
||||||
|
transitionDuration: 'interaction',
|
||||||
|
transitionTimingFunction: 'smooth',
|
||||||
|
_hover: { color: 'ink' },
|
||||||
|
_pressed: {
|
||||||
|
color: 'accent.deep',
|
||||||
|
textDecorationColor: 'currentColor',
|
||||||
|
cursor: 'default',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export default filterControlRecipe;
|
||||||
@@ -1,13 +1,14 @@
|
|||||||
import { createFileRoute } from '@tanstack/react-router';
|
import { createFileRoute } from '@tanstack/react-router';
|
||||||
import Hero from '../components/Hero/Hero';
|
import Hero from '../components/Hero/Hero';
|
||||||
|
import InstagramGrid from '../components/InstagramGrid/InstagramGrid';
|
||||||
import AboutBlock from '../components/home/AboutBlock/AboutBlock';
|
import AboutBlock from '../components/home/AboutBlock/AboutBlock';
|
||||||
import ContactSection from '../components/home/ContactSection/ContactSection';
|
import ContactSection from '../components/home/ContactSection/ContactSection';
|
||||||
import InstagramGrid from '../components/home/InstagramGrid/InstagramGrid';
|
|
||||||
import Pricing from '../components/home/Pricing/Pricing';
|
import Pricing from '../components/home/Pricing/Pricing';
|
||||||
import Testimonials from '../components/home/Testimonials/Testimonials';
|
import Testimonials from '../components/home/Testimonials/Testimonials';
|
||||||
import IntroGallery from '../components/home/IntroGallery/IntroGallery';
|
import IntroGallery from '../components/home/IntroGallery/IntroGallery';
|
||||||
import heroContent from '../content/heroContent';
|
import heroContent from '../content/heroContent';
|
||||||
import homeContent from '../content/homeContent';
|
import homeContent from '../content/homeContent';
|
||||||
|
import instagramContent from '../content/instagramContent';
|
||||||
import packages from '../content/packages';
|
import packages from '../content/packages';
|
||||||
import testimonials from '../content/testimonials';
|
import testimonials from '../content/testimonials';
|
||||||
import siteContent from '../content/siteContent';
|
import siteContent from '../content/siteContent';
|
||||||
@@ -52,7 +53,7 @@ function Index() {
|
|||||||
/>
|
/>
|
||||||
{instagram && (
|
{instagram && (
|
||||||
<InstagramGrid
|
<InstagramGrid
|
||||||
content={homeContent.instagram}
|
content={instagramContent}
|
||||||
profileUrl={instagram.href}
|
profileUrl={instagram.href}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -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 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')({
|
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,
|
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() {
|
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 (
|
return (
|
||||||
<PageIntro eyebrow="Werk" title="Portfolio">
|
<>
|
||||||
Deze pagina is nog in de maak. Kom snel terug!
|
<PageIntro eyebrow={intro.eyebrow} title={intro.title}>
|
||||||
|
{intro.text}
|
||||||
</PageIntro>
|
</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}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||