show perp position count in tabs

This commit is contained in:
tjs 2022-11-01 15:50:55 +00:00
parent b62ff845a9
commit 1da4aea86b
1 changed files with 3 additions and 2 deletions

View File

@ -11,6 +11,7 @@ const TradeInfoTabs = () => {
const [selectedTab, setSelectedTab] = useState('balances')
const openOrders = mangoStore((s) => s.mangoAccount.openOrders)
const mangoAccount = mangoStore((s) => s.mangoAccount.current)
const perpPositions = mangoStore((s) => s.mangoAccount.perpPositions)
const unsettledSpotBalances = useUnsettledSpotBalances()
const tabsWithCount: [string, number][] = useMemo(() => {
@ -18,9 +19,9 @@ const TradeInfoTabs = () => {
['balances', 0],
['trade:orders', Object.values(openOrders).flat().length],
['trade:unsettled', Object.values(unsettledSpotBalances).flat().length],
['Perp Positions', 0],
['Perp Positions', perpPositions.length],
]
}, [openOrders, mangoAccount])
}, [openOrders, perpPositions, unsettledSpotBalances])
return (
<div className="hide-scroll h-full overflow-y-scroll pb-5">