Guide cover image (#18) #29

Merged
miko merged 1 commit from feature/18-guide-cover-image into development 2026-11-02 11:43:48 +01:00
Owner

Closes #18

An optional 4:3 cover image represents a guide in category grids (GLOSSARY: Cover Image); without one the guide keeps its coloured tile, with no fallback to step images.

  • New CoverImage model (one per guide), stored like a step image (ADR-0006): the original is kept for re-cropping, and each crop gets its own id, so immutable caching stays truthful. Migration 20261102500000_add_cover_image.
  • Set/replace, re-crop and remove actions (src/coverImages/actions.ts) reuse the step-image pipeline (readUpload, renderVariants, file helpers). They check canEditGuide (owner, any author in wiki mode, admins) and are serialised by a lock on the guide row.
  • /media serves step and cover images; the helpers are now named imageAccess/imageHref.
  • The cover editor sits in the guide editor's sidebar and reuses CropDialog.
  • Tile uses a plain <img> with a thumb/medium srcset instead of next/image, which would cache guarded media past the visibility check. This also affects category tiles.

Tests: GuideListing (cover vs. coloured tile), the shared readUpload helper, and access rules for covers. Upload, re-crop (old variants 404) and remove were checked by hand in the dev app.

Follow-ups from review, not done here: move the shared image code from src/stepImages/ to e.g. src/images/; let re-cropping step and cover images share one function.

🤖 Generated with Claude Code

Closes #18 An optional 4:3 cover image represents a guide in category grids (GLOSSARY: Cover Image); without one the guide keeps its coloured tile, with no fallback to step images. - New `CoverImage` model (one per guide), stored like a step image (ADR-0006): the original is kept for re-cropping, and each crop gets its own id, so immutable caching stays truthful. Migration `20261102500000_add_cover_image`. - Set/replace, re-crop and remove actions (`src/coverImages/actions.ts`) reuse the step-image pipeline (`readUpload`, `renderVariants`, file helpers). They check `canEditGuide` (owner, any author in wiki mode, admins) and are serialised by a lock on the guide row. - `/media` serves step and cover images; the helpers are now named `imageAccess`/`imageHref`. - The cover editor sits in the guide editor's sidebar and reuses `CropDialog`. - `Tile` uses a plain `<img>` with a thumb/medium srcset instead of `next/image`, which would cache guarded media past the visibility check. This also affects category tiles. Tests: GuideListing (cover vs. coloured tile), the shared `readUpload` helper, and access rules for covers. Upload, re-crop (old variants 404) and remove were checked by hand in the dev app. Follow-ups from review, not done here: move the shared image code from `src/stepImages/` to e.g. `src/images/`; let re-cropping step and cover images share one function. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
An optional 4:3 image represents a guide in category grids (GLOSSARY:
Cover Image); without one the guide keeps its coloured tile, with no
fallback to step images.

- New CoverImage model, one per guide, stored like a step image
  (ADR-0006): the original is kept for re-cropping, and each crop gets
  its own id, so immutable caching stays truthful.
- Set/replace, re-crop and remove actions reuse the step-image pipeline
  (readUpload, renderVariants, file helpers). Edits are checked with
  canEditGuide (owner, any author in wiki mode, admins) and serialised
  by a lock on the guide row.
- /media resolves step and cover images alike; the guide-based access
  rules are now named imageAccess/imageHref.
- The cover editor sits in the guide editor's sidebar and reuses
  CropDialog.
- Tile renders a plain <img> with a thumb/medium srcset, because
  next/image would cache guarded media past the visibility check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
miko merged commit 6468d6d8a5 into development 2026-11-02 11:43:48 +01:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MassiveDynamic/kataba!29
No description provided.