diff --git a/src/components/Accordion.tsx b/src/components/Accordion.tsx index d169cdeb..cdfa04b9 100644 --- a/src/components/Accordion.tsx +++ b/src/components/Accordion.tsx @@ -11,13 +11,18 @@ interface Props { interface Item { title: string content: React.ReactNode + open?: boolean } export default function Accordion(props: Props) { return ( - + {props.items.map((item) => ( -
+
s.prices) + const balance = calculateAccountBalance(props.account, prices) + const balanceChange = props.change ? calculateAccountBalance(props.change, prices) : BN(0) + const debtBalance = calculateAccountDebt(props.account, prices) + const debtBalanceChange = props.change ? calculateAccountDebt(props.change, prices) : BN(0) + const pnL = calculateAccountPnL(props.account, prices) + const pnLChange = props.change ? calculateAccountPnL(props.change, prices) : BN(0) + const apr = calculateAccountApr(props.account, prices) + const aprChange = props.change ? calculateAccountPnL(props.change, prices) : BN(0) + const borrowRate = calculateAccountBorrowRate(props.account, prices) + const borrowRateChange = props.change ? calculateAccountPnL(props.change, prices) : BN(0) + + return ( +
+ + + + + +
+ ) +} + +function Item(props: ItemProps) { + const baseCurrency = useStore((s) => s.baseCurrency) + const increase = props.current.isLessThan(props.change) + return ( +
+
+ + {props.title} + +
+
+ + {!props.current.isEqualTo(props.change) && ( + <> + + + + + + )} +
+
+ ) +} diff --git a/src/components/Account/AccountList.tsx b/src/components/Account/AccountList.tsx index 5a6a54d3..e97d8507 100644 --- a/src/components/Account/AccountList.tsx +++ b/src/components/Account/AccountList.tsx @@ -15,6 +15,7 @@ import useToggle from 'hooks/useToggle' import useStore from 'store' import { calculateAccountBalance } from 'utils/accounts' import { hardcodedFee } from 'utils/contants' +import { BN } from 'utils/helpers' import useParams, { getRoute } from 'utils/route' interface Props { @@ -41,7 +42,7 @@ export default function AccountList(props: Props) { const selectedAccountDetails = props.accounts.find((account) => account.id === selectedAccount) const selectedAccountBalance = selectedAccountDetails ? calculateAccountBalance(selectedAccountDetails, prices) - : 0 + : BN(0) async function deleteAccountHandler() { if (!accountSelected) return @@ -107,7 +108,9 @@ export default function AccountList(props: Props) { text='Fund' color='tertiary' leftIcon={} - onClick={() => props.setShowFundAccount(true)} + onClick={() => { + useStore.setState({ fundAndWithdrawModal: 'fund' }) + }} />