import { useEffect, useState } from 'react' import useMangoStore from '../stores/useMangoStore' import { useOpenOrders } from '../hooks/useOpenOrders' // import usePerpPositions from '../hooks/usePerpPositions' import OpenOrdersTable from './OpenOrdersTable' import BalancesTable from './BalancesTable' import PositionsTable from './PerpPositionsTable' import TradeHistoryTable from './TradeHistoryTable' // import FeeDiscountsTable from './FeeDiscountsTable' import ManualRefresh from './ManualRefresh' import Tabs from './Tabs' const TABS = [ 'Balances', 'Orders', 'Positions', // 'Fees', 'Trade History', ] const UserInfoTabs = ({ activeTab, setActiveTab }) => { const openOrders = useOpenOrders() // const perpPositions = usePerpPositions() const connected = useMangoStore((s) => s.connection.current) const mangoAccount = useMangoStore((s) => s.selectedMangoAccount.current) const handleTabChange = (tabName) => { setActiveTab(tabName) } return (
0 ? [{ tabName: 'Orders', count: openOrders.length }] : null } tabs={TABS} /> {connected && mangoAccount ? (
) : null}
) } const TabContent = ({ activeTab }) => { switch (activeTab) { case 'Orders': return case 'Balances': return case 'Trade History': return case 'Positions': return // case 'Fees': // return // now displayed in trade form. may add back when MRSRM deposits are supported default: return } } const UserInfo = () => { const marketConfig = useMangoStore((s) => s.selectedMarket.config) const isPerpMarket = marketConfig.kind === 'perp' const connected = useMangoStore((s) => s.wallet.connected) const [activeTab, setActiveTab] = useState('') useEffect(() => { isPerpMarket ? setActiveTab(TABS[2]) : setActiveTab(TABS[0]) }, [isPerpMarket]) return (
) } export default UserInfo