Skip to content

Commit 317671b

Browse files
Merge pull request #2018 from push-protocol/2017-rewards-points-s1
Update Rewards S1 Changes
2 parents 4c34357 + fa5392b commit 317671b

File tree

6 files changed

+58
-10
lines changed

6 files changed

+58
-10
lines changed

src/common/hooks/useRewardsNotification.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ export const useRewardsNotification = () => {
1616

1717
const showNotification = () =>
1818
notification.show({
19-
title: 'Push Points are Live',
20-
description: 'Earn Push Points to unlock exclusive rewards on completing exciting activities',
19+
title: 'Points S1 Ends on Feb 28!',
20+
description:
21+
'Claim all tasks and prepare for the end of S1 of Push Reward Points. Leaderboards snapshot on Mar 1, 2025.',
2122
image: <RewardPoints />,
2223
position: 'bottom-left',
2324
onClick: () => {

src/modules/rewards/components/ActivityButton.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { ActvityType, useGetPushStakeEpoch, useGetUniV2StakeEpoch, UsersActivity
66
import { Button } from 'blocks';
77
import { ActivityVerificationButton } from './ActivityVerificationButton';
88
import { useRewardsContext } from 'contexts/RewardsContext';
9+
import { useDateExpiry } from '../hooks/useDateExpiry';
910

1011
type ActivityButtonProps = {
1112
userId: string;
@@ -46,6 +47,20 @@ const ActivityButton: FC<ActivityButtonProps> = ({
4647
usersSingleActivity?.data?.currentEpoch == pushStakeData?.currentEpoch ||
4748
usersSingleActivity?.data?.currentEpoch == uniV2StakeData?.currentEpoch;
4849

50+
const hasRewardsExpired = useDateExpiry('2025-02-28T23:59:59');
51+
52+
if (hasRewardsExpired) {
53+
return (
54+
<Button
55+
variant="tertiary"
56+
size="small"
57+
disabled
58+
>
59+
Ended
60+
</Button>
61+
);
62+
}
63+
4964
// claimed status for the same epoch
5065
if (usersSingleActivity?.status === 'COMPLETED' && (isPushEpochRelated || isUniV2EpochRelated) && isEpochRelated) {
5166
console.log('claimed in this epoch button');

src/modules/rewards/components/DailyRewardsSection.tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { css } from 'styled-components';
55
// hooks
66
import { useDailyRewards } from '../hooks/useDailyRewards';
77
import { useRewardsContext } from 'contexts/RewardsContext';
8+
import { useDateExpiry } from '../hooks/useDateExpiry';
89

910
// type
1011
import { ActvityType } from 'queries';
@@ -30,6 +31,7 @@ const DailyRewardsSection: FC<DailyRewardsSectionProps> = () => {
3031
} = useDailyRewards();
3132

3233
const { isLocked } = useRewardsContext();
34+
const hasRewardsExpired = useDateExpiry('2025-02-28T23:59:59');
3335

3436
const isDailyRewardClaimed = isActivityDisabled && activeDay > 1 && userDetails;
3537

@@ -63,7 +65,9 @@ const DailyRewardsSection: FC<DailyRewardsSectionProps> = () => {
6365
Check-in daily and unlock more rewards each day.
6466
</Text>
6567
</Box>
66-
{isLocked && (
68+
69+
{/* daily checkIn button state */}
70+
{!hasRewardsExpired && isLocked && (
6771
<Button
6872
variant="tertiary"
6973
size="small"
@@ -72,8 +76,16 @@ const DailyRewardsSection: FC<DailyRewardsSectionProps> = () => {
7276
Locked
7377
</Button>
7478
)}
75-
76-
{!isLocked && (
79+
{hasRewardsExpired && (
80+
<Button
81+
variant="tertiary"
82+
size="small"
83+
disabled
84+
>
85+
Ended
86+
</Button>
87+
)}
88+
{!hasRewardsExpired && !isLocked && (
7789
<>
7890
{isDailyRewardClaimed && (
7991
<Button

src/modules/rewards/components/DashboardSectionHeader.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ const DashboardSectionHeader: FC<DashboardSectionHeaderProps> = ({ onGetStarted
4646
variant="h4-semibold"
4747
color="text-on-light-bg"
4848
>
49-
Earn Rewards for Exploring!
49+
Push Points S1 Ends on Feb 28!
5050
</Text>
51-
<Box maxWidth={{ tb: 'auto', initial: '567px' }}>
51+
<Box maxWidth={{ tb: 'auto', initial: '607px' }}>
5252
<Text
5353
variant="bl-regular"
5454
color="text-on-light-bg"
5555
>
56-
Push Points are the new way to prove that you belong to the Push community and access to some cool
57-
surprises in the future.
56+
Claim all tasks and prepare for the end of S1 of Push Reward Points. Prizes will be announced on Feb
57+
25th. Leaderboards snapshot on Mar 1, 2025.
5858
</Text>
5959
</Box>
6060
</Box>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { useState, useEffect } from 'react';
2+
3+
export const useDateExpiry = (expiryDate: string | Date) => {
4+
const [hasExpired, setHasExpired] = useState<boolean>(new Date(expiryDate) < new Date());
5+
6+
useEffect(() => {
7+
if (hasExpired) return;
8+
9+
const interval = setInterval(() => {
10+
if (new Date() >= new Date(expiryDate)) {
11+
setHasExpired(true);
12+
clearInterval(interval);
13+
}
14+
}, 1000);
15+
16+
return () => clearInterval(interval);
17+
}, [hasExpired]);
18+
19+
return hasExpired;
20+
};

src/structure/Header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ const RewardsHeaderLink = ({ caip10WalletAddress }: { caip10WalletAddress: strin
123123
>
124124
{userDetails && userDetails?.totalPoints > 0 ? userDetails?.totalPoints?.toLocaleString() : ''}
125125
</Text>
126-
<Lozenge icon={<Star />}>NEW</Lozenge>
126+
<Lozenge icon={<Star />}>ENDING SOON</Lozenge>
127127
</Box>
128128
</Link>
129129
</Box>

0 commit comments

Comments
 (0)