fix(ui-toolkit): healthbar fee decimals (#4152)

This commit is contained in:
Ciaran McGhie 2023-06-21 14:51:17 +01:00 committed by GitHub
parent df88e77cdf
commit 180de8cf25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 5 deletions

View File

@ -1,4 +1,4 @@
{
"name": "@vegaprotocol/ui-toolkit",
"version": "0.12.3"
"version": "0.12.4"
}

View File

@ -1,5 +1,8 @@
import classNames from 'classnames';
import { addDecimalsFormatNumber } from '@vegaprotocol/utils';
import {
addDecimalsFormatNumber,
formatNumberPercentage,
} from '@vegaprotocol/utils';
import { t } from '@vegaprotocol/i18n';
import { BigNumber } from 'bignumber.js';
import { getIntentBackground, Intent } from '../../utils/intent';
@ -74,13 +77,17 @@ const Level = ({
.multipliedBy(100)
.toNumber();
const formattedFee = fee
? formatNumberPercentage(new BigNumber(fee).times(100), 2)
: '-';
const tooltipContent = (
<>
<div className="mt-1.5 inline-flex">
<Indicator variant={intent} />
</div>
<span>
{fee}% {t('Fee')}
{formattedFee}% {t('Fee')}
</span>
<div className="flex flex-col">
<span>
@ -179,7 +186,7 @@ export const HealthBar = ({
opacity={opacity}
fee={fee}
prevLevel={prevLevel}
decimals={0}
decimals={decimals}
intent={intent}
key={'healthbar-segment-' + index}
/>

View File

@ -1,5 +1,5 @@
{
"name": "@vegaprotocol/utils",
"version": "0.0.4",
"version": "0.0.5",
"type": "commonjs"
}