fix spot price quote token display

This commit is contained in:
saml33 2023-06-15 21:24:54 +10:00
parent 2a9d74de15
commit 78f2544ffe
2 changed files with 38 additions and 7 deletions

View File

@ -108,7 +108,17 @@ const SpotMarketsTable = () => {
<div className="flex flex-col text-right">
<p>
{price ? (
<FormatNumericValue value={price} isUsd />
<>
<FormatNumericValue
value={price}
isUsd={quoteBank?.name === 'USDC'}
/>{' '}
{quoteBank?.name !== 'USDC' ? (
<span className="font-body text-th-fgd-4">
{quoteBank?.name}
</span>
) : null}
</>
) : (
''
)}
@ -300,7 +310,21 @@ const MobileSpotMarketItem = ({
<div className="col-span-1">
<p className="text-xs text-th-fgd-3">{t('price')}</p>
<p className="font-mono text-th-fgd-2">
{price ? <FormatNumericValue value={price} isUsd /> : '-'}
{price ? (
<>
<FormatNumericValue
value={price}
isUsd={quoteBank?.name === 'USDC'}
/>{' '}
{quoteBank?.name !== 'USDC' ? (
<span className="font-body text-th-fgd-4">
{quoteBank?.name}
</span>
) : null}
</>
) : (
'-'
)}
</p>
</div>
<div className="col-span-1">

View File

@ -8,7 +8,7 @@ import { PerpMarket, Bank } from '@blockworks-foundation/mango-v4'
import { BorshAccountsCoder } from '@coral-xyz/anchor'
import {
floorToDecimal,
formatCurrencyValue,
formatNumericValue,
getDecimalCount,
} from 'utils/numbers'
import dayjs from 'dayjs'
@ -127,6 +127,8 @@ const OraclePrice = ({
stalePrice,
])
const oracleDecimals = getDecimalCount(serumOrPerpMarket?.tickSize || 0.01)
return (
<>
<div id="trade-step-two" className="flex-col whitespace-nowrap md:ml-6">
@ -180,10 +182,15 @@ const OraclePrice = ({
</Tooltip>
<div className="font-mono text-xs text-th-fgd-2">
{price ? (
`${formatCurrencyValue(
price,
getDecimalCount(serumOrPerpMarket?.tickSize || 0.01)
)}`
<>
{quoteBank?.name === 'USDC' ? '$' : ''}
{formatNumericValue(price, oracleDecimals)}{' '}
{quoteBank?.name !== 'USDC' ? (
<span className="font-body text-th-fgd-3">
{quoteBank?.name}
</span>
) : null}
</>
) : (
<span className="text-th-fgd-4"></span>
)}