import { useEffect } from 'react' import { useRouter } from 'next/router' import { Responsive, WidthProvider } from 'react-grid-layout' import TopBar from '../components/TopBar' import MarketSelect from '../components/MarketSelect' import useLocalStorageState from '../hooks/useLocalStorageState' import { PageBodyWrapper } from '../components/styles' import { DEFAULT_MARKET_KEY, initialMarket } from '../components/SettingsModal' import { breakpoints, defaultLayouts, GRID_LAYOUT_KEY, } from '../components/TradePageGrid' import { serverSideTranslations } from 'next-i18next/serverSideTranslations' export async function getStaticProps({ locale }) { return { props: { ...(await serverSideTranslations(locale, ['common', 'tv-chart'])), // Will be passed to the page component as props }, } } const ResponsiveGridLayout = WidthProvider(Responsive) const Index = () => { const [defaultMarket] = useLocalStorageState( DEFAULT_MARKET_KEY, initialMarket ) const [savedLayouts] = useLocalStorageState(GRID_LAYOUT_KEY, defaultLayouts) const router = useRouter() useEffect(() => { const { pathname } = router if (pathname == '/') { router.push(defaultMarket.path) } }, []) return (