-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: New rewards notifications (#558)
* feat: Add new notifications related to Rewards * feat: Use a bigger version of the reward icon as the campaign notifications image * chore: Remove unused type
- Loading branch information
1 parent
8151090
commit bd8697c
Showing
10 changed files
with
555 additions
and
25 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
69 changes: 69 additions & 0 deletions
69
...Notifications/NotificationTypes/Reward/CampaignGasPriceHigherThanExpectedNotification.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import React from 'react' | ||
|
||
import Reward from '../../../Icons/Notifications/Reward' | ||
import { | ||
CommonNotificationProps, | ||
CampaignGasPriceHigherThanExpectedNotification | ||
} from '../../types' | ||
import NotificationItem from '../../NotificationItem' | ||
import CampaignName from './CampaignName' | ||
|
||
const i18N = { | ||
en: { | ||
description: ( | ||
metadata: CampaignGasPriceHigherThanExpectedNotification['metadata'] | ||
): React.ReactNode => ( | ||
<> | ||
The gas price for the <CampaignName metadata={metadata} /> campaign is | ||
lower than expected, and the transactions may not be processed. | ||
</> | ||
), | ||
title: 'Gas Price Higher Than Expected' | ||
}, | ||
es: { | ||
description: ( | ||
metadata: CampaignGasPriceHigherThanExpectedNotification['metadata'] | ||
): React.ReactNode => ( | ||
<> | ||
El precio del gas para la campaña <CampaignName metadata={metadata} />{' '} | ||
es más alto de lo esperado, y las transacciones pueden no ser | ||
procesadas. | ||
</> | ||
), | ||
title: 'Precio del Gas Más Alto de lo Esperado' | ||
}, | ||
zh: { | ||
description: ( | ||
metadata: CampaignGasPriceHigherThanExpectedNotification['metadata'] | ||
): React.ReactNode => ( | ||
<> | ||
<CampaignName metadata={metadata} />{' '} | ||
活动的燃气价格高于预期,交易可能无法处理。 | ||
</> | ||
), | ||
title: '燃气价格高于预期' | ||
} | ||
} | ||
|
||
export default function CampaignGasPriceHigherThanExpectedNotification({ | ||
notification, | ||
locale | ||
}: CommonNotificationProps<CampaignGasPriceHigherThanExpectedNotification>) { | ||
return ( | ||
<NotificationItem | ||
image={{ | ||
image: <Reward width="48" height="48" /> | ||
}} | ||
timestamp={notification.timestamp} | ||
isNew={!notification.read} | ||
locale={locale} | ||
> | ||
<p className="dcl notification-item__content-title"> | ||
{i18N[locale].title} | ||
</p> | ||
<p className="dcl notification-item__content-description"> | ||
{i18N[locale].description(notification.metadata)} | ||
</p> | ||
</NotificationItem> | ||
) | ||
} |
17 changes: 17 additions & 0 deletions
17
src/components/Notifications/NotificationTypes/Reward/CampaignName.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from 'react' | ||
|
||
import { CampaignOutOfStockNotification } from '../../types' | ||
|
||
type CampaignNameProps = { | ||
metadata: CampaignOutOfStockNotification['metadata'] | ||
} | ||
|
||
export default function CampaignName(props: CampaignNameProps) { | ||
const { metadata } = props | ||
|
||
if (metadata.link) { | ||
return <a href={metadata.link}>{metadata.campaignName}</a> | ||
} | ||
|
||
return <strong>{metadata.campaignName}</strong> | ||
} |
66 changes: 66 additions & 0 deletions
66
src/components/Notifications/NotificationTypes/Reward/CampaignOutOfFundsNotification.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import React from 'react' | ||
|
||
import Reward from '../../../Icons/Notifications/Reward' | ||
import { | ||
CommonNotificationProps, | ||
CampaignOutOfFundsNotification | ||
} from '../../types' | ||
import NotificationItem from '../../NotificationItem' | ||
import CampaignName from './CampaignName' | ||
|
||
const i18N = { | ||
en: { | ||
description: ( | ||
metadata: CampaignOutOfFundsNotification['metadata'] | ||
): React.ReactNode => ( | ||
<> | ||
The <CampaignName metadata={metadata} /> campaign has run out of funds. | ||
</> | ||
), | ||
title: 'Campaign Out of Funds' | ||
}, | ||
es: { | ||
description: ( | ||
metadata: CampaignOutOfFundsNotification['metadata'] | ||
): React.ReactNode => ( | ||
<> | ||
La campaña <CampaignName metadata={metadata} /> se ha quedado sin | ||
fondos. | ||
</> | ||
), | ||
title: 'Campaña sin fondos' | ||
}, | ||
zh: { | ||
description: ( | ||
metadata: CampaignOutOfFundsNotification['metadata'] | ||
): React.ReactNode => ( | ||
<> | ||
<CampaignName metadata={metadata} /> 活动资金不足。 | ||
</> | ||
), | ||
title: '活动资金不足' | ||
} | ||
} | ||
|
||
export default function CampaignOutOfFundsNotification({ | ||
notification, | ||
locale | ||
}: CommonNotificationProps<CampaignOutOfFundsNotification>) { | ||
return ( | ||
<NotificationItem | ||
image={{ | ||
image: <Reward width="48" height="48" /> | ||
}} | ||
timestamp={notification.timestamp} | ||
isNew={!notification.read} | ||
locale={locale} | ||
> | ||
<p className="dcl notification-item__content-title"> | ||
{i18N[locale].title} | ||
</p> | ||
<p className="dcl notification-item__content-description"> | ||
{i18N[locale].description(notification.metadata)} | ||
</p> | ||
</NotificationItem> | ||
) | ||
} |
65 changes: 65 additions & 0 deletions
65
src/components/Notifications/NotificationTypes/Reward/CampaignOutOfStockNotification.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import React from 'react' | ||
|
||
import Reward from '../../../Icons/Notifications/Reward' | ||
import { | ||
CommonNotificationProps, | ||
CampaignOutOfStockNotification | ||
} from '../../types' | ||
import NotificationItem from '../../NotificationItem' | ||
import CampaignName from './CampaignName' | ||
|
||
const i18N = { | ||
en: { | ||
description: ( | ||
metadata: CampaignOutOfStockNotification['metadata'] | ||
): React.ReactNode => ( | ||
<> | ||
The <CampaignName metadata={metadata} /> campaign has run out of stock. | ||
</> | ||
), | ||
title: 'Campaign Out of Stock' | ||
}, | ||
es: { | ||
description: ( | ||
metadata: CampaignOutOfStockNotification['metadata'] | ||
): React.ReactNode => ( | ||
<> | ||
La campaña <CampaignName metadata={metadata} /> se ha quedado sin stock. | ||
</> | ||
), | ||
title: 'Campaña sin stock' | ||
}, | ||
zh: { | ||
description: ( | ||
metadata: CampaignOutOfStockNotification['metadata'] | ||
): React.ReactNode => ( | ||
<> | ||
<CampaignName metadata={metadata} /> 活动库存不足。 | ||
</> | ||
), | ||
title: '活动资金不足' | ||
} | ||
} | ||
|
||
export default function CampaignOutOfStockNotification({ | ||
notification, | ||
locale | ||
}: CommonNotificationProps<CampaignOutOfStockNotification>) { | ||
return ( | ||
<NotificationItem | ||
image={{ | ||
image: <Reward width="48" height="48" /> | ||
}} | ||
timestamp={notification.timestamp} | ||
isNew={!notification.read} | ||
locale={locale} | ||
> | ||
<p className="dcl notification-item__content-title"> | ||
{i18N[locale].title} | ||
</p> | ||
<p className="dcl notification-item__content-description"> | ||
{i18N[locale].description(notification.metadata)} | ||
</p> | ||
</NotificationItem> | ||
) | ||
} |
Oops, something went wrong.