show 2 decimal places for fees

This commit is contained in:
mantikoros 2022-06-17 16:28:12 -05:00
parent e567782a7d
commit 7679849c7d
2 changed files with 8 additions and 1 deletions

View File

@ -12,6 +12,10 @@ export function formatMoney(amount: number) {
return ENV_CONFIG.moneyMoniker + formatter.format(newAmount).replace('$', '') return ENV_CONFIG.moneyMoniker + formatter.format(newAmount).replace('$', '')
} }
export function formatMoneyWithDecimals(amount: number) {
return ENV_CONFIG.moneyMoniker + amount.toFixed(2)
}
export function formatWithCommas(amount: number) { export function formatWithCommas(amount: number) {
return formatter.format(Math.floor(amount)).replace('$', '') return formatter.format(Math.floor(amount)).replace('$', '')
} }

View File

@ -10,6 +10,7 @@ import { Spacer } from './layout/spacer'
import { YesNoSelector } from './yes-no-selector' import { YesNoSelector } from './yes-no-selector'
import { import {
formatMoney, formatMoney,
formatMoneyWithDecimals,
formatPercent, formatPercent,
formatWithCommas, formatWithCommas,
} from 'common/util/format' } from 'common/util/format'
@ -347,7 +348,9 @@ function BuyPanel(props: {
</div> </div>
{cpmmFees !== false && ( {cpmmFees !== false && (
<InfoTooltip text={`Includes ${formatMoney(cpmmFees)} in fees`} /> <InfoTooltip
text={`Includes ${formatMoneyWithDecimals(cpmmFees)} in fees`}
/>
)} )}
{dpmTooltip && <InfoTooltip text={dpmTooltip} />} {dpmTooltip && <InfoTooltip text={dpmTooltip} />}