From 0b428a0a87ceec7fb475870fb9892bf96fbfe1c4 Mon Sep 17 00:00:00 2001 From: dominhquang Date: Tue, 31 Oct 2023 16:25:56 +0700 Subject: [PATCH] [issue-1110] Update message on the Create on account --- .../WalletConnect/Account/WCAccountSelect.tsx | 32 +++++++++++++++---- .../variants/AuthorizeConfirmation/index.tsx | 6 ++-- .../index.tsx | 4 ++- src/utils/i18n/en_US.ts | 0 4 files changed, 32 insertions(+), 10 deletions(-) create mode 100644 src/utils/i18n/en_US.ts diff --git a/src/components/WalletConnect/Account/WCAccountSelect.tsx b/src/components/WalletConnect/Account/WCAccountSelect.tsx index fdaae3fc0..1db84453f 100644 --- a/src/components/WalletConnect/Account/WCAccountSelect.tsx +++ b/src/components/WalletConnect/Account/WCAccountSelect.tsx @@ -1,4 +1,4 @@ -import React, { useCallback, useRef } from 'react'; +import React, { useCallback, useMemo, useRef } from 'react'; import { View } from 'react-native'; import { AccountJson } from '@subwallet/extension-base/background/types'; import { VoidFunction } from 'types/index'; @@ -21,6 +21,7 @@ interface Props { useModal: boolean; onApply: () => void; onCancel: () => void; + namespace: string; } const renderButtonIcon = (color: string) => ; @@ -33,6 +34,7 @@ export const WCAccountSelect = ({ onSelectAccount, selectedAccounts, useModal, + namespace, }: Props) => { const modalRef = useRef(); @@ -68,14 +70,32 @@ export const WCAccountSelect = ({ [onSelectAccount, selectedAccounts], ); + const noAccountTitle = useMemo(() => { + switch (namespace) { + case 'polkadot': + return i18n.formatString(i18n.common.noAvailableAccount, 'Substrate') as string; + case 'eip155': + return i18n.formatString(i18n.common.noAvailableAccount, 'EVM') as string; + default: + return i18n.formatString(i18n.common.noAvailableAccount, '') as string; + } + }, [namespace]); + + const noAccountDescription = useMemo(() => { + switch (namespace) { + case 'polkadot': + return i18n.common.youDonotHaveAnyAcc('Substrate') as string; + case 'eip155': + return i18n.common.youDonotHaveAnyAcc('EVM') as string; + default: + return i18n.formatString(i18n.common.noAvailableAccount, '') as string; + } + }, [namespace]); + return ( {!availableAccounts.length ? ( - + ) : useModal ? ( = (props: Props) => { {i18n.common.chooseAccount} ) : ( <> - {i18n.common.noAvailableAccount} - - {i18n.formatString(i18n.common.youDonotHaveAnyAcc, accountTypeMessage || '')} + + {i18n.formatString(i18n.common.noAvailableAccount, accountTypeMessage || '')} + {i18n.common.youDonotHaveAnyAcc(accountTypeMessage || '')} )} diff --git a/src/screens/Confirmations/variants/ConnectWalletConnectConfirmation/index.tsx b/src/screens/Confirmations/variants/ConnectWalletConnectConfirmation/index.tsx index 0909d65d7..ccdb48f93 100644 --- a/src/screens/Confirmations/variants/ConnectWalletConnectConfirmation/index.tsx +++ b/src/screens/Confirmations/variants/ConnectWalletConnectConfirmation/index.tsx @@ -49,7 +49,8 @@ const handleCancel = async ({ id }: WalletConnectSessionRequest) => { }; export const ConnectWalletConnectConfirmation = ({ request, navigation }: Props) => { - const { params } = request.request; + const { params, verifyContext } = request.request; + console.log('123123', verifyContext, params); const toast = useToast(); const { hasMasterPassword } = useSelector((state: RootState) => state.accountState); const { isDeepLinkConnect } = useSelector((state: RootState) => state.settings); @@ -203,6 +204,7 @@ export const ConnectWalletConnectConfirmation = ({ request, navigation }: Props) onApply={onApplyModal(namespace)} onCancel={onCancelModal(namespace)} onSelectAccount={_onSelectAccount(namespace)} + namespace={namespace} /> ); diff --git a/src/utils/i18n/en_US.ts b/src/utils/i18n/en_US.ts new file mode 100644 index 000000000..e69de29bb