-
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.
- Loading branch information
Showing
4 changed files
with
153 additions
and
4 deletions.
There are no files selected for viewing
68 changes: 68 additions & 0 deletions
68
src/components/Notifications/NotificationTypes/BidAcceptedNotification.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,68 @@ | ||
import React from 'react' | ||
|
||
import { BidAcceptedNotification, NotificationLocale } from '../types' | ||
import NotificationItem from '../NotificationItem' | ||
import BidAccepted from '../../Icons/Notifications/BidAccepted' | ||
import { Rarity } from '@dcl/schemas' | ||
|
||
interface BidAcceptedNotificationProps { | ||
notification: BidAcceptedNotification | ||
locale: NotificationLocale | ||
} | ||
|
||
const i18N = { | ||
en: { | ||
description: ( | ||
mana: React.ReactNode, | ||
nftName: React.ReactNode | ||
): React.ReactNode => | ||
`Your bid of ${mana} MANA was accepted for ${nftName}`, | ||
title: 'Bid Accepted' | ||
}, | ||
es: { description: ( | ||
mana: React.ReactNode, | ||
nftName: React.ReactNode | ||
): React.ReactNode => | ||
`Tu oferta de ${mana} MANA fue aceptada para ${nftName}`, title: 'Oferta aceptada' }, | ||
zh: { description: ( | ||
mana: React.ReactNode, | ||
nftName: React.ReactNode | ||
): React.ReactNode => `您的出价 ${mana} MANA 已被接受 ${nftName}` , title: '接受投标' } | ||
} | ||
|
||
const BidAcceptedNotification = ({ | ||
notification, | ||
locale | ||
}: BidAcceptedNotificationProps) => { | ||
return ( | ||
<NotificationItem | ||
image={{ | ||
imageLink: notification.metadata.image, | ||
rarity: notification.metadata.rarity, | ||
icon: <BidAccepted /> | ||
}} | ||
timestamp={notification.timestamp} | ||
isNew={!notification.read} | ||
> | ||
<p className="dcl notification-item__content__title"> | ||
{i18N[locale].title} | ||
</p> | ||
<p className="dcl notification-item__content__description"> | ||
{i18N[locale].description}{' '} | ||
<span> | ||
<a | ||
href={notification.metadata.link} | ||
style={{ | ||
color: `${Rarity.getColor(notification.metadata.rarity)}`, | ||
textDecoration: 'underline' | ||
}} | ||
> | ||
{notification.metadata.nftName} | ||
</a> | ||
</span> | ||
</p> | ||
</NotificationItem> | ||
) | ||
} | ||
|
||
export default BidAcceptedNotification |
68 changes: 68 additions & 0 deletions
68
src/components/Notifications/NotificationTypes/BidReceivedNotification.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,68 @@ | ||
import React from 'react' | ||
|
||
import { BidReceivedNotification, NotificationLocale } from '../types' | ||
import NotificationItem from '../NotificationItem' | ||
import BidAccepted from '../../Icons/Notifications/BidAccepted' | ||
import { Rarity } from '@dcl/schemas' | ||
|
||
interface BidReceivedNotificationProps { | ||
notification: BidReceivedNotification | ||
locale: NotificationLocale | ||
} | ||
|
||
const i18N = { | ||
en: { | ||
description: ( | ||
mana: React.ReactNode, | ||
nftName: React.ReactNode | ||
): React.ReactNode => | ||
`Your received a bid of ${mana} MANA was accepted for ${nftName}`, | ||
title: 'Bid Received' | ||
}, | ||
es: { description: ( | ||
mana: React.ReactNode, | ||
nftName: React.ReactNode | ||
): React.ReactNode => | ||
`Recibiste una oferta de ${mana} MANA para ${nftName}`, title: 'Oferta aceptada' }, | ||
zh: { description: ( | ||
mana: React.ReactNode, | ||
nftName: React.ReactNode | ||
): React.ReactNode => `您为 ${nftName} 出价 ${mana} MANA 已被接受` , title: '收到的投标' } | ||
} | ||
|
||
const BidReceivedNotification = ({ | ||
notification, | ||
locale | ||
}: BidReceivedNotificationProps) => { | ||
return ( | ||
<NotificationItem | ||
image={{ | ||
imageLink: notification.metadata.image, | ||
rarity: notification.metadata.rarity, | ||
icon: <BidAccepted /> | ||
}} | ||
timestamp={notification.timestamp} | ||
isNew={!notification.read} | ||
> | ||
<p className="dcl notification-item__content__title"> | ||
{i18N[locale].title} | ||
</p> | ||
<p className="dcl notification-item__content__description"> | ||
{i18N[locale].description}{' '} | ||
<span> | ||
<a | ||
href={notification.metadata.link} | ||
style={{ | ||
color: `${Rarity.getColor(notification.metadata.rarity)}`, | ||
textDecoration: 'underline' | ||
}} | ||
> | ||
{notification.metadata.nftName} | ||
</a> | ||
</span> | ||
</p> | ||
</NotificationItem> | ||
) | ||
} | ||
|
||
export default BidReceivedNotification |
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
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