diff --git a/src/constants/notifications.ts b/src/constants/notifications.ts
index e9af10f..6736199 100644
--- a/src/constants/notifications.ts
+++ b/src/constants/notifications.ts
@@ -5,7 +5,6 @@ export enum NotificationType {
AbacusGenerated = 'AbacusGenerated',
SquidTransfer = 'SquidTransfer',
ReleaseUpdates = 'ReleaseUpdates',
- ChaosLabs = 'ChaosLabs',
}
export enum NotificationComponentType {}
@@ -144,6 +143,11 @@ export type TransferNotifcation = {
isExchange?: boolean;
};
+export enum ReleaseUpdateNotificationIds {
+ RewardsAndFullTradingLive = 'rewards-and-full-trading-live',
+ IncentivesS3 = 'incentives-s3',
+}
+
/**
* @description Struct to store whether a NotificationType should be triggered
*/
diff --git a/src/hooks/useNotificationTypes.tsx b/src/hooks/useNotificationTypes.tsx
index c581bb1..a6c0bb4 100644
--- a/src/hooks/useNotificationTypes.tsx
+++ b/src/hooks/useNotificationTypes.tsx
@@ -20,6 +20,7 @@ import {
NotificationType,
DEFAULT_TOAST_AUTO_CLOSE_MS,
TransferNotificationTypes,
+ ReleaseUpdateNotificationIds,
} from '@/constants/notifications';
import { useStringGetter, useTokenConfigs } from '@/hooks';
@@ -238,13 +239,16 @@ export const notificationTypes: NotificationTypeConfig[] = [
{
type: NotificationType.ReleaseUpdates,
useTrigger: ({ trigger }) => {
+ const { chainTokenLabel } = useTokenConfigs();
const stringGetter = useStringGetter();
+ const expirationDate = new Date('2024-03-08T23:59:59');
+ const currentDate = new Date();
useEffect(() => {
trigger(
- 'rewards-and-full-trading-live',
+ ReleaseUpdateNotificationIds.RewardsAndFullTradingLive,
{
- icon: ,
+ icon: ,
title: stringGetter({ key: 'NOTIFICATIONS.RELEASE_REWARDS_AND_FULL_TRADING.TITLE' }),
body: stringGetter({
key: 'NOTIFICATIONS.RELEASE_REWARDS_AND_FULL_TRADING.BODY',
@@ -270,50 +274,40 @@ export const notificationTypes: NotificationTypeConfig[] = [
},
}),
toastSensitivity: 'foreground',
- groupKey: NotificationType.ReleaseUpdates,
- },
- []
- );
- }, [stringGetter]);
- },
- useNotificationAction: () => {
- return () => {};
- },
- },
- {
- type: NotificationType.ChaosLabs,
- useTrigger: ({ trigger }) => {
- const stringGetter = useStringGetter();
- const expirationDate = new Date('2024-03-08T23:59:59');
- const currentDate = new Date();
- useEffect(() => {
- if (currentDate > expirationDate) return;
- trigger(
- 'chaos-labs-s3',
- {
- icon: ,
- title: stringGetter({ key: 'NOTIFICATIONS.INCENTIVES_SEASON_BEGUN.TITLE' }),
- body: stringGetter({
- key: 'NOTIFICATIONS.INCENTIVES_SEASON_BEGUN.BODY',
- params: {
- SEASON_NUMBER: '3',
- PREV_SEASON_NUMBER: '1',
- DYDX_AMOUNT: '34',
- USDC_AMOUNT: '100',
- },
- }),
- toastSensitivity: 'foreground',
- groupKey: NotificationType.ChaosLabs,
+ groupKey: ReleaseUpdateNotificationIds.RewardsAndFullTradingLive,
},
[]
);
+ if (currentDate <= expirationDate) {
+ trigger(
+ ReleaseUpdateNotificationIds.IncentivesS3,
+ {
+ icon: ,
+ title: stringGetter({ key: 'NOTIFICATIONS.INCENTIVES_SEASON_BEGUN.TITLE' }),
+ body: stringGetter({
+ key: 'NOTIFICATIONS.INCENTIVES_SEASON_BEGUN.BODY',
+ params: {
+ SEASON_NUMBER: '3',
+ PREV_SEASON_NUMBER: '1',
+ DYDX_AMOUNT: '34',
+ USDC_AMOUNT: '100',
+ },
+ }),
+ toastSensitivity: 'foreground',
+ groupKey: ReleaseUpdateNotificationIds.IncentivesS3,
+ },
+ []
+ );
+ }
}, [stringGetter]);
},
useNotificationAction: () => {
const { chainTokenLabel } = useTokenConfigs();
const navigate = useNavigate();
- return () => {
- navigate(`${chainTokenLabel}/${TokenRoute.TradingRewards}`);
+ return (notificationId: string) => {
+ if (notificationId === ReleaseUpdateNotificationIds.IncentivesS3) {
+ navigate(`${chainTokenLabel}/${TokenRoute.TradingRewards}`);
+ }
};
},
},
diff --git a/src/hooks/useNotifications.tsx b/src/hooks/useNotifications.tsx
index e24f43b..ba44b52 100644
--- a/src/hooks/useNotifications.tsx
+++ b/src/hooks/useNotifications.tsx
@@ -15,7 +15,7 @@ import { useLocalStorage } from './useLocalStorage';
import { notificationTypes } from './useNotificationTypes';
import { track } from '@/lib/analytics';
-import { renderSvgToDataUrl } from '../lib/renderSvgToDataUrl';
+import { renderSvgToDataUrl } from '@/lib/renderSvgToDataUrl';
type NotificationsContextType = ReturnType;
@@ -50,6 +50,7 @@ const useNotificationsContext = () => {
defaultValue: {
[NotificationType.AbacusGenerated]: true,
[NotificationType.SquidTransfer]: true,
+ [NotificationType.ReleaseUpdates]: true,
version: LOCAL_STORAGE_VERSIONS[LocalStorageKey.NotificationPreferences],
},
});
@@ -84,7 +85,6 @@ const useNotificationsContext = () => {
[NotificationType.AbacusGenerated]: true,
[NotificationType.SquidTransfer]: true,
[NotificationType.ReleaseUpdates]: true,
- [NotificationType.ChaosLabs]: true,
version: LOCAL_STORAGE_VERSIONS[LocalStorageKey.NotificationPreferences],
});
}