From 8151090233216346923d3cbf41370616cb1cefa2 Mon Sep 17 00:00:00 2001 From: lemu Date: Mon, 26 Aug 2024 11:12:42 -0300 Subject: [PATCH] feat: add governance cliff ended notifications (#557) --- package-lock.json | 14 +-- package.json | 2 +- .../Icons/Notifications/CliffEnded.tsx | 46 ++++++++++ .../GovernanceCliffEndedNotification.tsx | 91 +++++++++++++++++++ .../Notifications/NotificationTypes/index.ts | 2 + .../Notifications/Notifications.stories.tsx | 20 ++++ src/components/Notifications/types.ts | 6 ++ src/components/Notifications/utils.tsx | 2 + 8 files changed, 175 insertions(+), 8 deletions(-) create mode 100644 src/components/Icons/Notifications/CliffEnded.tsx create mode 100644 src/components/Notifications/NotificationTypes/Governance/GovernanceCliffEndedNotification.tsx diff --git a/package-lock.json b/package-lock.json index b7d1b31f..adf3d124 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "0.0.0-development", "license": "MIT", "dependencies": { - "@dcl/schemas": "^13.5.0", + "@dcl/schemas": "^13.6.2", "@dcl/ui-env": "^1.5.1", "balloon-css": "^0.5.0", "classnames": "^2.3.2", @@ -2076,9 +2076,9 @@ } }, "node_modules/@dcl/schemas": { - "version": "13.5.0", - "resolved": "https://registry.npmjs.org/@dcl/schemas/-/schemas-13.5.0.tgz", - "integrity": "sha512-uoZiRdi2hlkBauHvq9u4n7UqAiJ3sKoqiJxM5/y+JlmUBshSK6VtX11DBSv4tR1O2XBg6mFJhcx54t07mmag/g==", + "version": "13.6.2", + "resolved": "https://registry.npmjs.org/@dcl/schemas/-/schemas-13.6.2.tgz", + "integrity": "sha512-sps6khw7pn8hY/TRr8aH4gV+t5xVi7A32PZ4EVVJzjDAhTXAxa74wAI9cA/y/gR6rYKWu96LtHoEBf7wde8/lQ==", "dependencies": { "ajv": "^8.11.0", "ajv-errors": "^3.0.0", @@ -49159,9 +49159,9 @@ } }, "@dcl/schemas": { - "version": "13.5.0", - "resolved": "https://registry.npmjs.org/@dcl/schemas/-/schemas-13.5.0.tgz", - "integrity": "sha512-uoZiRdi2hlkBauHvq9u4n7UqAiJ3sKoqiJxM5/y+JlmUBshSK6VtX11DBSv4tR1O2XBg6mFJhcx54t07mmag/g==", + "version": "13.6.2", + "resolved": "https://registry.npmjs.org/@dcl/schemas/-/schemas-13.6.2.tgz", + "integrity": "sha512-sps6khw7pn8hY/TRr8aH4gV+t5xVi7A32PZ4EVVJzjDAhTXAxa74wAI9cA/y/gR6rYKWu96LtHoEBf7wde8/lQ==", "requires": { "ajv": "^8.11.0", "ajv-errors": "^3.0.0", diff --git a/package.json b/package.json index 218a3217..e7f7eab7 100644 --- a/package.json +++ b/package.json @@ -85,7 +85,7 @@ "webpack-cli": "^3.3.2" }, "dependencies": { - "@dcl/schemas": "^13.5.0", + "@dcl/schemas": "^13.6.2", "@dcl/ui-env": "^1.5.1", "balloon-css": "^0.5.0", "classnames": "^2.3.2", diff --git a/src/components/Icons/Notifications/CliffEnded.tsx b/src/components/Icons/Notifications/CliffEnded.tsx new file mode 100644 index 00000000..c6874ef2 --- /dev/null +++ b/src/components/Icons/Notifications/CliffEnded.tsx @@ -0,0 +1,46 @@ +import React from 'react' + +function CliffEnded() { + return ( + + + + + + + + + + + + + + + + ) +} + +export default CliffEnded diff --git a/src/components/Notifications/NotificationTypes/Governance/GovernanceCliffEndedNotification.tsx b/src/components/Notifications/NotificationTypes/Governance/GovernanceCliffEndedNotification.tsx new file mode 100644 index 00000000..af6073d1 --- /dev/null +++ b/src/components/Notifications/NotificationTypes/Governance/GovernanceCliffEndedNotification.tsx @@ -0,0 +1,91 @@ +import React from 'react' +import { + CommonNotificationProps, + GovernanceCliffEndedNotification +} from '../../types' +import NotificationItem from '../../NotificationItem' +import CliffEnded from '../../../Icons/Notifications/CliffEnded' + +const i18N = { + en: { + description: (link: string): React.ReactNode => ( + <> + The cliff period to vest funds has ended. Check the{' '} + + contract status + {' '} + now! + + ), + title: (proposalTitle: string): React.ReactNode => ( + <> + Funds are ready to vest for your project " + + {proposalTitle} + + " + + ) + }, + es: { + description: (link: string): React.ReactNode => ( + <> + El período de espera para la adjudicación de fondos ha finalizado. + ¡Revisa el{' '} + + estado del contrato + {' '} + ahora! + + ), + title: (proposalTitle: string): React.ReactNode => ( + <> + Los fondos están listos para ser utilizados en tu proyecto " + + {proposalTitle} + + " + + ) + }, + zh: { + description: (link: string): React.ReactNode => ( + <> + 资金释放的等待期已结束。 + + 现在查看合同状态! + + + ), + title: (proposalTitle: string): React.ReactNode => ( + <> + 您的项目“ + + {proposalTitle} + + ”的资金已准备好释放 + + ) + } +} + +const GovernanceCliffEndedNotification = ({ + notification, + locale +}: CommonNotificationProps) => ( + }} + timestamp={notification.timestamp} + isNew={!notification.read} + locale={locale} + > +

+ {i18N[locale].title(notification.metadata.proposalTitle)} +

+

+ {i18N[locale].description(notification.metadata.link)} +

+
+) + +export default GovernanceCliffEndedNotification diff --git a/src/components/Notifications/NotificationTypes/index.ts b/src/components/Notifications/NotificationTypes/index.ts index 8627524b..2f524e01 100644 --- a/src/components/Notifications/NotificationTypes/index.ts +++ b/src/components/Notifications/NotificationTypes/index.ts @@ -18,6 +18,7 @@ import GovernanceTenderPassedNotification from './Governance/GovernanceTenderPas import GovernancePitchPassedNotification from './Governance/GovernancePitchPassedNotification' import GovernanceVotedOnBehalfNotification from './Governance/GovernanceVotedOnBehalfNotification' import GovernanceWhaleVoteNotification from './Governance/GovernanceWhaleVoteNotification' +import GovernanceCliffEndedNotification from './Governance/GovernanceCliffEndedNotification' import LandRentedNotification from './Land/LandRentedNotification' import LandRentalEndedNotification from './Land/LandRentalEndedNotification' import RewardAssignedNotification from './Reward/RewardAssignedNotification' @@ -43,6 +44,7 @@ export { GovernanceTenderPassedNotification, GovernanceVotedOnBehalfNotification, GovernanceWhaleVoteNotification, + GovernanceCliffEndedNotification, LandRentalEndedNotification, LandRentedNotification, RewardAssignedNotification, diff --git a/src/components/Notifications/Notifications.stories.tsx b/src/components/Notifications/Notifications.stories.tsx index 922c1b67..9c1246ed 100644 --- a/src/components/Notifications/Notifications.stories.tsx +++ b/src/components/Notifications/Notifications.stories.tsx @@ -9,6 +9,7 @@ import { getBGColorByRarity } from './utils' import GovernanceAnnouncementNotification from './NotificationTypes/Governance/GovernanceAnnouncementNotification' import GovernanceAuthoredProposalFinishedNotification from './NotificationTypes/Governance/GovernanceAuthoredProposalFinishedNotification' import GovernanceCoauthorRequestedNotification from './NotificationTypes/Governance/GovernanceCoauthorRequestedNotification' +import GovernanceCliffEndedNotification from './NotificationTypes/Governance/GovernanceCliffEndedNotification' import GovernanceNewCommentOnProposalNotification from './NotificationTypes/Governance/GovernanceNewCommentOnProposalNotification' import GovernanceNewCommentOnProjectUpdateNotification from './NotificationTypes/Governance/GovernanceNewCommentOnProjectUpdateNotification' import GovernanceVotingEndedVoterNotification from './NotificationTypes/Governance/GovernanceVotingEndedVoterNotification' @@ -581,6 +582,25 @@ storiesOf('Notifications Toggle', module) updated_at: '2023-11-29T12:51:00.600Z' }} /> + ) }) diff --git a/src/components/Notifications/types.ts b/src/components/Notifications/types.ts index 4f940a70..94524119 100644 --- a/src/components/Notifications/types.ts +++ b/src/components/Notifications/types.ts @@ -136,10 +136,16 @@ export type GovernanceWhaleVoteNotification = RawDecentralandNotification< CommonGovernanceNotificationMetadata > +export type GovernanceCliffEndedNotification = RawDecentralandNotification< + NotificationType.GOVERNANCE_CLIFF_ENDED, + CommonGovernanceNotificationMetadata +> + type GovernanceNotifications = | GovernanceAnnouncementNotification | GovernanceProposalEnactedNotification | GovernanceCoauthorRequestedNotification + | GovernanceCliffEndedNotification | GovernanceAuthoredProposalFinishedNotification | GovernanceVotingEndedVoterNotification | GovernanceNewCommentOnProposalNotification diff --git a/src/components/Notifications/utils.tsx b/src/components/Notifications/utils.tsx index cb752e6c..d18ccd08 100644 --- a/src/components/Notifications/utils.tsx +++ b/src/components/Notifications/utils.tsx @@ -8,6 +8,7 @@ import { GovernanceAnnouncementNotification, GovernanceAuthoredProposalFinishedNotification, GovernanceCoauthorRequestedNotification, + GovernanceCliffEndedNotification, GovernanceNewCommentOnProposalNotification, GovernanceNewCommentOnProjectUpdateNotification, GovernanceProposalEnactedNotification, @@ -76,6 +77,7 @@ export const NotificationComponentByType: DecentralandNotificationComponentByTyp [NotificationType.GOVERNANCE_TENDER_PASSED]: GovernanceTenderPassedNotification, [NotificationType.GOVERNANCE_WHALE_VOTE]: GovernanceWhaleVoteNotification, + [NotificationType.GOVERNANCE_CLIFF_ENDED]: GovernanceCliffEndedNotification, [NotificationType.GOVERNANCE_VOTED_ON_BEHALF]: GovernanceVotedOnBehalfNotification, [NotificationType.WORLDS_MISSING_RESOURCES]: