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", "name": "@vegaprotocol/ui-toolkit",
"version": "0.12.3" "version": "0.12.4"
} }

View File

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

View File

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