Skip to content

Commit

Permalink
Add redirect to leaderboard page on grill part
Browse files Browse the repository at this point in the history
  • Loading branch information
samchuk-vlad committed May 1, 2024
1 parent 66bd400 commit 9fd5e07
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,6 @@

.ModalContent
overflow-x: clip !important

.LinkTab
color: #000
21 changes: 13 additions & 8 deletions src/components/leaderboard/common/LeaderboardTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import config from 'src/config'
import { useSendEvent } from 'src/providers/AnalyticContext'
import { useFetchTotalStake } from 'src/rtk/features/creators/totalStakeHooks'
import { getAmountRange } from 'src/utils/analytics'
import styles from './LeaderboardTable.module.sass'

export default function LeaderboardTabs({
activeKey,
Expand All @@ -19,7 +20,6 @@ export default function LeaderboardTabs({
return (
<>
<Tabs
className='sm-hidden'
activeKey={activeKey}
onChange={key => {
if (key === 'user') {
Expand All @@ -29,13 +29,13 @@ export default function LeaderboardTabs({
role: 'staker',
amountRange: getAmountRange(totalStake?.amount),
})
router.push(`/leaderboard/${myAddress}?role=staker`, undefined, { shallow: true })
router.push(`/c/leaderboard/${myAddress}`, undefined, { shallow: true })
} else if (key === 'general') {
sendEvent('leaderboard_global_stats_opened', {
eventSource: 'leaderboard_tab',
amountRange: getAmountRange(totalStake?.amount),
})
router.push('/leaderboard', undefined, { shallow: true })
router.push('/c/leaderboard', undefined, { shallow: true })
} else if (key === 'stats') {
sendEvent('leaderboard_activity_opened', {
eventSource: 'leaderboard_tab',
Expand All @@ -48,7 +48,12 @@ export default function LeaderboardTabs({
{myAddress && (
<Tabs.TabPane
tab={
<CustomLink href={`/leaderboard/${myAddress}?role=staker`} shallow passHref>
<CustomLink
href={`/c/leaderboard/${myAddress}`}
className={styles.LinkTab}
shallow
passHref
>
<a style={{ color: 'inherit' }}>My Staking Stats</a>
</CustomLink>
}
Expand All @@ -57,22 +62,22 @@ export default function LeaderboardTabs({
)}
<Tabs.TabPane
tab={
<CustomLink href='/leaderboard' shallow passHref>
<CustomLink href='/c/leaderboard' className={styles.LinkTab} shallow passHref>
<a style={{ color: 'inherit' }}>Global Staking Stats</a>
</CustomLink>
}
key='general'
/>
<Tabs.TabPane
tab={
<CustomLink href='/stats' shallow passHref>
<CustomLink href='/c/stats' shallow passHref>
<a style={{ color: 'inherit' }}>{config.appName} Stats</a>
</CustomLink>
}
key='stats'
/>
</Tabs>
<Tabs
{/* <Tabs
className='lg-hidden'
activeKey={activeKey}
onChange={key => {
Expand Down Expand Up @@ -108,7 +113,7 @@ export default function LeaderboardTabs({
}
key='stats'
/>
</Tabs>
</Tabs> */}
</>
)
}
3 changes: 2 additions & 1 deletion src/layout/SideMenuItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ export const buildAuthorizedMenu = (myAddress?: string): MenuItem[] => {
{
name: 'Leaderboard',
icon: <SubIcon Icon={MdOutlineLeaderboard} />,
href: '/leaderboard',
href: myAddress ? `/c/leaderboard/${myAddress}` : '/c/leaderboard',
forceHardNavigation: true,
},
{
name: 'Statistics',
Expand Down

0 comments on commit 9fd5e07

Please sign in to comment.