2021-06-10 07:09:25 -07:00
|
|
|
import { useState } from 'react'
|
2021-03-30 15:47:08 -07:00
|
|
|
import TopBar from '../components/TopBar'
|
2021-06-10 07:09:25 -07:00
|
|
|
import PageBodyContainer from '../components/PageBodyContainer'
|
|
|
|
import StatsTotals from '../components/stats-page/StatsTotals'
|
|
|
|
import StatsAssets from '../components/stats-page/StatsAssets'
|
2021-07-13 06:52:48 -07:00
|
|
|
import StatsPerps from '../components/stats-page/StatsPerps'
|
2021-03-30 15:47:08 -07:00
|
|
|
|
2021-06-10 07:09:25 -07:00
|
|
|
const TABS = [
|
|
|
|
'Totals',
|
2021-07-21 14:26:18 -07:00
|
|
|
// 'Assets',
|
|
|
|
// 'Perps',
|
2021-06-10 07:09:25 -07:00
|
|
|
// 'Markets',
|
|
|
|
// 'Liquidations',
|
|
|
|
]
|
2021-04-07 16:06:02 -07:00
|
|
|
|
|
|
|
export default function StatsPage() {
|
2021-06-10 07:09:25 -07:00
|
|
|
const [activeTab, setActiveTab] = useState(TABS[0])
|
2021-04-07 16:06:02 -07:00
|
|
|
|
2021-06-10 07:09:25 -07:00
|
|
|
const handleTabChange = (tabName) => {
|
|
|
|
setActiveTab(tabName)
|
|
|
|
}
|
2021-04-07 16:06:02 -07:00
|
|
|
|
|
|
|
return (
|
2021-06-10 07:09:25 -07:00
|
|
|
<div className={`bg-th-bkg-1 text-th-fgd-1 transition-all`}>
|
2021-04-07 16:06:02 -07:00
|
|
|
<TopBar />
|
2021-06-10 07:09:25 -07:00
|
|
|
<PageBodyContainer>
|
|
|
|
<div className="flex flex-col sm:flex-row pt-8 pb-3 sm:pb-6 md:pt-10">
|
|
|
|
<h1 className={`text-th-fgd-1 text-2xl font-semibold`}>Stats</h1>
|
2021-04-20 07:19:08 -07:00
|
|
|
</div>
|
2021-06-10 07:09:25 -07:00
|
|
|
<div className="bg-th-bkg-2 overflow-none p-6 rounded-lg">
|
|
|
|
<div className="border-b border-th-fgd-4 mb-4">
|
|
|
|
<nav className={`-mb-px flex space-x-6`} aria-label="Tabs">
|
|
|
|
{TABS.map((tabName) => (
|
|
|
|
<a
|
|
|
|
key={tabName}
|
|
|
|
onClick={() => handleTabChange(tabName)}
|
|
|
|
className={`whitespace-nowrap pb-4 px-1 border-b-2 font-semibold cursor-pointer default-transition hover:opacity-100
|
|
|
|
${
|
|
|
|
activeTab === tabName
|
|
|
|
? `border-th-primary text-th-primary`
|
|
|
|
: `border-transparent text-th-fgd-4 hover:text-th-primary`
|
|
|
|
}
|
2021-04-20 07:19:08 -07:00
|
|
|
`}
|
|
|
|
>
|
2021-06-10 07:09:25 -07:00
|
|
|
{tabName}
|
|
|
|
</a>
|
2021-04-20 07:19:08 -07:00
|
|
|
))}
|
2021-06-10 07:09:25 -07:00
|
|
|
</nav>
|
2021-04-20 07:19:08 -07:00
|
|
|
</div>
|
2021-06-10 07:09:25 -07:00
|
|
|
<TabContent activeTab={activeTab} />
|
|
|
|
</div>
|
|
|
|
</PageBodyContainer>
|
2021-04-13 09:51:42 -07:00
|
|
|
</div>
|
2021-04-07 16:06:02 -07:00
|
|
|
)
|
|
|
|
}
|
2021-06-10 07:09:25 -07:00
|
|
|
|
|
|
|
const TabContent = ({ activeTab }) => {
|
|
|
|
switch (activeTab) {
|
|
|
|
case 'Totals':
|
|
|
|
return <StatsTotals />
|
|
|
|
case 'Assets':
|
|
|
|
return <StatsAssets />
|
2021-07-13 06:52:48 -07:00
|
|
|
case 'Perps':
|
|
|
|
return <StatsPerps />
|
2021-06-10 07:09:25 -07:00
|
|
|
case 'Markets':
|
|
|
|
return <div>Markets</div>
|
|
|
|
case 'Liquidations':
|
|
|
|
return <div>Liquidations</div>
|
|
|
|
default:
|
2021-07-02 18:18:57 -07:00
|
|
|
return <StatsAssets />
|
2021-06-10 07:09:25 -07:00
|
|
|
}
|
|
|
|
}
|