Shared image module for step and cover images (#30) #36

Merged
miko merged 1 commit from feature/30-shared-image-module into development 2026-11-02 14:08:30 +01:00
Owner

Closes #30.

Moves the code step and cover images share out of src/stepImages/ into src/images/, and removes the duplication between the two kinds. No behaviour change.

  • Module: files, storage, processImage, crop, cropForm, upload, href, access and CropDialog now live in src/images/. The shared upload rules moved to src/images/rules.ts; src/stepImages/stepImage.ts keeps only MAX_STEP_IMAGES.
  • One re-crop flow: recropImage in src/images/recrop.ts reads the crop, reads the original, renders the variants, calls a swap callback, then deletes the losing image's variants. recropStepImage and recropCoverImage only supply their locked row swap and their error messages.
  • One crop mapping: src/images/storedCrop.ts (cropColumns, croppedImage) replaces cropFields, the edit page's own croppedImage/StoredImage and the inline field lists in the re-crop actions.
  • Names: in the image editors, call is now callServer and run is now changeImages. FILE_HINT/UPLOAD_HINT were already removed by the translation work in #3.
  • submittedCrop moved next to cropForm, and removingOnFailure into files, so the shared flow doesn't depend on the request-bound i18n.

Not touched (out of scope in the issue): the empty variants/<id>/ directories left behind after deleting variants, and coverTileImage always declaring 960w.

Testing

  • New unit tests for recropImage (real sharp, temp-dir storage, fake swap: success, image gone, failed swap, missing original, unreadable crop) and for storedCrop.
  • Unit tests 257/257, typecheck and lint pass; the e2e suite passes.
  • A throwaway Playwright run against a production build (not committed) checked step-image re-crop and delete, and cover-image upload, re-crop, replace and remove.

🤖 Generated with Claude Code

Closes #30. Moves the code step and cover images share out of `src/stepImages/` into `src/images/`, and removes the duplication between the two kinds. No behaviour change. - **Module:** `files`, `storage`, `processImage`, `crop`, `cropForm`, `upload`, `href`, `access` and `CropDialog` now live in `src/images/`. The shared upload rules moved to `src/images/rules.ts`; `src/stepImages/stepImage.ts` keeps only `MAX_STEP_IMAGES`. - **One re-crop flow:** `recropImage` in `src/images/recrop.ts` reads the crop, reads the original, renders the variants, calls a swap callback, then deletes the losing image's variants. `recropStepImage` and `recropCoverImage` only supply their locked row swap and their error messages. - **One crop mapping:** `src/images/storedCrop.ts` (`cropColumns`, `croppedImage`) replaces `cropFields`, the edit page's own `croppedImage`/`StoredImage` and the inline field lists in the re-crop actions. - **Names:** in the image editors, `call` is now `callServer` and `run` is now `changeImages`. `FILE_HINT`/`UPLOAD_HINT` were already removed by the translation work in #3. - `submittedCrop` moved next to `cropForm`, and `removingOnFailure` into `files`, so the shared flow doesn't depend on the request-bound i18n. Not touched (out of scope in the issue): the empty `variants/<id>/` directories left behind after deleting variants, and `coverTileImage` always declaring 960w. ## Testing - New unit tests for `recropImage` (real sharp, temp-dir storage, fake swap: success, image gone, failed swap, missing original, unreadable crop) and for `storedCrop`. - Unit tests 257/257, typecheck and lint pass; the e2e suite passes. - A throwaway Playwright run against a production build (not committed) checked step-image re-crop and delete, and cover-image upload, re-crop, replace and remove. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Move the code step and cover images share (storage, files, processing,
crop, upload, media access, href, CropDialog) from src/stepImages/ to
src/images/; src/stepImages/ keeps only MAX_STEP_IMAGES and its actions
and components.

- recropImage runs the one re-crop flow for both kinds; each action only
  supplies its locked row swap.
- storedCrop maps the crop columns both ways (cropColumns, croppedImage),
  replacing cropFields, the edit page's own mapping and the inline field
  lists in the re-crop actions.
- submittedCrop moves next to cropForm, removingOnFailure into files.
- The editors' call/run helpers are now callServer/changeImages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
miko merged commit b48a0f4fad into development 2026-11-02 14:08:30 +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!36
No description provided.