import { useEffect } from 'react' import { useRouter } from 'next/router' import useMangoGroupConfig from '../../hooks/useMangoGroupConfig' import useMangoStore from '../../stores/useMangoStore' import { getMarketByBaseSymbolAndKind } from '@blockworks-foundation/mango-client' import TopBar from '../../components/TopBar' import TradePageGrid from '../../components/TradePageGrid' import MarketSelect from '../../components/MarketSelect' import MarketHeader from '../../components/MarketHeader' const PerpMarket = () => { const groupConfig = useMangoGroupConfig() const setMangoStore = useMangoStore((s) => s.set) const router = useRouter() const { market } = router.query useEffect(() => { if (market) { const newMarket = getMarketByBaseSymbolAndKind( groupConfig, market.toString().toUpperCase(), 'perp' ) setMangoStore((state) => { state.selectedMarket.current = null state.selectedMarket.config = newMarket }) } }, [market]) return (