From 1da4aea86b33e8a838a8b3f2f9aac4609f9d23b6 Mon Sep 17 00:00:00 2001 From: tjs Date: Tue, 1 Nov 2022 15:50:55 +0000 Subject: [PATCH] show perp position count in tabs --- components/trade/TradeInfoTabs.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/components/trade/TradeInfoTabs.tsx b/components/trade/TradeInfoTabs.tsx index ed0c27b8..beac6823 100644 --- a/components/trade/TradeInfoTabs.tsx +++ b/components/trade/TradeInfoTabs.tsx @@ -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 (