feat(photo-annotator): edit from annotated image with Reset button#1521
Merged
Merged
Conversation
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>
Contributor
|
🎉 This PR is included in version 2.6.0-beta.58 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.annotatedAtis set) lets users switch back to the original photo and start fresh with a clean canvas.How it works
canonicalUrlnow switches based onisShowingOriginalstatefalse(default): loads annotated.webp if present (via the/api/photos/:id/fileendpoint's default behavior of preferring annotated)true: forces the original with?variant=originalquery parameterFiles changed
client/src/components/photos/PhotoAnnotator/PhotoAnnotator.tsx— state management, Reset button UI, modalclient/src/components/photos/PhotoAnnotator/PhotoAnnotator.module.css— button and modal stylingclient/src/components/photos/PhotoAnnotator/PhotoAnnotator.test.tsx— tests for annotated image loading and Reset behaviorclient/src/i18n/en/photoAnnotator.json— i18n keys for Reset label and confirmation copyVerification
✅ 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— succeededDesign & UX notes
photo.annotatedAt !== null(no point showing it for unannotated photos)rgba(0,0,0,0.7))🤖 Generated with Claude Code