Skip to content

Commit

Permalink
chore: add notif for incentives program ending (#992)
Browse files Browse the repository at this point in the history
  • Loading branch information
aforaleka authored Sep 10, 2024
1 parent 3a8103e commit 97f3523
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"@datadog/browser-logs": "^5.23.3",
"@dydxprotocol/v4-abacus": "1.9.10",
"@dydxprotocol/v4-client-js": "^1.1.27",
"@dydxprotocol/v4-localization": "^1.1.190",
"@dydxprotocol/v4-localization": "^1.1.191",
"@emotion/is-prop-valid": "^1.3.0",
"@ethersproject/providers": "^5.7.2",
"@hugocxl/react-to-image": "^0.0.9",
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions src/constants/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ export type TransferNotifcation = {
export enum ReleaseUpdateNotificationIds {
DiscoveryProgram = 'discovery-program',
Twitter200BVolume = 'twitter-200b-volume',
IncentivesS6 = 'incentives-s6',
IncentivesS6Ended = 'incentives-s6-ended',
KeplrSupport = 'keplr-support',
}

Expand All @@ -228,9 +228,7 @@ export enum IncentivesDistributedNotificationIds {
IncentivesDistributedS5 = 'incentives-distributed-s5',
}

export const CURRENT_SEASON_NUMBER = 6;
export const MEDIAN_REWARDS_AMOUNT = { DYDX: 52, USDC: 63 };
export const INCENTIVES_SEASON_NOTIFICATION_ID = ReleaseUpdateNotificationIds.IncentivesS6;
export const INCENTIVES_SEASON_NOTIFICATION_ID = ReleaseUpdateNotificationIds.IncentivesS6Ended;

export function getSeasonRewardDistributionNumber(seasonId: IncentivesDistributedNotificationIds) {
switch (seasonId) {
Expand Down
17 changes: 17 additions & 0 deletions src/hooks/useNotificationTypes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,23 @@ export const notificationTypes: NotificationTypeConfig[] = [

const { dydxRewards } = data ?? {};

useEffect(() => {
trigger(
INCENTIVES_SEASON_NOTIFICATION_ID,
{
icon: <Icon iconName={IconName.RewardStar} />,
title: stringGetter({
key: STRING_KEYS.INCENTIVES_SEASON_ENDED_TITLE,
params: { SEASON_NUMBER: 6 }, // last season, will just hardcode
}),
body: stringGetter({ key: STRING_KEYS.INCENTIVES_SEASON_ENDED_BODY }),
toastSensitivity: 'foreground',
groupKey: INCENTIVES_SEASON_NOTIFICATION_ID,
},
[]
);
}, [stringGetter]);

useEffect(() => {
const rewards = dydxRewards ?? 0;
if (dydxAddress && status === 'success' && rewards > 0) {
Expand Down

0 comments on commit 97f3523

Please sign in to comment.