Skip to content

Commit

Permalink
change union for enum
Browse files Browse the repository at this point in the history
  • Loading branch information
lauti7 committed Dec 7, 2023
1 parent 2f170cc commit 1f130b8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
6 changes: 3 additions & 3 deletions src/components/Notifications/Notifications.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useMemo } from 'react'

import NotificationsFeed from './NotificationsFeed'
import { ActiveTab, DCLNotification, NotificationLocale } from './types'
import { NotificationActiveTab, DCLNotification, NotificationLocale } from './types'

import NotificationBell from '../Icons/Notifications/NotificationBell'
import NotificationBellActive from '../Icons/Notifications/NotificationBellActive'
Expand All @@ -15,11 +15,11 @@ export interface NotificationsProps {
isLoading: boolean
locale: NotificationLocale
isOnboarding: boolean
activeTab: ActiveTab
activeTab: NotificationActiveTab
onClick: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void
onChangeTab: (
e: React.MouseEvent<HTMLDivElement, MouseEvent>,
newActiveTab: ActiveTab
newActiveTab: NotificationActiveTab
) => void
onBegin: (e: React.MouseEvent<HTMLButtonElement>) => void
onClose: (
Expand Down
18 changes: 9 additions & 9 deletions src/components/Notifications/NotificationsFeed.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useEffect, useMemo } from 'react'

import { Loader } from '../Loader/Loader'
import { ActiveTab, DCLNotification, NotificationLocale } from './types'
import { NotificationActiveTab, DCLNotification, NotificationLocale } from './types'

import ItemSoldNotification from './NotificationTypes/ItemSoldNotification'
import RoyaltiesEarnedNotification from './NotificationTypes/RoyaltiesEarnedNotification'
Expand All @@ -23,11 +23,11 @@ interface NotificationsFeedProps {
isLoading: boolean
locale: NotificationLocale
isOnboarding: boolean
activeTab: ActiveTab
activeTab: NotificationActiveTab
isOpen: boolean
onChangeTab: (
e: React.MouseEvent<HTMLDivElement, MouseEvent>,
newActiveTab: ActiveTab
newActiveTab: NotificationActiveTab
) => void
onBegin: (e: React.MouseEvent<HTMLButtonElement>) => void
onClose: (
Expand Down Expand Up @@ -327,10 +327,10 @@ const Feed = ({
previousNotifications: DCLNotification[]
readNotifications: DCLNotification[]
locale: NotificationLocale
activeTab: ActiveTab
activeTab: NotificationActiveTab
onChangeTab: (
e: React.MouseEvent<HTMLDivElement, MouseEvent>,
newActiveTab: ActiveTab
newActiveTab: NotificationActiveTab
) => void
}) => (
<>
Expand All @@ -340,14 +340,14 @@ const Feed = ({
<div className="dcl notifications-feed__content">
<Tabs className="notifications-feed__tabs">
<Tabs.Tab
active={activeTab === 'newest'}
onClick={(e) => onChangeTab(e, 'newest')}
active={activeTab === NotificationActiveTab.NEWEST}
onClick={(e) => onChangeTab(e, NotificationActiveTab.NEWEST)}
>
{i18N[locale].feed.tabs.newest}
</Tabs.Tab>
<Tabs.Tab
active={activeTab === 'read'}
onClick={(e) => onChangeTab(e, 'read')}
active={activeTab === NotificationActiveTab.READ}
onClick={(e) => onChangeTab(e, NotificationActiveTab.READ)}
>
{i18N[locale].feed.tabs.read}
</Tabs.Tab>
Expand Down
5 changes: 4 additions & 1 deletion src/components/Notifications/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { NFTCategory, Rarity } from '@dcl/schemas'

export type ActiveTab = 'newest' | 'read'
export enum NotificationActiveTab {
NEWEST = "newest",
READ = "read"
}

export type NotificationLocale = 'en' | 'es' | 'zh'

Expand Down

0 comments on commit 1f130b8

Please sign in to comment.