Skip to content

Commit b736f16

Browse files
lukaw3dlukaw3d
authored andcommitted
Generalize RoundedBalance.tickerAsLink to work with compactAllNumbers
1 parent 5b3e016 commit b736f16

File tree

2 files changed

+19
-14
lines changed

2 files changed

+19
-14
lines changed

src/app/components/RoundedBalance/__tests__/__snapshots__/index.test.tsx.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,7 @@ exports[`RoundedBalance should match snapshot {
943943
ticker: 'wROSE',
944944
tokenAddress: '0x8Bc2B030b299964eEfb5e1e0b36991352E56D2D3',
945945
value: '15000000'
946-
} 1`] = `"15M wROSE "`;
946+
} 1`] = `"15M wROSE http://localhost/mainnet/sapphire/token/0x8Bc2B030b299964eEfb5e1e0b36991352E56D2D3"`;
947947

948948
exports[`RoundedBalance should match snapshot {
949949
compactLargeNumbers: true,
@@ -1033,7 +1033,7 @@ exports[`RoundedBalance should match snapshot {
10331033
ticker: undefined,
10341034
tokenAddress: '0x8Bc2B030b299964eEfb5e1e0b36991352E56D2D3',
10351035
value: '15000000'
1036-
} 1`] = `"15M "`;
1036+
} 1`] = `"15M 0x8Bc2B030b299964eEfb5e1e0b36991352E56D2D3 http://localhost/mainnet/sapphire/token/0x8Bc2B030b299964eEfb5e1e0b36991352E56D2D3"`;
10371037

10381038
exports[`RoundedBalance should match snapshot {
10391039
compactLargeNumbers: true,
@@ -1303,7 +1303,7 @@ exports[`RoundedBalance should match snapshot {
13031303
ticker: 'wROSE',
13041304
tokenAddress: '0x8Bc2B030b299964eEfb5e1e0b36991352E56D2D3',
13051305
value: '15000000'
1306-
} 1`] = `"+15M wROSE "`;
1306+
} 1`] = `"+15M wROSE http://localhost/mainnet/sapphire/token/0x8Bc2B030b299964eEfb5e1e0b36991352E56D2D3"`;
13071307

13081308
exports[`RoundedBalance should match snapshot {
13091309
compactLargeNumbers: true,
@@ -1393,7 +1393,7 @@ exports[`RoundedBalance should match snapshot {
13931393
ticker: undefined,
13941394
tokenAddress: '0x8Bc2B030b299964eEfb5e1e0b36991352E56D2D3',
13951395
value: '15000000'
1396-
} 1`] = `"+15M "`;
1396+
} 1`] = `"+15M 0x8Bc2B030b299964eEfb5e1e0b36991352E56D2D3 http://localhost/mainnet/sapphire/token/0x8Bc2B030b299964eEfb5e1e0b36991352E56D2D3"`;
13971397

13981398
exports[`RoundedBalance should match snapshot {
13991399
compactLargeNumbers: true,

src/app/components/RoundedBalance/index.tsx

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,21 @@ export const RoundedBalance: FC<RoundedBalanceProps> = ({
6060
enterNextDelay={tooltipDelay}
6161
>
6262
<span>
63-
{t('common.valueInToken', {
64-
value: value,
65-
ticker: ticker,
66-
formatParams: {
67-
value: {
68-
notation: 'compact',
69-
signDisplay: showSign ? 'always' : 'auto',
70-
} satisfies Intl.NumberFormatOptions,
71-
},
72-
})}
63+
<Trans
64+
t={t}
65+
i18nKey="common.valueInTokenWithLink"
66+
values={{
67+
value: value,
68+
ticker: ticker,
69+
formatParams: {
70+
value: {
71+
notation: 'compact',
72+
signDisplay: showSign ? 'always' : 'auto',
73+
} satisfies Intl.NumberFormatOptions,
74+
},
75+
}}
76+
components={{ TickerLink: tickerLink }}
77+
/>
7378
</span>
7479
</Tooltip>
7580
)

0 commit comments

Comments
 (0)