Skip to content

feat(photo-annotator): edit from annotated image with Reset button#1521

Merged
steilerDev merged 1 commit into
betafrom
feat/annotator-edit-from-annotated-with-reset
May 19, 2026
Merged

feat(photo-annotator): edit from annotated image with Reset button#1521
steilerDev merged 1 commit into
betafrom
feat/annotator-edit-from-annotated-with-reset

Conversation

@steilerDev
Copy link
Copy Markdown
Owner

Summary

When editing a previously annotated photo, the annotator now loads the annotated image as the base, allowing new shapes to be drawn on top of existing annotations. This preserves annotation history while enabling incremental improvements.

New feature: Reset button (visible only when photo.annotatedAt is set) lets users switch back to the original photo and start fresh with a clean canvas.

How it works

  • Base image loading: The canonicalUrl now switches based on isShowingOriginal state
    • When false (default): loads annotated.webp if present (via the /api/photos/:id/file endpoint's default behavior of preferring annotated)
    • When true: forces the original with ?variant=original query parameter
  • Reset flow: Confirmation modal → switches to original → clears undo stack and selected shapes
  • Save behavior: The canvas bake captures whatever's rendered (annotated base + any new shapes), so saving after a reset produces the original + new shapes seamlessly

Files changed

  • client/src/components/photos/PhotoAnnotator/PhotoAnnotator.tsx — state management, Reset button UI, modal
  • client/src/components/photos/PhotoAnnotator/PhotoAnnotator.module.css — button and modal styling
  • client/src/components/photos/PhotoAnnotator/PhotoAnnotator.test.tsx — tests for annotated image loading and Reset behavior
  • client/src/i18n/en/photoAnnotator.json — i18n keys for Reset label and confirmation copy

Verification

✅ TypeScript: npx tsc --noEmit -p client/tsconfig.json — zero errors
✅ Tests: npx jest client/src/components/photos/PhotoAnnotator/PhotoAnnotator.test.ts --maxWorkers=1 — all pass (33/33, 3 todo)
✅ Build: npm run build — succeeded

Design & UX notes

  • Reset button only renders when photo.annotatedAt !== null (no point showing it for unannotated photos)
  • Confirmation modal prevents accidental loss of work
  • When reset is used, the image changes to original, but the user can still save to create a new baked version
  • Dark mode: inherited from PhotoViewer's dark background (action bar uses rgba(0,0,0,0.7))
  • Accessibility: live region announces completion; buttons are keyboard accessible

🤖 Generated with Claude Code

When editing a previously annotated photo, the annotator now loads the
annotated image as the base, allowing new shapes to be drawn on top of
existing annotations. This preserves the annotation history while enabling
incremental improvements.

Added a Reset button (only visible when photo.annotatedAt is set) that
lets users switch back to the original photo and start fresh. The reset
clears the in-progress undo stack so users get a clean canvas from the
original image.

The base image URL switches between annotated and original based on the
isShowingOriginal state: when false (default), loads annotated.webp if
present; when true, uses variant=original query parameter.

Changes:
- Update canonicalUrl computation to use variant=original when isShowingOriginal
- Add isShowingOriginal state and Reset confirmation modal
- Add i18n keys: reset, resetTitle, resetBody, resetConfirm, resetComplete
- Add Reset button to action bar with Modal confirmation
- Update PhotoAnnotator tests to verify annotated image loads and reset behavior

Co-Authored-By: Claude frontend-developer (Haiku 4.5) <noreply@anthropic.com>
@steilerDev steilerDev merged commit b7b32d6 into beta May 19, 2026
25 of 30 checks passed
@steilerDev steilerDev deleted the feat/annotator-edit-from-annotated-with-reset branch May 19, 2026 15:25
@github-actions
Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 2.6.0-beta.58 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant