From 989eea9e24f4dbba6b62f30f9264a69639d5a6a7 Mon Sep 17 00:00:00 2001 From: Reece Browne <74901996+reecebrowne@users.noreply.github.com> Date: Thu, 2 Oct 2025 10:40:18 +0100 Subject: [PATCH] Feature/viewer annotation toggle (#4557) # Description of Changes --- ## Checklist ### General - [ ] I have read the [Contribution Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md) - [ ] I have read the [Stirling-PDF Developer Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md) (if applicable) - [ ] I have read the [How to add new languages to Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md) (if applicable) - [ ] I have performed a self-review of my own code - [ ] My changes generate no new warnings ### Documentation - [ ] I have updated relevant docs on [Stirling-PDF's doc repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/) (if functionality has heavily changed) - [ ] I have read the section [Add New Translation Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md#add-new-translation-tags) (for new translation tags only) ### UI Changes (if applicable) - [ ] Screenshots or videos demonstrating the UI changes are attached (e.g., as comments or direct attachments in the PR) ### Testing (if applicable) - [ ] I have tested my changes locally. Refer to the [Testing Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md#6-testing) for more details. --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: James Brunton --- CLAUDE.md | 5 + .../public/locales/en-GB/translation.json | 7 +- .../shared/NavigationWarningModal.tsx | 11 +- frontend/src/components/shared/RightRail.tsx | 4 + .../components/shared/rightRail/RightRail.css | 6 +- .../rightRail/ViewerAnnotationControls.tsx | 222 ++++++++++++++++++ .../src/components/viewer/EmbedPdfViewer.tsx | 9 +- .../src/components/viewer/LocalEmbedPDF.tsx | 16 +- .../viewer/LocalEmbedPDFWithAnnotations.tsx | 4 +- .../components/viewer/SignatureAPIBridge.tsx | 8 +- .../src/components/viewer/ZoomAPIBridge.tsx | 14 +- frontend/src/contexts/ViewerContext.tsx | 30 +++ frontend/src/contexts/file/fileActions.ts | 4 - frontend/src/hooks/useThumbnailGeneration.ts | 4 +- 14 files changed, 307 insertions(+), 37 deletions(-) create mode 100644 frontend/src/components/shared/rightRail/ViewerAnnotationControls.tsx diff --git a/CLAUDE.md b/CLAUDE.md index bc6af38c9..d111f8da3 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -192,6 +192,11 @@ return useToolOperation({ - **Preview System**: Tool results can be previewed without polluting file context (Split tool example) - **Performance**: Web Worker thumbnails, IndexedDB persistence, background processing +## Translation Rules + +- **CRITICAL**: Always update translations in `en-GB` only, never `en-US` +- Translation files are located in `frontend/public/locales/` + ## Important Notes - **Java Version**: Minimum JDK 17, supports and recommends JDK 21 diff --git a/frontend/public/locales/en-GB/translation.json b/frontend/public/locales/en-GB/translation.json index 45d36a371..826c48960 100644 --- a/frontend/public/locales/en-GB/translation.json +++ b/frontend/public/locales/en-GB/translation.json @@ -3079,7 +3079,12 @@ "panMode": "Pan Mode", "rotateLeft": "Rotate Left", "rotateRight": "Rotate Right", - "toggleSidebar": "Toggle Sidebar" + "toggleSidebar": "Toggle Sidebar", + "exportSelected": "Export Selected Pages", + "toggleAnnotations": "Toggle Annotations Visibility", + "annotationMode": "Toggle Annotation Mode", + "draw": "Draw", + "save": "Save" }, "search": { "title": "Search PDF", diff --git a/frontend/src/components/shared/NavigationWarningModal.tsx b/frontend/src/components/shared/NavigationWarningModal.tsx index e9622d6d4..203e66ff7 100644 --- a/frontend/src/components/shared/NavigationWarningModal.tsx +++ b/frontend/src/components/shared/NavigationWarningModal.tsx @@ -8,7 +8,7 @@ interface NavigationWarningModalProps { } const NavigationWarningModal = ({ - onApplyAndContinue, + onApplyAndContinue: _onApplyAndContinue, onExportAndContinue }: NavigationWarningModalProps) => { @@ -30,13 +30,6 @@ const NavigationWarningModal = ({ confirmNavigation(); }; - const _handleApplyAndContinue = async () => { - if (onApplyAndContinue) { - await onApplyAndContinue(); - } - setHasUnsavedChanges(false); - confirmNavigation(); - }; const handleExportAndContinue = async () => { if (onExportAndContinue) { @@ -85,7 +78,7 @@ const NavigationWarningModal = ({ {/* TODO:: Add this back in when it works */} - {/* {onApplyAndContinue && ( + {/* {_onApplyAndContinue && (