fix(trading): required vol shown if current is zero (#5449)

This commit is contained in:
m.ray 2023-12-05 21:36:25 +02:00 committed by GitHub
parent 51ab02a2e2
commit eb81f4ae44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -312,16 +312,23 @@ export const CurrentVolume = ({
}) => {
const nextTier = tiers[tierIndex + 1];
const requiredForNextTier = nextTier
? Number(nextTier.minimumRunningNotionalTakerVolume) - windowLengthVolume
: 0;
? new BigNumber(nextTier.minimumRunningNotionalTakerVolume).minus(
windowLengthVolume
)
: new BigNumber(0);
const currentVolume = new BigNumber(windowLengthVolume);
return (
<div>
<Stat
value={formatNumberRounded(new BigNumber(windowLengthVolume))}
value={
currentVolume.isZero()
? `<${formatNumberRounded(requiredForNextTier)}`
: formatNumberRounded(currentVolume)
}
text={t('Past %s epochs', windowLength.toString())}
/>
{requiredForNextTier > 0 && (
{requiredForNextTier.isGreaterThan(0) && (
<Stat
value={formatNumber(requiredForNextTier)}
text={t('Required for next tier')}