Skip to content

Commit

Permalink
[issue-1110] Update message on the Create on account
Browse files Browse the repository at this point in the history
  • Loading branch information
dominhquang committed Nov 1, 2023
1 parent 01706be commit 0b428a0
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 10 deletions.
32 changes: 26 additions & 6 deletions src/components/WalletConnect/Account/WCAccountSelect.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -21,6 +21,7 @@ interface Props {
useModal: boolean;
onApply: () => void;
onCancel: () => void;
namespace: string;
}

const renderButtonIcon = (color: string) => <Icon phosphorIcon={CheckCircle} weight={'fill'} iconColor={color} />;
Expand All @@ -33,6 +34,7 @@ export const WCAccountSelect = ({
onSelectAccount,
selectedAccounts,
useModal,
namespace,
}: Props) => {
const modalRef = useRef<ModalRef>();

Expand Down Expand Up @@ -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 (
<View style={{ width: '100%' }}>
{!availableAccounts.length ? (
<AlertBox
title={i18n.common.noAvailableAccount}
description={i18n.formatString(i18n.common.youDonotHaveAnyAcc, '')}
type={'warning'}
/>
<AlertBox title={noAccountTitle} description={noAccountDescription} type={'warning'} />
) : useModal ? (
<BasicSelectModal
isUseModalV2={false}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,10 @@ const AuthorizeConfirmation: React.FC<Props> = (props: Props) => {
<Text style={styles.text}>{i18n.common.chooseAccount}</Text>
) : (
<>
<Text style={styles.noAccountTextStyle}>{i18n.common.noAvailableAccount}</Text>
<Text style={styles.textCenter}>
{i18n.formatString(i18n.common.youDonotHaveAnyAcc, accountTypeMessage || '')}
<Text style={styles.noAccountTextStyle}>
{i18n.formatString(i18n.common.noAvailableAccount, accountTypeMessage || '')}
</Text>
<Text style={styles.textCenter}>{i18n.common.youDonotHaveAnyAcc(accountTypeMessage || '')}</Text>
</>
)}
<View style={styles.contentContainer}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -203,6 +204,7 @@ export const ConnectWalletConnectConfirmation = ({ request, navigation }: Props)
onApply={onApplyModal(namespace)}
onCancel={onCancelModal(namespace)}
onSelectAccount={_onSelectAccount(namespace)}
namespace={namespace}
/>
</View>
);
Expand Down
Empty file added src/utils/i18n/en_US.ts
Empty file.

0 comments on commit 0b428a0

Please sign in to comment.