address comments
This commit is contained in:
parent
dfa8af63e2
commit
c02b4cea3a
@ -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
|
||||
*/
|
||||
|
||||
@ -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: <AssetIcon symbol="DYDX" />,
|
||||
icon: <AssetIcon symbol={chainTokenLabel} />,
|
||||
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: <AssetIcon symbol="DYDX" />,
|
||||
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: <AssetIcon symbol={chainTokenLabel} />,
|
||||
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}`);
|
||||
}
|
||||
};
|
||||
},
|
||||
},
|
||||
|
||||
@ -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<typeof useNotificationsContext>;
|
||||
|
||||
@ -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],
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user