Skip to content

Commit

Permalink
Round delegation amounts in the list
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaw3d committed Aug 6, 2024
1 parent cd1143e commit aca8635
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/app/components/AmountFormatter/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ export const AmountFormatter = memo(
const formatter = isUsingBaseUnits ? formatBaseUnitsAsRose : formatWeiAsWrose
const amountString = formatter(amount, {
minimumFractionDigits: minimumFractionDigits ?? 1,
maximumFractionDigits:
typeof maximumFractionDigits !== 'undefined' ? maximumFractionDigits : isUsingBaseUnits ? 15 : 18,
maximumFractionDigits: maximumFractionDigits ?? (isUsingBaseUnits ? 15 : 18),
})

const tickerProps = smallTicker
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ exports[`<ActiveDelegationList /> should match snapshot 1`] = `
class="c0"
style="display: inline-flex; white-space: nowrap; font-family: "Roboto mono", monospace; letter-spacing: 0;"
>
0.0000001
0.00
</div>
<span
class="c19"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ exports[`<DebondingDelegationList /> should match snapshot 1`] = `
class="c0"
style="display: inline-flex; white-space: nowrap; font-family: "Roboto mono", monospace; letter-spacing: 0;"
>
0.0000001
0.00
</div>
<span
class="c19"
Expand Down
5 changes: 4 additions & 1 deletion src/app/pages/StakingPage/Features/DelegationList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,10 @@ export const DelegationList = memo((props: Props) => {
selector: 'amount',
width: '28ex',
right: true,
cell: datum => datum.amount && <AmountFormatter amount={datum.amount} />,
cell: datum =>
datum.amount && (
<AmountFormatter amount={datum.amount} maximumFractionDigits={2} minimumFractionDigits={2} />
),
sortable: true,
sortFunction: (row1, row2) => Number(BigInt(row1.amount) - BigInt(row2.amount)),
},
Expand Down

0 comments on commit aca8635

Please sign in to comment.