diff --git a/src/components/Account/AccountSummary.tsx b/src/components/Account/AccountSummary.tsx index 97a3e81c..de914b20 100644 --- a/src/components/Account/AccountSummary.tsx +++ b/src/components/Account/AccountSummary.tsx @@ -8,6 +8,7 @@ import HealthBar from 'components/Account/HealthBar' import Card from 'components/Card' import DisplayCurrency from 'components/DisplayCurrency' import { FormattedNumber } from 'components/FormattedNumber' +import { ArrowRight } from 'components/Icons' import Text from 'components/Text' import { BN_ZERO } from 'constants/math' import { ORACLE_DENOM } from 'constants/oracle' @@ -39,6 +40,7 @@ export default function AccountSummary(props: Props) { useBorrowMarketAssetsTableData() const { availableAssets: lendingAvailableAssets, accountLentAssets } = useLendingMarketAssetsTableData() + const borrowAssetsData = useMemo( () => [...borrowAvailableAssets, ...accountBorrowedAssets], [borrowAvailableAssets, accountBorrowedAssets], @@ -50,10 +52,17 @@ export default function AccountSummary(props: Props) { const { health } = useHealthComputer(props.account) const { health: updatedHealth } = useHealthComputer(updatedAccount) const leverage = useMemo( - () => - props.account ? calculateAccountLeverage(updatedAccount ?? props.account, prices) : BN_ZERO, - [props.account, updatedAccount, prices], + () => (props.account ? calculateAccountLeverage(props.account, prices) : BN_ZERO), + [props.account, prices], ) + const updatedLeverage = useMemo(() => { + if (!updatedAccount) return null + const updatedLeverage = calculateAccountLeverage(updatedAccount, prices) + + if (updatedLeverage.eq(leverage)) return null + return updatedLeverage + }, [updatedAccount, prices, leverage]) + if (!props.account) return null return (
@@ -61,18 +70,38 @@ export default function AccountSummary(props: Props) { - + + {updatedLeverage && ( + <> + + + + )} - +