From 6d6935e6b2aea5027afc37920e23d29ed7f3b99f Mon Sep 17 00:00:00 2001 From: Gergely Lovas Date: Wed, 18 Sep 2024 10:48:44 +0200 Subject: [PATCH 1/3] fix: app name on ledger modal --- src/pages/Ledger/LedgerDisconnected.tsx | 12 ++++++++++-- .../hooks/useLedgerDisconnectedDialog.tsx | 4 ++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/pages/Ledger/LedgerDisconnected.tsx b/src/pages/Ledger/LedgerDisconnected.tsx index 221eb919..e899e307 100644 --- a/src/pages/Ledger/LedgerDisconnected.tsx +++ b/src/pages/Ledger/LedgerDisconnected.tsx @@ -8,8 +8,13 @@ import { import { Trans, useTranslation } from 'react-i18next'; import { useCallback } from 'react'; import { tabs } from 'webextension-polyfill'; +import { LedgerAppType } from '@src/contexts/LedgerProvider'; -export const LedgerDisconnected = () => { +export const LedgerDisconnected = ({ + requiredAppType, +}: { + requiredAppType: LedgerAppType; +}) => { const { t } = useTranslation(); const openTroubleshootingPopup = useCallback(() => { // Open in a full screen tab to avoid popup hell @@ -29,10 +34,13 @@ export const LedgerDisconnected = () => { }} > , }} + values={{ + appType: requiredAppType ?? LedgerAppType.AVALANCHE, + }} /> diff --git a/src/pages/SignTransaction/hooks/useLedgerDisconnectedDialog.tsx b/src/pages/SignTransaction/hooks/useLedgerDisconnectedDialog.tsx index 5cdc085c..0eb72ed3 100644 --- a/src/pages/SignTransaction/hooks/useLedgerDisconnectedDialog.tsx +++ b/src/pages/SignTransaction/hooks/useLedgerDisconnectedDialog.tsx @@ -48,14 +48,14 @@ export function useLedgerDisconnectedDialog( const showLedgerDisconnectedDialog = useCallback(() => { showDialog({ title: t('Ledger Disconnected'), - content: , + content: , open: true, onClose: () => { onCancel(); clearDialog(); }, }); - }, [clearDialog, onCancel, showDialog, t]); + }, [clearDialog, onCancel, requiredAppType, showDialog, t]); const showIncorrectAppDialog = useCallback(() => { showDialog({ From 030b304413bf3d5bf12303cc318accd04e805ea8 Mon Sep 17 00:00:00 2001 From: Gergely Lovas Date: Wed, 18 Sep 2024 10:50:31 +0200 Subject: [PATCH 2/3] chore: update i18n files --- src/localization/locales/en/translation.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/localization/locales/en/translation.json b/src/localization/locales/en/translation.json index d9b4e1e3..3d3f8f5e 100644 --- a/src/localization/locales/en/translation.json +++ b/src/localization/locales/en/translation.json @@ -183,7 +183,7 @@ "Connect Software Wallet": "Connect Software Wallet", "Connect the Ledger device to your computer.": "Connect the Ledger device to your computer.", "Connect your Ledger": "Connect your Ledger", - "Connect your Ledger device and open the Avalanche App to approve this transaction": "Connect your Ledger device and open the Avalanche App to approve this transaction", + "Connect your Ledger device and open the {{appType}} App to approve this transaction": "Connect your Ledger device and open the {{appType}} App to approve this transaction", "Connect your Wallet": "Connect your Wallet", "Connect your wallet via the
\"Connect Wallet\" button on the site": "Connect your wallet via the
\"Connect Wallet\" button on the site", "Connected": "Connected", From 6308b61e6e361f108de09becf2d2e3770b01d606 Mon Sep 17 00:00:00 2001 From: Gergely Lovas Date: Wed, 18 Sep 2024 10:55:07 +0200 Subject: [PATCH 3/3] test: fix tests --- .../hooks/useLedgerDisconnectedDialog.test.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pages/SignTransaction/hooks/useLedgerDisconnectedDialog.test.tsx b/src/pages/SignTransaction/hooks/useLedgerDisconnectedDialog.test.tsx index 6cea32c8..d142368d 100644 --- a/src/pages/SignTransaction/hooks/useLedgerDisconnectedDialog.test.tsx +++ b/src/pages/SignTransaction/hooks/useLedgerDisconnectedDialog.test.tsx @@ -132,7 +132,9 @@ describe('src/pages/SignTransaction/hooks/useLedgerDisconnectedDialog.tsx', () = expect(translationMock).toBeCalledWith(translation); expect(showDialogMock).toBeCalledWith({ title: translation, - content: , + content: ( + + ), open: true, onClose: expect.any(Function), });