Shares the Instagram block between pages

Moves InstagramGrid out of the homepage sections and gives it its own
content module, so the portfolio can show the same block. The homepage
renders exactly as before; the tiles keep reusing the intro and review
photos, so each photo keeps one description.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-25 21:32:48 +01:00
co-authored by Claude Opus 5.5
parent b35b1c2404
commit e013f1436b
13 changed files with 394 additions and 31 deletions
@@ -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,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).