From c989d8f1fd1182aee3504a1eb8840f0e28be105e Mon Sep 17 00:00:00 2001 From: James Brunton Date: Thu, 14 Aug 2025 14:48:05 +0100 Subject: [PATCH] Improve titles, headers and tooltips in Add Password and Change Permissions --- .../public/locales/en-GB/translation.json | 25 +++++------ .../public/locales/en-US/translation.json | 19 ++++---- .../addPassword/AddPasswordSettings.test.tsx | 6 +-- .../tools/addPassword/AddPasswordSettings.tsx | 4 +- .../ChangePermissionsSettings.test.tsx | 44 ++++++------------- .../ChangePermissionsSettings.tsx | 4 +- .../tooltips/useAddPasswordPermissionsTips.ts | 17 +++++++ .../components/tooltips/useAddPasswordTips.ts | 4 -- .../tooltips/useChangePermissionsTips.ts | 7 ++- frontend/src/tools/AddPassword.tsx | 7 ++- frontend/src/tools/ChangePermissions.tsx | 2 +- 11 files changed, 67 insertions(+), 72 deletions(-) create mode 100644 frontend/src/components/tooltips/useAddPasswordPermissionsTips.ts diff --git a/frontend/public/locales/en-GB/translation.json b/frontend/public/locales/en-GB/translation.json index 247162df3..fce197c76 100644 --- a/frontend/public/locales/en-GB/translation.json +++ b/frontend/public/locales/en-GB/translation.json @@ -1786,9 +1786,8 @@ "error": { "failed": "An error occurred while encrypting the PDF." }, + "title": "Passwords & Encryption", "passwords": { - "title": "Passwords", - "stepTitle": "Passwords & Encryption", "completed": "Passwords configured", "user": { "label": "User Password", @@ -1799,13 +1798,9 @@ "placeholder": "Enter owner password" } }, - "permissions": { - "stepTitle": "Document Permissions" - }, "encryption": { - "title": "Encryption", "keyLength": { - "label": "Key Length", + "label": "Encryption Key Length", "40bit": "40-bit (Low)", "128bit": "128-bit (Standard)", "256bit": "256-bit (High)" @@ -1831,20 +1826,19 @@ "bullet2": "128-bit: Standard security, widely supported", "bullet3": "256-bit: Maximum security, requires modern viewers" }, - "restrictions": { - "title": "Document Restrictions", - "text": "These restrictions control what users can do with the PDF. Most effective when combined with an owner password." + "permissions": { + "text": "These permissions control what users can do with the PDF. Most effective when combined with an owner password." } } }, "changePermissions": { "completed": "Permissions changed", "submit": "Change Permissions", + "title": "Document Permissions", "error": { "failed": "An error occurred while changing PDF permissions." }, - "restrictions": { - "title": "Document Restrictions", + "permissions": { "preventAssembly": { "label": "Prevent assembly of document" }, @@ -1878,8 +1872,11 @@ "title": "Change Permissions" }, "description": { - "title": "Description", - "text": "Changes document permissions. Warning: To make these restrictions unchangeable, use the Add Password tool to set an owner password." + "text": "Changes document permissions, allowing/disallowing access to different features in PDF readers." + }, + "warning": { + "title": "Warning", + "text": "To make these permissions unchangeable, use the Add Password tool to set an owner password." } } } diff --git a/frontend/public/locales/en-US/translation.json b/frontend/public/locales/en-US/translation.json index 641acf013..887f430d3 100644 --- a/frontend/public/locales/en-US/translation.json +++ b/frontend/public/locales/en-US/translation.json @@ -1655,9 +1655,8 @@ "stepTitle": "Document Permissions" }, "encryption": { - "title": "Encryption", "keyLength": { - "label": "Key Length", + "label": "Encryption Key Length", "40bit": "40-bit (Low)", "128bit": "128-bit (Standard)", "256bit": "256-bit (High)" @@ -1683,20 +1682,19 @@ "bullet2": "128-bit: Standard security, widely supported", "bullet3": "256-bit: Maximum security, requires modern viewers" }, - "restrictions": { - "title": "Document Restrictions", - "text": "These restrictions control what users can do with the PDF. Most effective when combined with an owner password." + "permissions": { + "text": "These permissions control what users can do with the PDF. Most effective when combined with an owner password." } } }, "changePermissions": { "completed": "Permissions changed", "submit": "Change Permissions", + "title": "Document Permissions", "error": { "failed": "An error occurred while changing PDF permissions." }, - "restrictions": { - "title": "Document Restrictions", + "permissions": { "preventAssembly": { "label": "Prevent assembly of document" }, @@ -1730,8 +1728,11 @@ "title": "Change Permissions" }, "description": { - "title": "Description", - "text": "Changes document permissions. Warning: To make these restrictions unchangeable, use the Add Password tool to set an owner password." + "text": "Changes document permissions, allowing/disallowing access to different features in PDF readers." + }, + "warning": { + "title": "Warning", + "text": "To make these permissions unchangeable, use the Add Password tool to set an owner password." } } } diff --git a/frontend/src/components/tools/addPassword/AddPasswordSettings.test.tsx b/frontend/src/components/tools/addPassword/AddPasswordSettings.test.tsx index ac4b000f2..92373f60d 100644 --- a/frontend/src/components/tools/addPassword/AddPasswordSettings.test.tsx +++ b/frontend/src/components/tools/addPassword/AddPasswordSettings.test.tsx @@ -63,8 +63,8 @@ describe('AddPasswordSettings', () => { ); // Check that main section titles are rendered - expect(screen.getByText('mock-addPassword.passwords.title')).toBeInTheDocument(); - expect(screen.getByText('mock-addPassword.encryption.title')).toBeInTheDocument(); + expect(screen.getByText('mock-addPassword.passwords.user.label')).toBeInTheDocument(); + expect(screen.getByText('mock-addPassword.encryption.keyLength.label')).toBeInTheDocument(); }); test('should call onParameterChange when password fields are modified', () => { @@ -154,8 +154,6 @@ describe('AddPasswordSettings', () => { ); // Verify that translation keys are being called - expect(mockT).toHaveBeenCalledWith('addPassword.passwords.title', 'Passwords'); - expect(mockT).toHaveBeenCalledWith('addPassword.encryption.title', 'Encryption'); expect(mockT).toHaveBeenCalledWith('addPassword.passwords.user.label', 'User Password'); expect(mockT).toHaveBeenCalledWith('addPassword.passwords.owner.label', 'Owner Password'); }); diff --git a/frontend/src/components/tools/addPassword/AddPasswordSettings.tsx b/frontend/src/components/tools/addPassword/AddPasswordSettings.tsx index 6cce5ef0c..96ce6aad5 100644 --- a/frontend/src/components/tools/addPassword/AddPasswordSettings.tsx +++ b/frontend/src/components/tools/addPassword/AddPasswordSettings.tsx @@ -16,7 +16,6 @@ const AddPasswordSettings = ({ parameters, onParameterChange, disabled = false } {/* Password Settings */} - {t('addPassword.passwords.title', 'Passwords')} - {t('addPassword.encryption.title', 'Encryption')}