-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add new notifications related to Rewards
- Loading branch information
1 parent
8151090
commit c132476
Showing
10 changed files
with
563 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.
70 changes: 70 additions & 0 deletions
70
...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,70 @@ | ||
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: TODO maybe using a common image for all campaign related notifications | ||
image: <Reward /> // This should be the icon | ||
}} | ||
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> | ||
} |
67 changes: 67 additions & 0 deletions
67
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,67 @@ | ||
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: TODO maybe using a common image for all campaign related notifications | ||
image: <Reward /> // This should be the icon | ||
}} | ||
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> | ||
) | ||
} |
66 changes: 66 additions & 0 deletions
66
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,66 @@ | ||
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: TODO maybe using a common image for all campaign related notifications | ||
image: <Reward /> // This should be the icon | ||
}} | ||
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.