Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore (incentives): season 4 reward distributed notification #645

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"@cosmjs/tendermint-rpc": "^0.32.1",
"@dydxprotocol/v4-abacus": "1.7.51",
"@dydxprotocol/v4-client-js": "^1.1.15",
"@dydxprotocol/v4-localization": "^1.1.109",
"@dydxprotocol/v4-localization": "^1.1.112",
"@ethersproject/providers": "^5.7.2",
"@js-joda/core": "^5.5.3",
"@privy-io/react-auth": "^1.66.2",
Expand Down
9 changes: 5 additions & 4 deletions pnpm-lock.yaml

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

2 changes: 1 addition & 1 deletion src/constants/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export type TransferNotifcation = {
export enum ReleaseUpdateNotificationIds {
RevampedConditionalOrders = 'revamped-conditional-orders',
IncentivesS5 = 'incentives-s5',
IncentivesDistributedS3 = 'incentives-distributed-s3',
IncentivesDistributedS4 = 'incentives-distributed-s4',
FOKDeprecation = 'fok-deprecation',
}

Expand Down
21 changes: 15 additions & 6 deletions src/hooks/useNotificationTypes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -362,11 +362,20 @@ export const notificationTypes: NotificationTypeConfig[] = [
useEffect(() => {
if (dydxAddress && status === 'success') {
trigger(
ReleaseUpdateNotificationIds.IncentivesDistributedS3,
ReleaseUpdateNotificationIds.IncentivesDistributedS4,
{
icon: <AssetIcon symbol={chainTokenLabel} />,
title: 'Season 3 launch rewards have been distributed!',
body: `Season 3 rewards: +${dydxRewards ?? 0} ${chainTokenLabel}`,
title: stringGetter({
key: 'NOTIFICATIONS.REWARDS_DISTRIBUTED.TITLE',
params: { SEASON_NUMBER: 4 },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, love that you made a l10n string for this.

}),
body: stringGetter({
key: 'NOTIFICATIONS.REWARDS_DISTRIBUTED.BODY',
params: {
SEASON_NUMBER: 4,
DYDX_AMOUNT: dydxRewards ?? 0,
},
}),
renderCustomBody({ isToast, notification }) {
return (
<IncentiveSeasonDistributionNotification
Expand All @@ -380,12 +389,12 @@ export const notificationTypes: NotificationTypeConfig[] = [
);
},
toastSensitivity: 'foreground',
groupKey: ReleaseUpdateNotificationIds.IncentivesDistributedS3,
groupKey: ReleaseUpdateNotificationIds.IncentivesDistributedS4,
},
[]
);
}
}, [dydxAddress, status, dydxRewards]);
}, [stringGetter, dydxAddress, status, dydxRewards]);
},
useNotificationAction: () => {
const { chainTokenLabel } = useTokenConfigs();
Expand All @@ -394,7 +403,7 @@ export const notificationTypes: NotificationTypeConfig[] = [
return (notificationId: string) => {
if (notificationId === ReleaseUpdateNotificationIds.IncentivesS5) {
navigate(`${chainTokenLabel}/${TokenRoute.TradingRewards}`);
} else if (notificationId === ReleaseUpdateNotificationIds.IncentivesDistributedS3) {
} else if (notificationId === ReleaseUpdateNotificationIds.IncentivesDistributedS4) {
navigate(`${chainTokenLabel}/${TokenRoute.StakingRewards}`);
}
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import styled from 'styled-components';

import { STRING_KEYS } from '@/constants/localization';

import { useStringGetter } from '@/hooks/useStringGetter';

import { Details } from '@/components/Details';
import { Icon, IconName } from '@/components/Icon';
// eslint-disable-next-line import/no-cycle
Expand All @@ -20,20 +24,27 @@ export const IncentiveSeasonDistributionNotification = ({
data,
notification,
}: IncentiveSeasonDistributionNotificationProps) => {
const stringGetter = useStringGetter();
const { chainTokenLabel, points } = data;

return (
<$Notification
isToast={isToast}
notification={notification}
slotIcon={<Icon iconName={IconName.RewardStar} />}
slotTitle="Season 3 launch rewards have been distributed!"
slotTitle={stringGetter({
key: 'NOTIFICATIONS.REWARDS_DISTRIBUTED.TITLE',
params: { SEASON_NUMBER: 4 },
})}
slotCustomContent={
<$Details
items={[
{
key: 'season_distribution',
label: 'Season 3 rewards',
label: stringGetter({
key: STRING_KEYS.LAUNCH_INCENTIVES_SEASON_REWARDS,
params: { SEASON_NUMBER: 4 },
}),
value: <$Output type={OutputType.Asset} value={points} tag={chainTokenLabel} />,
},
]}
Expand Down
Loading