Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: app name on ledger modal CP-9246 #49

Merged
merged 3 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/localization/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 <bold>Avalanche App</bold> to approve this transaction": "Connect your Ledger device and open the <bold>Avalanche App</bold> to approve this transaction",
"Connect your Ledger device and open the <bold>{{appType}} App</bold> to approve this transaction": "Connect your Ledger device and open the <bold>{{appType}} App</bold> to approve this transaction",
"Connect your Wallet": "Connect your Wallet",
"Connect your wallet via the <br /> \"Connect Wallet\" button on the site": "Connect your wallet via the <br /> \"Connect Wallet\" button on the site",
"Connected": "Connected",
Expand Down
12 changes: 10 additions & 2 deletions src/pages/Ledger/LedgerDisconnected.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -29,10 +34,13 @@ export const LedgerDisconnected = () => {
}}
>
<Trans
i18nKey="Connect your Ledger device and open the <bold>Avalanche App</bold> to approve this transaction"
i18nKey="Connect your Ledger device and open the <bold>{{appType}} App</bold> to approve this transaction"
components={{
bold: <Box component="span" sx={{ fontWeight: 600 }} />,
}}
values={{
appType: requiredAppType ?? LedgerAppType.AVALANCHE,
}}
/>
</Typography>
<Stack sx={{ mt: '48px', mb: '16px', alignItems: 'center' }}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ describe('src/pages/SignTransaction/hooks/useLedgerDisconnectedDialog.tsx', () =
expect(translationMock).toBeCalledWith(translation);
expect(showDialogMock).toBeCalledWith({
title: translation,
content: <LedgerDisconnected />,
content: (
<LedgerDisconnected requiredAppType={LedgerAppType.AVALANCHE} />
),
open: true,
onClose: expect.any(Function),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ export function useLedgerDisconnectedDialog(
const showLedgerDisconnectedDialog = useCallback(() => {
showDialog({
title: t('Ledger Disconnected'),
content: <LedgerDisconnected />,
content: <LedgerDisconnected requiredAppType={requiredAppType} />,
open: true,
onClose: () => {
onCancel();
clearDialog();
},
});
}, [clearDialog, onCancel, showDialog, t]);
}, [clearDialog, onCancel, requiredAppType, showDialog, t]);

const showIncorrectAppDialog = useCallback(() => {
showDialog({
Expand Down
Loading