tidy: refactor

This commit is contained in:
Linkie Link 2024-01-24 17:20:51 +01:00
parent 11dac403a0
commit 7cfe05ebb7
No known key found for this signature in database
GPG Key ID: 5318B0F2564D38EA

View File

@ -77,7 +77,8 @@ export default function AccountSummary(props: Props) {
[accountSummaryTabs, setAccountSummaryTabs], [accountSummaryTabs, setAccountSummaryTabs],
) )
const items = [ const items = useMemo(() => {
const itemsArray = [
{ {
title: `Credit Account ${props.account.id} Composition`, title: `Credit Account ${props.account.id} Composition`,
renderContent: () => renderContent: () =>
@ -103,9 +104,8 @@ export default function AccountSummary(props: Props) {
renderSubTitle: () => <></>, renderSubTitle: () => <></>,
}, },
] ]
if (chainConfig.perps) if (chainConfig.perps)
items.push({ itemsArray.push({
title: 'Perp Positions', title: 'Perp Positions',
renderContent: () => renderContent: () =>
props.account && props.account.perps.length > 0 ? ( props.account && props.account.perps.length > 0 ? (
@ -116,6 +116,17 @@ export default function AccountSummary(props: Props) {
renderSubTitle: () => <></>, renderSubTitle: () => <></>,
}) })
return itemsArray
}, [
props.account,
borrowAssetsData,
lendingAssetsData,
props.isHls,
chainConfig.perps,
handleToggle,
accountSummaryTabs,
])
if (!props.account) return null if (!props.account) return null
return ( return (
<div className='h-[546px] max-w-screen overflow-y-scroll scrollbar-hide w-93.5'> <div className='h-[546px] max-w-screen overflow-y-scroll scrollbar-hide w-93.5'>