Skip to content

Commit 1e33b98

Browse files
committed
frontend: improve bottom navigation for 'accounts'
1. directly go to that account when theres only 1 active account 2. change wording from 'accounts' to 'account'
1 parent 4acac47 commit 1e33b98

File tree

5 files changed

+21
-8
lines changed

5 files changed

+21
-8
lines changed

frontends/web/src/app.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,9 @@ export const App = () => {
210210
/>
211211
<RouterWatcher />
212212
</div>
213-
{showBottomNavigation && <BottomNavigation />}
213+
{showBottomNavigation && (
214+
<BottomNavigation activeAccounts={activeAccounts} />
215+
)}
214216
<Alert />
215217
<Confirm />
216218
</div>

frontends/web/src/components/bottom-navigation/bottom-navigation.tsx

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,18 @@
1717
import { useTranslation } from 'react-i18next';
1818
import { Link, useLocation } from 'react-router-dom';
1919
import { AccountIconSVG, ExchangeIconSVG, MoreIconSVG, PortfolioIconSVG } from '@/components/bottom-navigation/menu-icons';
20+
import type { Account } from '@/api/aopp';
2021
import styles from './bottom-navigation.module.css';
2122

22-
export const BottomNavigation = () => {
23+
type Props = {
24+
activeAccounts: Account[];
25+
}
26+
27+
export const BottomNavigation = ({ activeAccounts }: Props) => {
2328
const { t } = useTranslation();
2429
const { pathname } = useLocation();
30+
const onlyHasOneAccount = activeAccounts.length === 1;
31+
const accountCode = activeAccounts[0]?.code || '';
2532

2633
return (
2734
<div className={styles.container}>
@@ -34,10 +41,14 @@ export const BottomNavigation = () => {
3441
</Link>
3542
<Link
3643
className={`${styles.link} ${pathname.startsWith('/account/') || pathname.startsWith('/accounts/') ? styles.active : ''}`}
37-
to="/accounts/all"
44+
to={
45+
onlyHasOneAccount && accountCode ?
46+
`/account/${accountCode}` :
47+
'/accounts/all'
48+
}
3849
>
3950
<AccountIconSVG />
40-
{t('settings.accounts')}
51+
{onlyHasOneAccount ? t('account.account') : t('account.accounts')}
4152
</Link>
4253
<Link
4354
className={`${styles.link} ${pathname.startsWith('/exchange/') ? styles.active : ''}`}

frontends/web/src/components/wallet-connect/incoming-signing-request-dialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export const WCIncomingSignRequestDialog = ({
8989
<>
9090
<ul className={styles.listContainer}>
9191
<li className={styles.item}>
92-
<p className={styles.label}>{t('walletConnect.signingRequest.account')}</p>
92+
<p className={styles.label}>{t('account.account')}</p>
9393
<span className={styles.accountNameAndAddress}>
9494
<p className={styles.accountName}><b>{accountName}</b></p>
9595
<p className={styles.address}>{truncateAddress(accountAddress)}</p>

frontends/web/src/locales/en/app.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
22
"account": {
3+
"account": "Account",
4+
"accounts": "Accounts",
35
"disconnect": "Connection lost. Retrying…",
46
"export": "Export",
57
"exportTransactions": "Export transactions to downloads folder as CSV file",
@@ -1634,7 +1636,6 @@
16341636
},
16351637
"settings": {
16361638
"about": "About",
1637-
"accounts": "Accounts",
16381639
"advancedSettings": "Advanced settings",
16391640
"appearance": "Appearance",
16401641
"electrum": {
@@ -1869,7 +1870,6 @@
18691870
},
18701871
"pairingSuccess": "Dapp successfully connected. You can continue on the dapp website.",
18711872
"signingRequest": {
1872-
"account": "Account",
18731873
"chain": "Chain",
18741874
"dapp": "Dapp",
18751875
"data": "Data",

frontends/web/src/routes/accounts/all-accounts.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export const AllAccounts = ({ accounts = [] }: AllAccountsProps) => {
9797
return (
9898

9999
<Main>
100-
<Header title={<h2>{t('settings.accounts')}</h2>}>
100+
<Header title={<h2>{t('account.accounts')}</h2>}>
101101
<HideAmountsButton />
102102
</Header>
103103
<View width="700px" fullscreen={false}>

0 commit comments

Comments
 (0)