-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add tabs to connect stats with leaderboard
- Loading branch information
1 parent
2b30677
commit efe0377
Showing
7 changed files
with
121 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { Col, Radio, Row, Tabs } from 'antd' | ||
import dynamic from 'next/dynamic' | ||
import router from 'next/router' | ||
import { useState } from 'react' | ||
import { useMyAddress } from '../auth/MyAccountsContext' | ||
import { PageContent } from '../main/PageWrapper' | ||
import { StatisticsProps } from './Statistics' | ||
import style from './Statistics.module.sass' | ||
|
||
export const periodOpt = [ | ||
{ label: 'Last 7 days', value: '7' }, | ||
{ label: 'Last month', value: '30' }, | ||
{ label: 'Last 3 months', value: '90' }, | ||
] | ||
|
||
const Statistics = dynamic(() => import('./Statistics'), { ssr: false }) | ||
|
||
export default function StatisticsPage(props: StatisticsProps) { | ||
const myAddress = useMyAddress() | ||
const [period, setPeriod] = useState<string>('30') | ||
|
||
const onRadioChange = (e: any) => { | ||
setPeriod(e.target.value) | ||
} | ||
|
||
return ( | ||
<PageContent meta={{ title: 'Statistics' }} withLargerMaxWidth> | ||
<Tabs | ||
activeKey='stats' | ||
onChange={key => { | ||
if (key === 'general') router.push('/leaderboard') | ||
else if (key === 'user') router.push(`/leaderboard/${myAddress}?tab=staker`) | ||
}} | ||
> | ||
<Tabs.TabPane tab='My Staking Stats' key='user' /> | ||
<Tabs.TabPane tab='Global Staking Stats' key='general' /> | ||
<Tabs.TabPane tab='Polkaverse Activity' key='stats' /> | ||
</Tabs> | ||
<Row className={`${style.DfGridParams} my-3`}> | ||
<Col> | ||
<Radio.Group | ||
options={periodOpt} | ||
onChange={onRadioChange} | ||
value={period} | ||
optionType={'button'} | ||
/> | ||
</Col> | ||
{/* {!isMobile && ( | ||
<Col className={style.DfNavButtonCol}> | ||
<Radio.Group | ||
options={tailsViewOpt} | ||
onChange={onRadioTilesChange} | ||
value={tilesView} | ||
optionType={'button'} | ||
className={style.DfTilesView} | ||
/> | ||
</Col> | ||
)} */} | ||
</Row> | ||
<Statistics period={period} {...props} /> | ||
</PageContent> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,4 @@ | ||
import dynamic from 'next/dynamic' | ||
const Statistics = dynamic( | ||
() => import('../components/statistics/Statistics').then((mod: any) => mod.Statistics), | ||
{ ssr: false }, | ||
) | ||
import StatisticsPage from 'src/components/statistics/StatisticsPage' | ||
|
||
export const page = () => <Statistics /> | ||
export const page = () => <StatisticsPage /> | ||
export default page |