@@ -12,7 +12,7 @@ import { EMPTY_ARR } from '@/constants/objects';
1212import { AppRoute } from '@/constants/routes' ;
1313import { timeUnits } from '@/constants/time' ;
1414
15- import { CURRENT_BONK_REWARDS_DETAILS } from '@/hooks/rewards/util' ;
15+ import { getActiveRwaWeek , RWA_COMPETITION_DETAILS } from '@/hooks/rewards/util' ;
1616import { useBreakpoints } from '@/hooks/useBreakpoints' ;
1717import { useComplianceState } from '@/hooks/useComplianceState' ;
1818import { useEnableLiquidationRebates } from '@/hooks/useEnableLiquidationRebates' ;
@@ -30,10 +30,9 @@ import { TermsOfUseLink } from '@/components/TermsOfUseLink';
3030
3131import { orEmptyObj } from '@/lib/typeUtils' ;
3232
33- import { BonkIncentivesPanel } from './BonkIncentivesPanel' ;
3433import { BonkPnlLeaderboardPanel } from './BonkPnlLeaderboardPanel' ;
35- import { BonkPnlPanel } from './BonkPnlPanel' ;
3634import { CompetitionLeaderboardPanel } from './CompetitionLeaderboardPanel' ;
35+ import { RwaCompetitionPanel } from './RwaCompetitionPanel' ;
3736import { GeoblockedPanel } from './GeoblockedPanel' ;
3837import { LaunchIncentivesPanel } from './LaunchIncentivesPanel' ;
3938import { LiquidationRebatesHeader } from './LiquidationRebatesHeader' ;
@@ -45,23 +44,26 @@ import { SwapAndStakingPanel } from './SwapAndStakingPanel';
4544import { UnbondingPanels } from './UnbondingPanels' ;
4645
4746enum Tab {
47+ RwaCompetition = 'RwaCompetition' ,
4848 Leaderboard = 'Leaderboard' ,
49- BonkPnl = 'BonkPnl' ,
5049 Rewards = 'Rewards' ,
5150 LiquidationRebates = 'LiquidationRebates' ,
5251 Competition = 'Competition' ,
5352}
5453
5554const RewardsPage = ( ) => {
56- const { titleStringKey, endTime } = CURRENT_BONK_REWARDS_DETAILS ;
5755 const stringGetter = useStringGetter ( ) ;
5856 const navigate = useNavigate ( ) ;
5957 const { complianceState } = useComplianceState ( ) ;
6058 const { isTablet } = useBreakpoints ( ) ;
6159 const enableLiquidationRebates = useEnableLiquidationRebates ( ) ;
6260 const { usdcDenom } = useTokenConfigs ( ) ;
6361
64- const [ value , setValue ] = useState ( Tab . Leaderboard ) ;
62+ const [ value , setValue ] = useState ( Tab . RwaCompetition ) ;
63+
64+ const activeWeek = getActiveRwaWeek ( ) ;
65+ const competitionEnd = new Date ( RWA_COMPETITION_DETAILS . endTime ) ;
66+ const endTime = activeWeek ?. endDate ?? RWA_COMPETITION_DETAILS . endTime ;
6567
6668 const { totalRewards } = orEmptyObj ( BonsaiHooks . useStakingRewards ( ) . data ) ;
6769
@@ -87,40 +89,39 @@ const RewardsPage = () => {
8789
8890 const endMs = new Date ( endTime ) . getTime ( ) ;
8991 const msRemaining = endMs - Date . now ( ) ;
90- const hasEnded = msRemaining <= 0 ;
92+ const hasEnded = new Date ( ) >= competitionEnd ;
9193 const daysRemaining = Math . ceil ( msRemaining / timeUnits . day ) ;
92- const endingSoon = ! hasEnded && daysRemaining <= 5 ;
94+ const endingSoon = ! hasEnded && daysRemaining <= 3 ;
95+
96+ const weekLabel = activeWeek ? `Week ${ activeWeek . week } : ${ activeWeek . name } ` : null ;
9397
9498 const tabs = [
9599 {
96- content : (
97- < div tw = "flexColumn gap-1.5" >
98- < BonkPnlLeaderboardPanel />
99- </ div >
100- ) ,
101- label : stringGetter ( { key : STRING_KEYS . COMPETITION_LEADERBOARD_TITLE } ) ,
102- value : Tab . Leaderboard ,
103- } ,
104- {
105- content : (
106- < div tw = "flexColumn gap-1.5" >
107- < BonkIncentivesPanel />
108- < BonkPnlPanel />
109- </ div >
110- ) ,
100+ content : < RwaCompetitionPanel /> ,
111101 label : (
112102 < div tw = "flex items-center gap-0.5" >
113- { stringGetter ( { key : titleStringKey } ) }
103+ RWA Trading Competition
114104 { hasEnded ? (
115105 < Tag > { stringGetter ( { key : STRING_KEYS . ENDED } ) } </ Tag >
116106 ) : endingSoon ? (
117107 < Tag >
118108 { daysRemaining } { daysRemaining === 1 ? 'day' : 'days' } left
119109 </ Tag >
110+ ) : weekLabel ? (
111+ < Tag > { weekLabel } </ Tag >
120112 ) : null }
121113 </ div >
122114 ) ,
123- value : Tab . BonkPnl ,
115+ value : Tab . RwaCompetition ,
116+ } ,
117+ {
118+ content : (
119+ < div tw = "flexColumn gap-1.5" >
120+ < BonkPnlLeaderboardPanel />
121+ </ div >
122+ ) ,
123+ label : stringGetter ( { key : STRING_KEYS . COMPETITION_LEADERBOARD_TITLE } ) ,
124+ value : Tab . Leaderboard ,
124125 } ,
125126 ...( enableLiquidationRebates
126127 ? [
0 commit comments