Skip to content

Commit

Permalink
feat: show free, staked & total amount on account info section
Browse files Browse the repository at this point in the history
  • Loading branch information
TopETH committed Nov 27, 2023
1 parent 2d30b3f commit 3cf5c9a
Showing 1 changed file with 38 additions and 13 deletions.
51 changes: 38 additions & 13 deletions src/components/account/AccountInfoTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ export const AccountInfoTable = (props: AccountInfoTableProps) => {
} = props;

const total = rawAmountToDecimal(balance.data?.total.toString());
const free = rawAmountToDecimal(balance.data?.free.toString());
const staked = rawAmountToDecimal(balance.data?.staked.toString());
const [rank, setRank] = useState<number>();

useEffect(() => {
Expand Down Expand Up @@ -145,19 +147,42 @@ export const AccountInfoTable = (props: AccountInfoTableProps) => {
<AccountInfoTableAttribute
label='Total balance'
render={() => (
<div css={balanceContainer}>
<span css={taoBalance}>
{`${formatCurrency(
new Decimal(total.toFixed(2).toString()),
"USD",
{ decimalPlaces: 2 }
)} πžƒ`}
</span>
<span>
{`(${formatCurrency(total.mul(price ?? 0), "USD", {
decimalPlaces: 2,
})} USD)`}
</span>
<div>
<div css={balanceContainer}>
<span css={taoBalance}>
Free:
{`${formatCurrency(
new Decimal(free.toFixed(2).toString()),
"USD",
{ decimalPlaces: 2 }
)} πžƒ`}
</span>
</div>
<div css={balanceContainer}>
<span css={taoBalance}>
Staked:
{`${formatCurrency(
new Decimal(staked.toFixed(2).toString()),
"USD",
{ decimalPlaces: 2 }
)} πžƒ`}
</span>
</div>
<div css={balanceContainer}>
<span css={taoBalance}>
Total:
{`${formatCurrency(
new Decimal(total.toFixed(2).toString()),
"USD",
{ decimalPlaces: 2 }
)} πžƒ`}
</span>
{/* <span>
{`(${formatCurrency(total.mul(price ?? 0), "USD", {
decimalPlaces: 2,
})} USD)`}
</span> */}
</div>
</div>
)}
copyToClipboard={() => total.toFixed(2).toString()}
Expand Down

0 comments on commit 3cf5c9a

Please sign in to comment.