Skip to content

Commit

Permalink
refactor(suite): changed empty account with token texts and CTAs
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasBoda authored and tomasklim committed Mar 3, 2025
1 parent 4816a34 commit c0b06ef
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 7 deletions.
5 changes: 5 additions & 0 deletions packages/suite/src/support/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2821,6 +2821,11 @@ export default defineMessages({
defaultMessage: 'Get started by receiving or buying {network}.',
id: 'TR_ACCOUNT_IS_EMPTY_DESCRIPTION',
},
TR_ACCOUNT_WITH_TOKENS_IS_EMPTY_DESCRIPTION: {
defaultMessage:
'Get started by receiving or buying {networkDisplaySymbol} or any token on the {networkName} network.',
id: 'TR_ACCOUNT_WITH_TOKENS_IS_EMPTY_DESCRIPTION',
},
TR_GENERIC_ERROR_TITLE: {
defaultMessage: 'Oops! Something went wrong!',
description: 'Generic error message title',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { getNetworkDisplaySymbol } from '@suite-common/wallet-config';
import {
getNetwork,
getNetworkDisplaySymbol,
getNetworkFeatures,
} from '@suite-common/wallet-config';
import { EventType, analytics } from '@trezor/suite-analytics';

import { goto } from 'src/actions/suite/routerActions';
Expand All @@ -14,7 +18,10 @@ interface AccountEmptyProps {
export const AccountEmpty = ({ account }: AccountEmptyProps) => {
const dispatch = useDispatch();

const isTokensNetwork = getNetworkFeatures(account.symbol).includes('tokens');

const displaySymbol = getNetworkDisplaySymbol(account.symbol);
const networkName = getNetwork(account.symbol).name;

const handleNavigateToReceivePage = () => {
dispatch(goto('wallet-receive', { preserveParams: true }));
Expand All @@ -40,10 +47,17 @@ export const AccountEmpty = ({ account }: AccountEmptyProps) => {
<AccountExceptionLayout
title={<Translation id="TR_ACCOUNT_IS_EMPTY_TITLE" />}
description={
<Translation
id="TR_ACCOUNT_IS_EMPTY_DESCRIPTION"
values={{ network: displaySymbol }}
/>
isTokensNetwork ? (
<Translation
id="TR_ACCOUNT_WITH_TOKENS_IS_EMPTY_DESCRIPTION"
values={{ networkName, networkDisplaySymbol: displaySymbol }}
/>
) : (
<Translation
id="TR_ACCOUNT_IS_EMPTY_DESCRIPTION"
values={{ network: displaySymbol }}
/>
)
}
iconName="arrowsLeftRight"
iconVariant="tertiary"
Expand All @@ -52,7 +66,9 @@ export const AccountEmpty = ({ account }: AccountEmptyProps) => {
'data-testid': '@accounts/empty-account/receive',
key: '1',
onClick: handleNavigateToReceivePage,
children: (
children: isTokensNetwork ? (
<Translation id="TR_RECEIVE" />
) : (
<Translation
id="TR_RECEIVE_NETWORK"
values={{ networkDisplaySymbol: displaySymbol }}
Expand All @@ -63,7 +79,9 @@ export const AccountEmpty = ({ account }: AccountEmptyProps) => {
'data-testid': '@accounts/empty-account/buy',
key: '2',
onClick: handleNavigateToBuyPage,
children: (
children: isTokensNetwork ? (
<Translation id="TR_BUY" />
) : (
<Translation
id="TR_BUY_NETWORK"
values={{ networkDisplaySymbol: displaySymbol }}
Expand Down

0 comments on commit c0b06ef

Please sign in to comment.