Skip to content

Commit

Permalink
fix ellipsis bug for usd token input value
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Wolski committed Oct 27, 2023
1 parent 01ef4b6 commit 2e6f55d
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/components/Form/TokenInputWithWalletBalance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,20 @@ function TokenInputWithWalletBalance(props: propsIF) {
Promise.resolve(cachedFetchTokenPrice(pricedToken, chainId)).then(
(price) => {
if (price?.usdPrice !== undefined) {
const usdValueNum: number =
(price &&
price?.usdPrice * (parseFloat(tokenInput) ?? 0)) ??
0;
const usdValueTruncated = getFormattedNumber({
value: usdValueNum,
isUSD: true,
});
setUsdValueForDom(usdValueTruncated);
const usdValueNum: number | undefined =
price !== undefined && tokenInput !== ''
? price.usdPrice * parseFloat(tokenInput)
: undefined;
const usdValueTruncated =
usdValueNum !== undefined
? getFormattedNumber({
value: usdValueNum,
isUSD: true,
})
: undefined;
usdValueTruncated !== undefined
? setUsdValueForDom(usdValueTruncated)
: setUsdValueForDom('');
} else {
setUsdValueForDom(undefined);
}
Expand Down

0 comments on commit 2e6f55d

Please sign in to comment.