Skip to content

Commit

Permalink
Merge branch 'decentraland:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Jagadeeshftw authored Sep 7, 2024
2 parents 2e40b6f + 9324501 commit 45b3723
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 28 deletions.
38 changes: 19 additions & 19 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"webpack-cli": "^3.3.2"
},
"dependencies": {
"@dcl/schemas": "^13.6.2",
"@dcl/schemas": "^13.9.0",
"@dcl/ui-env": "^1.5.1",
"balloon-css": "^0.5.0",
"classnames": "^2.3.2",
Expand Down
5 changes: 5 additions & 0 deletions src/components/Notifications/NotificationsFeed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ const NotificationHandler = ({
renderProfile?: (address: string) => JSX.Element | string | null
}) => {
const NotificationComponent = NotificationComponentByType[notification.type]

if (!NotificationComponent) {
return null
}

return (
<NotificationComponent
notification={notification}
Expand Down
19 changes: 11 additions & 8 deletions src/components/Notifications/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,14 @@ export function getBGColorByRarity(rarity: Rarity) {
return Rarity.getGradient(rarity).join()
}

export type DecentralandNotificationComponentByType<T> = {
[k in NotificationType]: T extends DCLNotification
? // eslint-disable-next-line @typescript-eslint/no-explicit-any
FunctionComponent<CommonNotificationProps<any>>
: never
}
export type DecentralandNotificationComponentByType<T> = Partial<
{
[k in NotificationType]: T extends DCLNotification
? // eslint-disable-next-line @typescript-eslint/no-explicit-any
FunctionComponent<CommonNotificationProps<any>>
: never
}
>

export const NotificationComponentByType: DecentralandNotificationComponentByType<DCLNotification> =
{
Expand Down Expand Up @@ -101,7 +103,6 @@ export const NotificationComponentByType: DecentralandNotificationComponentByTyp
CampaignOutOfStockNotification,
[NotificationType.REWARD_CAMPAIGN_GAS_PRICE_HIGHER_THAN_EXPECTED]:
CampaignGasPriceHigherThanExpectedNotification,
[NotificationType.BADGE_GRANTED]: null,
[NotificationType.EVENTS_STARTS_SOON]: EventsStartsSoonNotification,
[NotificationType.EVENTS_STARTED]: EventsStartedNotification,
[NotificationType.WORLDS_PERMISSION_GRANTED]:
Expand All @@ -110,7 +111,9 @@ export const NotificationComponentByType: DecentralandNotificationComponentByTyp
WorldsPermissionRevokedNotification
}

export const CURRENT_AVAILABLE_NOTIFICATIONS = Object.values(NotificationType)
export const CURRENT_AVAILABLE_NOTIFICATIONS = Object.keys(
NotificationComponentByType
)

export const replaceWithValues = (
str: string,
Expand Down

0 comments on commit 45b3723

Please sign in to comment.