Skip to content

Commit

Permalink
fix: prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
lauti7 committed Nov 30, 2023
1 parent 99b5d63 commit f450ba8
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 77 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ interface RoyaltiesEarnedNotificationProps {

const i18N = {
en: {
description_1: `You earned `,
description_1: `You earned `,
description_2: `for selling `,
title: 'Royalties Earned'
},
es: {
description_1: `Ganaste `,
description_1: `Ganaste `,
description_2: `por vender `,
title: 'Regalias ganadas'
},
zh: {
description_1: `您通过出售 `,
description_1: `您通过出售 `,
description_2: `赚取了 `,
title: '所得版税'
}
Expand Down Expand Up @@ -51,28 +51,28 @@ const RoyaltiesEarnedNotification = ({
<p className="dcl notification-item__content__title">
{i18N[locale].title}
</p>
{
locale == "zh" ?
(
<p className="dcl notification-item__content__description">
{i18N[locale].description_1}
<span>
<a
href={notification.metadata.link}
style={{
color: `${Rarity.getColor(notification.metadata.rarity)}`,
textDecoration: 'underline'
}}
>
{notification.metadata.nftName}
</a>
</span>
{' '}{i18N[locale].description_2}{Number(notification.metadata.royaltiesCut)}
</p>
) :
{locale == 'zh' ? (
<p className="dcl notification-item__content__description">
{i18N[locale].description_1}{Number(notification.metadata.royaltiesCut)}
{' '}{i18N[locale].description_2}
{i18N[locale].description_1}
<span>
<a
href={notification.metadata.link}
style={{
color: `${Rarity.getColor(notification.metadata.rarity)}`,
textDecoration: 'underline'
}}
>
{notification.metadata.nftName}
</a>
</span>{' '}
{i18N[locale].description_2}
{Number(notification.metadata.royaltiesCut)}
</p>
) : (
<p className="dcl notification-item__content__description">
{i18N[locale].description_1}
{Number(notification.metadata.royaltiesCut)}{' '}
{i18N[locale].description_2}
<span>
<a
href={notification.metadata.link}
Expand All @@ -85,7 +85,7 @@ const RoyaltiesEarnedNotification = ({
</a>
</span>
</p>
}
)}
</NotificationItem>
)
}
Expand Down
63 changes: 32 additions & 31 deletions src/components/Notifications/Notifications.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ storiesOf('Notifications Toggle', module)
rarity: 'epic' as Rarity,
seller: '0x8bc619e7f9ca9949b8440245fd9d8c4c002edf02',
nftName: 'Green Atari Tee',
network: "ethereum",
category: "wearable" as NFTCategory
network: 'ethereum',
category: 'wearable' as NFTCategory
},
created_at: "2023-11-29T12:51:00.600Z",
updated_at: "2023-11-29T12:51:00.600Z"
created_at: '2023-11-29T12:51:00.600Z',
updated_at: '2023-11-29T12:51:00.600Z'
}
]}
locale="en"
Expand Down Expand Up @@ -79,11 +79,11 @@ storiesOf('Notifications Toggle', module)
rarity: 'epic' as Rarity,
seller: '0x8bc619e7f9ca9949b8440245fd9d8c4c002edf02',
nftName: 'Green Atari Tee',
network: "ethereum",
category: "wearable" as NFTCategory
network: 'ethereum',
category: 'wearable' as NFTCategory
},
created_at: "2023-11-29T12:51:00.600Z",
updated_at: "2023-11-29T12:51:00.600Z"
created_at: '2023-11-29T12:51:00.600Z',
updated_at: '2023-11-29T12:51:00.600Z'
}
]}
activeTab="newest"
Expand All @@ -106,21 +106,22 @@ storiesOf('Notifications Toggle', module)
userNotifications={[
{
read: false,
type: "royalties_earned",
type: 'royalties_earned',
address: '0xA',
timestamp: 1701198655 * 1000,
metadata: {
link: "https://market.decentraland.zone/contracts/0xb726634ed82ac04e6bca66b3b97cc41a2c10ec31/tokens/9",
image: 'https://peer.decentraland.org/lambdas/collections/contents/urn:decentraland:ethereum:collections-v1:binance_us_collection:binance_us_upper_body/thumbnail',
rarity: "common" as Rarity,
network: "polygon",
nftName: "NJacket",
category: "wearable" as NFTCategory,
royaltiesCut: "0.3",
royaltiesCollector: "0x2a39d4f68133491f0442496f601cde2a945b6d31"
link: 'https://market.decentraland.zone/contracts/0xb726634ed82ac04e6bca66b3b97cc41a2c10ec31/tokens/9',
image:
'https://peer.decentraland.org/lambdas/collections/contents/urn:decentraland:ethereum:collections-v1:binance_us_collection:binance_us_upper_body/thumbnail',
rarity: 'common' as Rarity,
network: 'polygon',
nftName: 'NJacket',
category: 'wearable' as NFTCategory,
royaltiesCut: '0.3',
royaltiesCollector: '0x2a39d4f68133491f0442496f601cde2a945b6d31'
},
created_at: "2023-11-29T12:51:00.600Z",
updated_at: "2023-11-29T12:51:00.600Z"
created_at: '2023-11-29T12:51:00.600Z',
updated_at: '2023-11-29T12:51:00.600Z'
},
{
read: true,
Expand All @@ -134,11 +135,11 @@ storiesOf('Notifications Toggle', module)
rarity: 'uncommon' as Rarity,
seller: '0x6b347a82fcac4e6a38d1fc40e3631bd8f9495e9f',
nftName: 'Binance US Hoodie',
network: "ethereum",
category: "wearable" as NFTCategory
network: 'ethereum',
category: 'wearable' as NFTCategory
},
created_at: "2023-11-29T12:51:00.600Z",
updated_at: "2023-11-29T12:51:00.600Z"
created_at: '2023-11-29T12:51:00.600Z',
updated_at: '2023-11-29T12:51:00.600Z'
},
{
read: true,
Expand All @@ -152,11 +153,11 @@ storiesOf('Notifications Toggle', module)
rarity: 'uncommon' as Rarity,
seller: '0x6b347a82fcac4e6a38d1fc40e3631bd8f9495e9f',
nftName: 'Binance US Hoodie',
network: "ethereum",
category: "wearable" as NFTCategory
network: 'ethereum',
category: 'wearable' as NFTCategory
},
created_at: "2023-11-29T12:51:00.600Z",
updated_at: "2023-11-29T12:51:00.600Z"
created_at: '2023-11-29T12:51:00.600Z',
updated_at: '2023-11-29T12:51:00.600Z'
},
{
read: true,
Expand All @@ -170,11 +171,11 @@ storiesOf('Notifications Toggle', module)
rarity: 'uncommon' as Rarity,
seller: '0x6b347a82fcac4e6a38d1fc40e3631bd8f9495e9f',
nftName: 'Binance US Hoodie',
network: "ethereum",
category: "wearable" as NFTCategory
network: 'ethereum',
category: 'wearable' as NFTCategory
},
created_at: "2023-11-29T12:51:00.600Z",
updated_at: "2023-11-29T12:51:00.600Z"
created_at: '2023-11-29T12:51:00.600Z',
updated_at: '2023-11-29T12:51:00.600Z'
}
]}
activeTab="newest"
Expand Down
58 changes: 37 additions & 21 deletions src/components/Notifications/NotificationsFeed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,22 +85,25 @@ const i18N = {
}
}

const NotificationHandler = ({ locale, notification }: { notification: DCLNotification, locale: NotificationLocale }) => {
const NotificationHandler = ({
locale,
notification
}: {
notification: DCLNotification
locale: NotificationLocale
}) => {
switch (notification.type) {
case 'item_sold':
return (
<ItemSoldNotification
notification={notification}
locale={locale}
/>
)
case 'royalties_earned':
return (
<RoyaltiesEarnedNotification
notification={notification}
locale={locale}
/>
)
<ItemSoldNotification notification={notification} locale={locale} />
)
case 'royalties_earned':
return (
<RoyaltiesEarnedNotification
notification={notification}
locale={locale}
/>
)
default:
return null
}
Expand Down Expand Up @@ -190,11 +193,15 @@ export default function NotificationsFeed({
{activeTab == 'newest' ? (
<>
<div>
{unreadNotifications.map((notification) => <NotificationHandler notification={notification} locale={locale} /> )}
{unreadNotifications.map((notification) => (
<NotificationHandler
notification={notification}
locale={locale}
/>
))}
</div>
{
previousNotifications.length > 0 && (
<div>
{previousNotifications.length > 0 && (
<div>
<p
style={{
fontSize: '16px',
Expand All @@ -205,14 +212,23 @@ export default function NotificationsFeed({
>
Previous
</p>
{previousNotifications.map((notification) => <NotificationHandler notification={notification} locale={locale} />)}
{previousNotifications.map((notification) => (
<NotificationHandler
notification={notification}
locale={locale}
/>
))}
</div>
)
}
)}
</>
) : (
<>
{readNotifications.map((notification) => <NotificationHandler notification={notification} locale={locale} />)}
{readNotifications.map((notification) => (
<NotificationHandler
notification={notification}
locale={locale}
/>
))}
</>
)}
</div>
Expand Down

0 comments on commit f450ba8

Please sign in to comment.