diff --git a/aidlc-docs/features/homepage-sections/aidlc-state.md b/aidlc-docs/features/homepage-sections/aidlc-state.md index 297beea..142f5fd 100644 --- a/aidlc-docs/features/homepage-sections/aidlc-state.md +++ b/aidlc-docs/features/homepage-sections/aidlc-state.md @@ -5,7 +5,7 @@ - **Feature Slug**: homepage-sections - **Project Type**: Brownfield - **Start Date**: 2026-10-19T19:19:38Z -- **Current Stage**: CONSTRUCTION - Build and Test +- **Current Stage**: CONSTRUCTION - Build and Test (complete, awaiting Operations decision) - **Branch**: feature/homepage-sections ## Workspace State @@ -67,14 +67,14 @@ - [x] NFR Design - SKIP - [x] Infrastructure Design - SKIP - [x] Code Generation - EXECUTE (per unit) — Unit 1 Lifestyle fotografie ✅, Unit 2 Over mij ✅ (desktop review deferred by user), Unit 3 Prijzen ✅, Unit 4 Lieve woorden ✅, Unit 5 Contact ✅, Unit 6 Instagram ✅ -- [ ] Build and Test - EXECUTE +- [x] Build and Test - EXECUTE ### 🟡 OPERATIONS PHASE - [ ] Deployment Setup, Monitoring Setup, Production Readiness Validation - UNDECIDED ## Current Status - **Lifecycle Phase**: CONSTRUCTION -- **Current Stage**: Build and Test (in progress) +- **Current Stage**: Build and Test complete, awaiting the Operations decision - **Next Stage**: Operations decision, then PR merge ## Reverse Engineering Status diff --git a/aidlc-docs/features/homepage-sections/audit.md b/aidlc-docs/features/homepage-sections/audit.md index 2b76a91..5dc674c 100644 --- a/aidlc-docs/features/homepage-sections/audit.md +++ b/aidlc-docs/features/homepage-sections/audit.md @@ -860,3 +860,48 @@ De foto mag nog iets kleiner? 75% van huidige groote maken is denk ik goed. Het **Context**: CONSTRUCTION - Unit 6 Code Generation approved --- + +## Build and Test — Push, PR, Browser Checks + +**Timestamp**: 2026-10-21T23:29:37Z + +**User Input**: (none — continuing the authorised steps) + +**AI Response**: "Pushed 1905295, dispatched a test deploy (run 557), created PR #6 (Gitea rejects 4-byte emoji in PR bodies, so the attribution line has none). Scripted browser checks on the production build (headless Chrome, 1440 and 390): section order ✅, layout shift while scrolling 0.0008 / 0 ✅, every Boek button selects its package and tidies the URL ✅, keyboard focus on Instagram tiles visible and on top ✅. Contact lands 24px below the header on desktop: its scroll-margin is the full header height (92px) while the header has shrunk to 68px by then. On phones 9px: the page is 394px wide instead of 390 because the Lifestyle fotografie row (unit 1) bleeds out by the gutter token (20px) while Chakra's Container pads 16/24/32px instead of the design's --gutter (clamp(20px, 4vw, 48px)); Chrome zooms the layout viewport and the visual viewport sits 9px lower. Asked the owner how to fix (site-wide Container padding = gutter as in the design, or a local fix in the gallery) and whether to align the Contact offset with the shrunken header." + +**Context**: CONSTRUCTION - Build and Test (in progress, awaiting decision) + +--- + +## Build and Test — Owner Decisions on the Findings + +**Timestamp**: 2026-10-21T23:33:28Z + +**User Input**: "Zijmarge: Overal zoals design (Recommended)" / "Contact: Direct onder header" + +**AI Response**: "Container padding becomes the design's gutter token site-wide; anchored sections use the shrunken (sticky) header height as scroll margin." + +**Context**: CONSTRUCTION - Build and Test, fixes + +--- + +## Build and Test Stage + +**Timestamp**: 2026-10-21T23:46:08Z + +**Build Status**: Success + +**Test Status**: Pass (244 unit/app tests; browser integration scenarios after two fixes; Lighthouse home mobile 0.83, desktop 1.0, other pages 0.94–0.95 / 1.0) + +**Files Generated**: +- build-instructions.md +- unit-test-instructions.md +- integration-test-instructions.md +- performance-test-instructions.md +- build-and-test-summary.md + +**Fixes**: Container padding = gutter site-wide (page was 394px wide on phones), header extra padding removed, to-top aligned to gutter, anchored sections scroll to the sticky header height. A local pnpm check failed once on port 4173, occupied by the CI Lighthouse job on the PC runner (host network); rerun after the job: green. + +**Operations Phase Decision**: Undecided (asked in the completion message) + +--- diff --git a/aidlc-docs/features/homepage-sections/construction/build-and-test/build-and-test-summary.md b/aidlc-docs/features/homepage-sections/construction/build-and-test/build-and-test-summary.md new file mode 100644 index 0000000..aaf2b4c --- /dev/null +++ b/aidlc-docs/features/homepage-sections/construction/build-and-test/build-and-test-summary.md @@ -0,0 +1,52 @@ +# Build and Test Summary — homepage-sections + +## Build +- **Tool**: pnpm + Vite (`tsc && vite build`) +- **Status**: ✅ Success (built in ~2.5 s locally; CI `check` job green on the Pi and on the PC runner) +- **Artifacts**: `web/dist/` + +## Unit tests +- **Total**: 244 in 53 files. **Passed**: 244. **Failed**: 0. +- **Coverage**: `src/lib/` 100%, overall ~92% of statements +- **Status**: ✅ Pass + +## Integration (whole homepage) +- **Automated, in the suite**: section order with one h1 and axe clean; "Boek Newborn" scrolls to Contact and selects the package; `?pakket=` selects, tidies and focuses; Instagram absent without a valid https link. ✅ +- **Browser, production build, 1440 px and 390 px phone** (scenarios in `integration-test-instructions.md`): + +| Scenario | Result | +|---|---| +| Section order | ✅ | +| Layout shift while scrolling the whole page | ✅ 0.0008 / 0 | +| All three "Boek" buttons | ✅ after fixes 1 and 2 below | +| Keyboard focus on the Instagram tiles | ✅ | +| Horizontal overflow, 7 pages × 5 widths | ✅ after fix 1 below | +| No new image requests from Instagram | ✅ | + +### Found and fixed in this stage +1. **Phones: the page was 4 px too wide.** + - Cause: Chakra's `Container` padded 16 / 24 / 32 px, while the design's `.container` uses `--gutter` (clamp(20 px, 4vw, 48 px)). The Lifestyle fotografie row bleeds out by the gutter, so it stuck out 4 px on both sides. + - Effect: Chrome widened the layout viewport to 394 px, and the page could be nudged sideways. + - Fix (the owner chose to follow the design everywhere): `Container` pads with `gutter`. The header loses its extra padding from the first hero commit, and the to-top button aligns with the gutter. The logo, hero controls and content now share one edge. +2. **Desktop: Contact landed 24 px below the header.** + - Cause: the scroll margin was the full header height (92 px), but the header has shrunk to 68 px by the time the page reaches Contact. + - Fix: anchored sections use the sticky header height (`spacing.header.sticky`). + +## Performance (Lighthouse CI, production build) +| Page | Mobile | Desktop | +|---|---|---| +| Homepage | 0.83 (budget 0.8) | 1.0 | +| Other pages | 0.94–0.95 (budget 0.9) | 1.0 | + +Accessibility and best practices are 1.0 on every page, and SEO passes everywhere. CI `lighthouse` job: ✅ (reporting only). + +Two things disturb local measurements: a busy machine, and the CI Lighthouse job on the PC runner. That job uses `--network host`, so it occupies port 4173 and makes a local `pnpm check` fail with "port in use". See `performance-test-instructions.md`. + +## Additional +- **Security**: `pnpm audit --prod` clean. The new section adds no new dependencies or external resources. External links use `noopener noreferrer`, and only https links are rendered. +- **Contract / E2E suite**: N/A (static front end without an API). The browser checks above cover the user flows. + +## Overall +- **Build**: ✅ **Tests**: ✅ **Performance budgets**: ✅ +- **Test environment**: test.andreaslop.nl was updated with unit 6 (run 557). The layout fixes are deployed in a follow-up run. +- **Ready for Operations**: yes, depending on the owner's decision about the Operations phase diff --git a/aidlc-docs/features/homepage-sections/construction/build-and-test/build-instructions.md b/aidlc-docs/features/homepage-sections/construction/build-and-test/build-instructions.md new file mode 100644 index 0000000..fa831cb --- /dev/null +++ b/aidlc-docs/features/homepage-sections/construction/build-and-test/build-instructions.md @@ -0,0 +1,24 @@ +# Build Instructions — homepage-sections + +## Prerequisites +- **Node.js** 24 and **pnpm** (version pinned in `web/package.json`) +- **OS**: Windows, Linux or macOS. CI builds on the Raspberry Pi runner (arm64). +- **Environment variables**: none for the build. `LIGHTHOUSE_PERFORMANCE=warn` only in CI (see performance instructions) + +## Build steps +```bash +cd web +pnpm install # also runs `chakra typegen` (postinstall) +pnpm build # tsc && vite build +``` + +After changing theme tokens (`src/theme.ts`), run `pnpm typegen` so token names such as `header.sticky` type-check. + +## Verify +- **Expected output**: `✓ built in …s` and no TypeScript errors +- **Artifacts**: `web/dist/` (`index.html`, `assets/*.js|css|jpg|png`) +- **Accepted warning**: Vite's chunk-size warning for the main bundle (`index-*.js`, ~575 kB unminified size before gzip). This is known and tracked under responsive images and prerendering (NFR-P-01). + +## Troubleshooting +- **Unknown token type errors after a theme change** → `pnpm typegen`. +- **Lighthouse or preview fails with "port in use"** → a preview server is still running on 4173. Stop it first. diff --git a/aidlc-docs/features/homepage-sections/construction/build-and-test/integration-test-instructions.md b/aidlc-docs/features/homepage-sections/construction/build-and-test/integration-test-instructions.md new file mode 100644 index 0000000..786109e --- /dev/null +++ b/aidlc-docs/features/homepage-sections/construction/build-and-test/integration-test-instructions.md @@ -0,0 +1,19 @@ +# Integration Test Instructions — homepage-sections + +The six units are sections of one page, so "integration" means how they behave together on the real homepage. + +## Automated (in `pnpm test`, `src/app.test.tsx`) +- **Section order**: Hero → Lifestyle fotografie → Over mij → Prijzen → Lieve woorden → Contact → Instagram, exactly one h1, axe clean on the whole page +- **Prijzen → Contact**: a click on "Boek Newborn" scrolls to `#contact` and selects Newborn. A `?pakket=` link selects the package, tidies the URL and focuses Contact. +- **siteContent → Instagram**: the section is absent when the Instagram link is missing or not https + +## In a real browser (production build) +Run against `pnpm build && pnpm preview`, with headless Chrome (puppeteer-core and chrome-launcher are already installed as Lighthouse dependencies) or by hand, at 1440 px and at an emulated 390 px phone: + +| # | Scenario | Expected | +|---|---|---| +| 1 | Scroll the whole homepage in steps | Cumulative layout shift < 0.1 (measured 0.0008 / 0) | +| 2 | Each "Boek …" button, starting from the top | Contact's top edge lines up with the bottom of the (shrunken) header, the select shows the package, the URL ends in `/#contact` | +| 3 | Tab from the Instagram handle to the first tile | 2px focus ring visible on top of the neighbouring tiles; the photo zooms in | +| 4 | Every page at 320, 390, 768, 1024 and 1440 px | `scrollWidth === innerWidth`: no horizontal overflow | +| 5 | Network panel while scrolling the homepage | The Instagram section requests no new images | diff --git a/aidlc-docs/features/homepage-sections/construction/build-and-test/performance-test-instructions.md b/aidlc-docs/features/homepage-sections/construction/build-and-test/performance-test-instructions.md new file mode 100644 index 0000000..666dfa9 --- /dev/null +++ b/aidlc-docs/features/homepage-sections/construction/build-and-test/performance-test-instructions.md @@ -0,0 +1,22 @@ +# Performance Test Instructions — homepage-sections + +A static site: there is no load or throughput testing. Performance means page-load performance, measured with Lighthouse CI. + +```bash +cd web +pnpm build +pnpm lighthouse # mobile (lighthouserc.cjs) then desktop (lighthouserc.desktop.cjs) +``` + +## Budgets +- **Performance**: + - homepage on mobile ≥ 0.8. This is a temporary budget until responsive images and prerendering arrive (NFR-P-01). + - every other page on mobile ≥ 0.9. + - every page on desktop ≥ 0.9. +- **Accessibility and best practices**: 1.0 on every page +- **SEO**: the basic audits on every page; `is-crawlable` only on indexed pages + +## Measuring reliably +- Measure the **production build**. The Vite dev server (`pnpm dev`) serves 137 unbundled modules and scores ~0.55 on desktop and ~0.36 on mobile, which says nothing about the site. +- Lighthouse throttles the CPU relative to the machine's own speed. A busy machine (a game, a dev server rebuilding) scatters the homepage mobile score between 0.68 and 0.84. Compare `environment.benchmarkIndex` in the report: when it is far below ~3500–4200, rerun on a quiet machine. +- In CI the Raspberry Pi scores 30–40 points lower, so performance is reported there and does not block (`LIGHTHOUSE_PERFORMANCE=warn`). diff --git a/aidlc-docs/features/homepage-sections/construction/build-and-test/unit-test-instructions.md b/aidlc-docs/features/homepage-sections/construction/build-and-test/unit-test-instructions.md new file mode 100644 index 0000000..9837d68 --- /dev/null +++ b/aidlc-docs/features/homepage-sections/construction/build-and-test/unit-test-instructions.md @@ -0,0 +1,12 @@ +# Unit Test Execution — homepage-sections + +```bash +cd web +pnpm test # vitest run --coverage +``` + +- **Expected**: 53 files, 244 tests, 0 failures (count at the end of unit 6) +- **Coverage**: `src/lib/` (all business logic) at 100%. The suite overall is ~92% of statements. +- **Includes**: axe checks per section and per page, property-based tests (fast-check) for the contact form logic, and app-level tests through the real route tree (`src/app.test.tsx`) +- **Report**: terminal output plus `web/coverage/` +- jsdom has no layout or scrolling, so anything about positions, sizes and scroll behaviour is checked in the browser instead (see integration instructions). diff --git a/web/src/components/BackToTop/BackToTop.tsx b/web/src/components/BackToTop/BackToTop.tsx index d2cff60..8f718e3 100644 --- a/web/src/components/BackToTop/BackToTop.tsx +++ b/web/src/components/BackToTop/BackToTop.tsx @@ -32,7 +32,7 @@ export default function BackToTop() { data-testid="back-to-top-button" position="fixed" bottom={EDGE} - right={`max(${EDGE}, calc((100vw - {sizes.content}) / 2 + {spacing.8}))`} + right={`max(${EDGE}, calc((100vw - {sizes.content}) / 2 + {spacing.gutter}))`} zIndex="backToTop" display="inline-flex" alignItems="center" diff --git a/web/src/components/HomeSection/HomeSection.tsx b/web/src/components/HomeSection/HomeSection.tsx index d1ca575..ce5fc8f 100644 --- a/web/src/components/HomeSection/HomeSection.tsx +++ b/web/src/components/HomeSection/HomeSection.tsx @@ -32,8 +32,9 @@ export default function HomeSection({ aria-labelledby={labelledBy} data-testid={testId} bg={tone === 'alt' ? 'paper.alt' : 'paper'} - // An anchor target (#contact) lands below the fixed header - scrollMarginTop={id ? 'header' : undefined} + // An anchor target (#contact) lands right below the fixed header, + // which has shrunk to its sticky height by the time it gets there + scrollMarginTop={id ? 'header.sticky' : undefined} py={spacing === 'tight' ? 'sectionYTight' : 'sectionY'} > {width === 'full' ? ( diff --git a/web/src/components/NavigationBar/NavigationBar.tsx b/web/src/components/NavigationBar/NavigationBar.tsx index 282e525..6aa0e7b 100644 --- a/web/src/components/NavigationBar/NavigationBar.tsx +++ b/web/src/components/NavigationBar/NavigationBar.tsx @@ -58,7 +58,6 @@ export default function NavigationBar() { borderBottomColor={overlay('line', 'transparent')} // Schaduw alleen na scrollen, zoals .header--sticky in het design boxShadow={pastHero ? 'sm' : 'none'} - px={{ base: 4, md: 8 }} transitionProperty="height, background-color, color, border-color, box-shadow" transitionDuration="interaction" transitionTimingFunction="smooth" diff --git a/web/src/recipes/container.ts b/web/src/recipes/container.ts index dc59cdd..015d2e4 100644 --- a/web/src/recipes/container.ts +++ b/web/src/recipes/container.ts @@ -1,10 +1,13 @@ import { defineRecipe } from '@chakra-ui/react'; -// Uitbreiding op Chakra's Container: de maximale breedte komt uit één token, -// zodat de to-top-knop met dezelfde rand kan uitlijnen. +// Uitbreiding op Chakra's Container: de maximale breedte en de zijmarge komen +// uit tokens, zodat de to-top-knop, de hero-knoppen en de full-bleed fotorij +// met dezelfde rand kunnen uitlijnen. Zijmarge = gutter, zoals .container in +// het design (Chakra's eigen 16/24/32px week daarvan af). const containerRecipe = defineRecipe({ base: { maxWidth: 'content', + px: 'gutter', }, }); diff --git a/web/src/theme.ts b/web/src/theme.ts index 54a0a19..17202d7 100644 --- a/web/src/theme.ts +++ b/web/src/theme.ts @@ -156,7 +156,11 @@ const config = defineConfig({ }, spacing: { // Zelfde waarde voor content die onder de balk begint (pt="header") - header: { value: '{sizes.header}' }, + header: { + DEFAULT: { value: '{sizes.header}' }, + // Waar een anker onder de (dan al gekrompen) balk landt + sticky: { value: '{sizes.header.sticky}' }, + }, // Begin van de inhoud op een gewone pagina: onder de balk, met lucht pageTop: { value: 'calc({sizes.header} + clamp(3rem, 7vw, 6rem))',