tidy: refactor
This commit is contained in:
parent
11dac403a0
commit
7cfe05ebb7
@ -77,44 +77,55 @@ export default function AccountSummary(props: Props) {
|
|||||||
[accountSummaryTabs, setAccountSummaryTabs],
|
[accountSummaryTabs, setAccountSummaryTabs],
|
||||||
)
|
)
|
||||||
|
|
||||||
const items = [
|
const items = useMemo(() => {
|
||||||
{
|
const itemsArray = [
|
||||||
title: `Credit Account ${props.account.id} Composition`,
|
{
|
||||||
renderContent: () =>
|
title: `Credit Account ${props.account.id} Composition`,
|
||||||
props.account ? <AccountComposition account={props.account} isHls={props.isHls} /> : null,
|
renderContent: () =>
|
||||||
isOpen: accountSummaryTabs[0],
|
props.account ? <AccountComposition account={props.account} isHls={props.isHls} /> : null,
|
||||||
toggleOpen: (index: number) => handleToggle(index),
|
isOpen: accountSummaryTabs[0],
|
||||||
renderSubTitle: () => <></>,
|
toggleOpen: (index: number) => handleToggle(index),
|
||||||
},
|
renderSubTitle: () => <></>,
|
||||||
{
|
},
|
||||||
title: 'Balances',
|
{
|
||||||
renderContent: () =>
|
title: 'Balances',
|
||||||
props.account ? (
|
renderContent: () =>
|
||||||
<AccountBalancesTable
|
props.account ? (
|
||||||
account={props.account}
|
<AccountBalancesTable
|
||||||
borrowingData={borrowAssetsData}
|
account={props.account}
|
||||||
lendingData={lendingAssetsData}
|
borrowingData={borrowAssetsData}
|
||||||
hideCard
|
lendingData={lendingAssetsData}
|
||||||
isHls={props.isHls}
|
hideCard
|
||||||
/>
|
isHls={props.isHls}
|
||||||
) : null,
|
/>
|
||||||
isOpen: accountSummaryTabs[1],
|
) : null,
|
||||||
toggleOpen: (index: number) => handleToggle(index),
|
isOpen: accountSummaryTabs[1],
|
||||||
renderSubTitle: () => <></>,
|
toggleOpen: (index: number) => handleToggle(index),
|
||||||
},
|
renderSubTitle: () => <></>,
|
||||||
]
|
},
|
||||||
|
]
|
||||||
|
if (chainConfig.perps)
|
||||||
|
itemsArray.push({
|
||||||
|
title: 'Perp Positions',
|
||||||
|
renderContent: () =>
|
||||||
|
props.account && props.account.perps.length > 0 ? (
|
||||||
|
<AccountPerpPositionTable account={props.account} hideCard />
|
||||||
|
) : null,
|
||||||
|
isOpen: accountSummaryTabs[2] ?? false,
|
||||||
|
toggleOpen: (index: number) => handleToggle(index),
|
||||||
|
renderSubTitle: () => <></>,
|
||||||
|
})
|
||||||
|
|
||||||
if (chainConfig.perps)
|
return itemsArray
|
||||||
items.push({
|
}, [
|
||||||
title: 'Perp Positions',
|
props.account,
|
||||||
renderContent: () =>
|
borrowAssetsData,
|
||||||
props.account && props.account.perps.length > 0 ? (
|
lendingAssetsData,
|
||||||
<AccountPerpPositionTable account={props.account} hideCard />
|
props.isHls,
|
||||||
) : null,
|
chainConfig.perps,
|
||||||
isOpen: accountSummaryTabs[2] ?? false,
|
handleToggle,
|
||||||
toggleOpen: (index: number) => handleToggle(index),
|
accountSummaryTabs,
|
||||||
renderSubTitle: () => <></>,
|
])
|
||||||
})
|
|
||||||
|
|
||||||
if (!props.account) return null
|
if (!props.account) return null
|
||||||
return (
|
return (
|
||||||
|
Loading…
Reference in New Issue
Block a user