import { useState, useEffect } from 'react' import TopBar from '../components/TopBar' import PageBodyContainer from '../components/PageBodyContainer' import StatsTotals from '../components/stats_page/StatsTotals' import StatsAssets from '../components/stats_page/StatsAssets' import StatsPerps from '../components/stats_page/StatsPerps' import useMangoStats from '../hooks/useMangoStats' import Swipeable from '../components/mobile/Swipeable' import SwipeableTabs from '../components/mobile/SwipeableTabs' import Tabs from '../components/Tabs' import { useViewport } from '../hooks/useViewport' import { breakpoints } from '../components/TradePageGrid' import { serverSideTranslations } from 'next-i18next/serverSideTranslations' import { useTranslation } from 'next-i18next' export async function getStaticProps({ locale }) { return { props: { ...(await serverSideTranslations(locale, ['common'])), // Will be passed to the page component as props }, } } export default function StatsPage() { const { t } = useTranslation('common') const TABS = [ 'Totals', 'Assets', 'Perps', // 'Markets', // 'Liquidations', ] const { latestStats, stats, perpStats } = useMangoStats() const [viewIndex, setViewIndex] = useState(0) const [activeTab, setActiveTab] = useState(TABS[0]) const { width } = useViewport() const isMobile = width ? width < breakpoints.sm : false const handleChangeViewIndex = (index) => { setViewIndex(index) } const handleTabChange = (tabName) => { setActiveTab(tabName) } useEffect(() => { // Will either automatically connect to Phantom, or do nothing. // @ts-ignore window.solana.connect({ onlyIfTrusted: true }) }, []) return (