mango-v4-ui/components/rewards/RewardsPage.tsx

35 lines
993 B
TypeScript
Raw Normal View History

2023-10-22 17:29:14 -07:00
import { useState } from 'react'
2023-06-13 05:52:58 -07:00
import Leaderboards from './Leaderboards'
2023-06-18 20:47:25 -07:00
import { useWallet } from '@solana/wallet-adapter-react'
2023-10-22 17:29:14 -07:00
import { useCurrentSeason, useIsAllClaimed } from 'hooks/useRewards'
import Season from './Season'
import ClaimPage from './Claim'
2023-06-18 20:47:25 -07:00
export const tiers = ['seed', 'mango', 'whale', 'bot']
2023-06-08 22:43:54 -07:00
const RewardsPage = () => {
2023-06-13 05:52:58 -07:00
const [showLeaderboards, setShowLeaderboards] = useState('')
const { publicKey } = useWallet()
const { data: seasonData } = useCurrentSeason()
const currentSeason = seasonData ? seasonData.season_id : undefined
const prevSeason = currentSeason ? currentSeason - 1 : undefined
2023-10-22 17:29:14 -07:00
const { showClaim } = useIsAllClaimed(prevSeason, publicKey)
2023-07-13 18:28:16 -07:00
2023-06-13 05:52:58 -07:00
return !showLeaderboards ? (
2023-10-25 04:34:17 -07:00
showClaim ? (
2023-09-27 21:54:13 -07:00
<ClaimPage />
) : (
2023-09-28 05:10:05 -07:00
<Season setShowLeaderboards={setShowLeaderboards} />
2023-09-27 21:54:13 -07:00
)
2023-06-13 05:52:58 -07:00
) : (
<Leaderboards
leaderboard={showLeaderboards}
goBack={() => setShowLeaderboards('')}
/>
2023-06-09 05:35:36 -07:00
)
}
export default RewardsPage