fix: hide Perp Positions on Osmosis
This commit is contained in:
parent
8a61d5413e
commit
11dac403a0
@ -38,6 +38,7 @@ export default function AccountSummary(props: Props) {
|
|||||||
const { data: prices } = usePrices()
|
const { data: prices } = usePrices()
|
||||||
const assets = useAllAssets()
|
const assets = useAllAssets()
|
||||||
const updatedAccount = useStore((s) => s.updatedAccount)
|
const updatedAccount = useStore((s) => s.updatedAccount)
|
||||||
|
const chainConfig = useStore((s) => s.chainConfig)
|
||||||
const accountBalance = useMemo(
|
const accountBalance = useMemo(
|
||||||
() =>
|
() =>
|
||||||
props.account
|
props.account
|
||||||
@ -76,6 +77,45 @@ export default function AccountSummary(props: Props) {
|
|||||||
[accountSummaryTabs, setAccountSummaryTabs],
|
[accountSummaryTabs, setAccountSummaryTabs],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const items = [
|
||||||
|
{
|
||||||
|
title: `Credit Account ${props.account.id} Composition`,
|
||||||
|
renderContent: () =>
|
||||||
|
props.account ? <AccountComposition account={props.account} isHls={props.isHls} /> : null,
|
||||||
|
isOpen: accountSummaryTabs[0],
|
||||||
|
toggleOpen: (index: number) => handleToggle(index),
|
||||||
|
renderSubTitle: () => <></>,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Balances',
|
||||||
|
renderContent: () =>
|
||||||
|
props.account ? (
|
||||||
|
<AccountBalancesTable
|
||||||
|
account={props.account}
|
||||||
|
borrowingData={borrowAssetsData}
|
||||||
|
lendingData={lendingAssetsData}
|
||||||
|
hideCard
|
||||||
|
isHls={props.isHls}
|
||||||
|
/>
|
||||||
|
) : null,
|
||||||
|
isOpen: accountSummaryTabs[1],
|
||||||
|
toggleOpen: (index: number) => handleToggle(index),
|
||||||
|
renderSubTitle: () => <></>,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
if (chainConfig.perps)
|
||||||
|
items.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 (!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'>
|
||||||
@ -123,47 +163,7 @@ export default function AccountSummary(props: Props) {
|
|||||||
/>
|
/>
|
||||||
</Item>
|
</Item>
|
||||||
</Card>
|
</Card>
|
||||||
<Accordion
|
<Accordion items={items} allowMultipleOpen />
|
||||||
items={[
|
|
||||||
{
|
|
||||||
title: `Credit Account ${props.account.id} Composition`,
|
|
||||||
renderContent: () =>
|
|
||||||
props.account ? (
|
|
||||||
<AccountComposition account={props.account} isHls={props.isHls} />
|
|
||||||
) : null,
|
|
||||||
isOpen: accountSummaryTabs[0],
|
|
||||||
toggleOpen: (index: number) => handleToggle(index),
|
|
||||||
renderSubTitle: () => <></>,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'Balances',
|
|
||||||
renderContent: () =>
|
|
||||||
props.account ? (
|
|
||||||
<AccountBalancesTable
|
|
||||||
account={props.account}
|
|
||||||
borrowingData={borrowAssetsData}
|
|
||||||
lendingData={lendingAssetsData}
|
|
||||||
hideCard
|
|
||||||
isHls={props.isHls}
|
|
||||||
/>
|
|
||||||
) : null,
|
|
||||||
isOpen: accountSummaryTabs[1],
|
|
||||||
toggleOpen: (index: number) => handleToggle(index),
|
|
||||||
renderSubTitle: () => <></>,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
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: () => <></>,
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
allowMultipleOpen
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user