From 196b1de21c858c87a55211317bd874f39fa52611 Mon Sep 17 00:00:00 2001 From: James Brunton Date: Fri, 15 Aug 2025 13:56:27 +0100 Subject: [PATCH] Add tooltip to Remove Password tool --- .../public/locales/en-GB/translation.json | 3 +++ .../public/locales/en-US/translation.json | 3 +++ .../tooltips/useRemovePasswordTips.ts | 20 +++++++++++++++++++ frontend/src/tools/RemovePassword.tsx | 3 +++ 4 files changed, 29 insertions(+) create mode 100644 frontend/src/components/tooltips/useRemovePasswordTips.ts diff --git a/frontend/public/locales/en-GB/translation.json b/frontend/public/locales/en-GB/translation.json index 52d73b1f2..e4bee88a2 100644 --- a/frontend/public/locales/en-GB/translation.json +++ b/frontend/public/locales/en-GB/translation.json @@ -1878,6 +1878,9 @@ "error": { "failed": "An error occurred while removing the password from the PDF." }, + "tooltip": { + "description": "Removing password protection requires the password that was used to encrypt the PDF. This will decrypt the document, making it accessible without a password." + }, "results": { "title": "Decrypted PDFs" } diff --git a/frontend/public/locales/en-US/translation.json b/frontend/public/locales/en-US/translation.json index 29b48ad91..aefe7d076 100644 --- a/frontend/public/locales/en-US/translation.json +++ b/frontend/public/locales/en-US/translation.json @@ -1740,6 +1740,9 @@ "error": { "failed": "An error occurred while removing the password from the PDF." }, + "tooltip": { + "description": "Removing password protection requires the password that was used to encrypt the PDF. This will decrypt the document, making it accessible without a password." + }, "results": { "title": "Decrypted PDFs" } diff --git a/frontend/src/components/tooltips/useRemovePasswordTips.ts b/frontend/src/components/tooltips/useRemovePasswordTips.ts new file mode 100644 index 000000000..1ec303cd6 --- /dev/null +++ b/frontend/src/components/tooltips/useRemovePasswordTips.ts @@ -0,0 +1,20 @@ +import { useTranslation } from 'react-i18next'; +import { TooltipContent } from '../../types/tips'; + +export const useRemovePasswordTips = (): TooltipContent => { + const { t } = useTranslation(); + + return { + header: { + title: t("removePassword.title", "Remove Password") + }, + tips: [ + { + description: t( + "removePassword.tooltip.description", + "Removing password protection requires the current password that was used to encrypt the PDF. This will decrypt the document, making it accessible without a password." + ) + } + ] + }; +}; diff --git a/frontend/src/tools/RemovePassword.tsx b/frontend/src/tools/RemovePassword.tsx index e114fef23..16e6120a7 100644 --- a/frontend/src/tools/RemovePassword.tsx +++ b/frontend/src/tools/RemovePassword.tsx @@ -16,6 +16,7 @@ import RemovePasswordSettings from "../components/tools/removePassword/RemovePas import { useRemovePasswordParameters } from "../hooks/tools/removePassword/useRemovePasswordParameters"; import { useRemovePasswordOperation } from "../hooks/tools/removePassword/useRemovePasswordOperation"; +import { useRemovePasswordTips } from "../components/tooltips/useRemovePasswordTips"; import { BaseToolProps } from "../types/tool"; const RemovePassword = ({ onPreviewFile, onComplete, onError }: BaseToolProps) => { @@ -25,6 +26,7 @@ const RemovePassword = ({ onPreviewFile, onComplete, onError }: BaseToolProps) = const removePasswordParams = useRemovePasswordParameters(); const removePasswordOperation = useRemovePasswordOperation(); + const removePasswordTips = useRemovePasswordTips(); // Endpoint validation const { enabled: endpointEnabled, loading: endpointLoading } = useEndpointEnabled(removePasswordParams.getEndpointName()); @@ -104,6 +106,7 @@ const RemovePassword = ({ onPreviewFile, onComplete, onError }: BaseToolProps) = isCompleted={passwordCollapsed} onCollapsedClick={hasResults ? handleSettingsReset : undefined} completedMessage={passwordCollapsed ? t('removePassword.password.completed', 'Password configured') : undefined} + tooltip={removePasswordTips} >