From 68ab9bc25c63027b362152341a23858e55f82e39 Mon Sep 17 00:00:00 2001 From: Danyl Mishyn <35381314+lendihop@users.noreply.github.com> Date: Wed, 6 Nov 2024 10:12:41 +0100 Subject: [PATCH 1/3] TW-1549: Sync settings section (#1217) * sync * transition some basic forms to v7 * refactor * fix imports * some after-merge fixes * rm redundant prop * rm global settings content padding --- public/_locales/en/messages.json | 17 +- src/app/atoms/CaptionAlert.tsx | 8 +- src/app/atoms/action-modal/action-modal.tsx | 7 +- .../hooks/use-temple-backend-action-form.ts | 22 +-- src/app/layouts/PageLayout/index.tsx | 8 +- ...onfirm-reveal-private-key-access-modal.tsx | 32 ++-- .../edit-account-name-modal.tsx | 36 ++-- .../AccountSettings/remove-account-modal.tsx | 28 ++- src/app/pages/Settings/Settings.tsx | 25 ++- .../pages/Settings/reset-extension-modal.tsx | 34 ++-- .../confirm-seed-phrase-access-modal.tsx | 40 ++-- .../delete-wallet-modal.tsx | 32 ++-- .../rename-wallet-modal.tsx | 39 ++-- .../templates/Synchronization/QrCodeModal.tsx | 26 +++ .../Synchronization/SyncSettings.selectors.ts | 2 +- .../Synchronization/SyncSettings.tsx | 171 ++++++++---------- .../Synchronization/SyncUnavailableModal.tsx | 31 ++++ src/lib/temple/back/actions.ts | 4 +- src/lib/temple/back/main.ts | 2 +- src/lib/temple/back/vault/index.ts | 44 +++-- src/lib/temple/front/client.ts | 5 +- src/lib/temple/types.ts | 1 + 22 files changed, 373 insertions(+), 241 deletions(-) create mode 100644 src/app/templates/Synchronization/QrCodeModal.tsx create mode 100644 src/app/templates/Synchronization/SyncUnavailableModal.tsx diff --git a/public/_locales/en/messages.json b/public/_locales/en/messages.json index da7ebf2968..442987623b 100644 --- a/public/_locales/en/messages.json +++ b/public/_locales/en/messages.json @@ -189,7 +189,7 @@ } }, "okGotIt": { - "message": "Got it" + "message": "Got It" }, "changelogTitle": { "message": "Temple Wallet updated" @@ -3331,19 +3331,22 @@ "message": "Temple Sync" }, "syncSettingsTitle": { - "message": "Sync with Mobile Temple Wallet" + "message": "Sync with Temple Wallet app" }, "syncSettingsDescription": { - "message": "You can sync your Seed Phrase and accounts (HD) with your mobile device. If you just open the Temple Mobile app for the first time, click 'Sync' button and follow the steps in your phone." + "message": "Easily sync your Seed Phrase from current wallet with the mobile app. Just select Sync method for import during the initial setup of the Temple app, and follow the steps to complete." }, - "syncPasswordDescription": { - "message": "Use your current wallet password to start the synchronization." + "syncSettingsPassword": { + "message": "Enter the password to reveal QR-code" }, "syncSettingsAlert": { - "message": "Make sure nobody else is looking at your screen when you scan this code." + "message": "Make sure nobody else is looking at your screen when you scan this QR-code." }, "scanQRWithTempleMobile": { - "message": "Scan this QR-code with yor Temple Wallet Mobile app." + "message": "Scan this QR-code with your Temple Wallet\nmobile app to sync." + }, + "syncUnavailable": { + "message": "This feature allows you to sync Temple extension with mobile app. You can only sync your Seed Phrase from wallet that supports Tezos network. Switch your current account to proceed synchronization." }, "serviceIsUnavailable": { "message": "Sorry, service is temporarily unavailable. Try again later!" diff --git a/src/app/atoms/CaptionAlert.tsx b/src/app/atoms/CaptionAlert.tsx index 4411602114..a6e0eca4e2 100644 --- a/src/app/atoms/CaptionAlert.tsx +++ b/src/app/atoms/CaptionAlert.tsx @@ -12,6 +12,7 @@ type CaptionAlertType = 'success' | 'error' | 'info' | 'warning'; interface Props { type: CaptionAlertType; message: string; + title?: string; className?: string; textClassName?: string; } @@ -24,7 +25,7 @@ const TYPE_CLASSES: Record = { }; /** Refer to `./Alert` for existing functionality */ -export const CaptionAlert = memo(({ type, message, className, textClassName }) => { +export const CaptionAlert = memo(({ type, message, title, className, textClassName }) => { const Icon = (() => { switch (type) { case 'success': @@ -42,7 +43,10 @@ export const CaptionAlert = memo(({ type, message, className, textClassNa
-

{message}

+
+ {title &&

{title}

} +

{message}

+
); }); diff --git a/src/app/atoms/action-modal/action-modal.tsx b/src/app/atoms/action-modal/action-modal.tsx index ea0f430e90..eecb0a4f64 100644 --- a/src/app/atoms/action-modal/action-modal.tsx +++ b/src/app/atoms/action-modal/action-modal.tsx @@ -20,17 +20,18 @@ export interface ActionModalProps { children?: ReactNode | ReactNode[]; title?: ReactNode; headerClassName?: string; + contentClassName?: string; className?: string; } export const ActionModal = memo( - ({ onClose, children, hasCloseButton = true, headerClassName, title }) => { + ({ onClose, children, hasCloseButton = true, title, headerClassName, contentClassName, className }) => { const { fullPage } = useAppEnv(); return ( ( )} onRequestClose={onClose} > -
+

{title}

{hasCloseButton && (