From b8e39369ce237e0cbc1f17396a0b7c6945d03186 Mon Sep 17 00:00:00 2001 From: yurixander <101931215+yurixander@users.noreply.github.com> Date: Mon, 26 Aug 2024 05:37:52 -0400 Subject: [PATCH] fix(tangle-dapp): Fix total error chip not showing --- .../LiquidStaking/stakeAndUnstake/TotalDetailItem.tsx | 7 +++++-- apps/tangle-dapp/hooks/useInputAmount.ts | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/tangle-dapp/components/LiquidStaking/stakeAndUnstake/TotalDetailItem.tsx b/apps/tangle-dapp/components/LiquidStaking/stakeAndUnstake/TotalDetailItem.tsx index 9e6763fdf..9f41473f3 100644 --- a/apps/tangle-dapp/components/LiquidStaking/stakeAndUnstake/TotalDetailItem.tsx +++ b/apps/tangle-dapp/components/LiquidStaking/stakeAndUnstake/TotalDetailItem.tsx @@ -2,6 +2,7 @@ import { BN } from '@polkadot/util'; import { FC, useMemo } from 'react'; import { EMPTY_VALUE_PLACEHOLDER } from '../../../constants'; +import { LST_PREFIX } from '../../../constants/liquidStaking/constants'; import { LsProtocolId } from '../../../constants/liquidStaking/types'; import useLsExchangeRate, { ExchangeRateType, @@ -65,9 +66,11 @@ const TotalDetailItem: FC = ({ return formatBn(totalAmount, protocol.decimals); }, [inputAmount, totalAmount, protocol.decimals]); + const token = isMinting ? `${LST_PREFIX}${protocol.token}` : protocol.token; + const value = - formattedTotalAmount instanceof BN - ? `${formattedTotalAmount} ${protocol.token}` + typeof formattedTotalAmount === 'string' + ? `${formattedTotalAmount} ${token}` : formattedTotalAmount; return ( diff --git a/apps/tangle-dapp/hooks/useInputAmount.ts b/apps/tangle-dapp/hooks/useInputAmount.ts index 00c015b29..12b98fff1 100644 --- a/apps/tangle-dapp/hooks/useInputAmount.ts +++ b/apps/tangle-dapp/hooks/useInputAmount.ts @@ -94,6 +94,7 @@ const useInputAmount = ({ return; } + // TODO: Format the new amount string to include commas. Use `INPUT_AMOUNT_FORMAT`. setDisplayAmount(cleanAmountString); const amountOrError = safeParseInputAmount({