Skip to content

Commit

Permalink
update staking labels and format valuers
Browse files Browse the repository at this point in the history
  • Loading branch information
tomjeatt committed Dec 4, 2023
1 parent 49e3d6a commit f6a1013
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/assets/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -541,8 +541,8 @@
},
"staking_page": {
"stake_ticker": "Stake {{ticker}}",
"total_staked_ticker_in_the_network": "Total Staked {{ticker}} in the network",
"total_ticker_in_the_network": "Total {{ticker}} in the network",
"total_staked_ticker_in_the_network": "Total Staked {{ticker}}",
"total_ticker_in_the_network": "{{ticker}} - Total vote-escrow",
"time": {
"one_week": "1 Week",
"one_month": "1 Month",
Expand Down
11 changes: 11 additions & 0 deletions src/common/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,16 @@ const formatPercentage = (
return `${format(percentage)}%`;
};

const formatLargeNumber = (amount: number) => {

Check warning on line 138 in src/common/utils/utils.ts

View workflow job for this annotation

GitHub Actions / lint

Missing return type on function
const { format } = new Intl.NumberFormat(undefined, {
notation: 'compact',
maximumFractionDigits: 2,
minimumFractionDigits: 2
});

return format(amount);
};

function displayMonetaryAmount(amount: MonetaryAmount<CurrencyExt> | undefined, defaultValue = '0.00'): string {
if (amount === undefined) return defaultValue;

Expand Down Expand Up @@ -194,6 +204,7 @@ export {
displayMonetaryAmountInUSDFormat,
formatDateTime,
formatDateTimePrecise,
formatLargeNumber,
formatNumber,
formatPercentage,
formatUSD,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useTranslation } from 'react-i18next';

import { formatLargeNumber } from '@/common/utils/utils';
import {
TransactionDetails,
TransactionDetailsDd,
Expand Down Expand Up @@ -28,15 +29,15 @@ const StakingNetworkDetails = ({ data, ...props }: StakingNetworkDetailsProps):
{t('staking_page.total_staked_ticker_in_the_network', { ticker: GOVERNANCE_TOKEN.ticker })}
</TransactionDetailsDt>
<TransactionDetailsDd>
{data.totalStakedBalance.toHuman()} {GOVERNANCE_TOKEN.ticker}
{formatLargeNumber(data.totalStakedBalance.toBig().toNumber())} {GOVERNANCE_TOKEN.ticker}
</TransactionDetailsDd>
</TransactionDetailsGroup>
<TransactionDetailsGroup>
<TransactionDetailsDt>
{t('staking_page.total_ticker_in_the_network', { ticker: GOVERNANCE_TOKEN.ticker })}
{t('staking_page.total_ticker_in_the_network', { ticker: VOTE_GOVERNANCE_TOKEN.ticker })}
</TransactionDetailsDt>
<TransactionDetailsDd>
{data.totalVotingSupply.toHuman()} {VOTE_GOVERNANCE_TOKEN.ticker}
{formatLargeNumber(data.totalVotingSupply.toBig().toNumber())} {VOTE_GOVERNANCE_TOKEN.ticker}
</TransactionDetailsDd>
</TransactionDetailsGroup>
</TransactionDetails>
Expand Down

0 comments on commit f6a1013

Please sign in to comment.