From 26ccb8b3216c6eb72628ab3b4c8474630787f5e4 Mon Sep 17 00:00:00 2001 From: WRadoslaw Date: Mon, 6 May 2024 18:44:20 +0200 Subject: [PATCH] Linter --- .../src/components/_navigation/BottomNav/BottomNav.tsx | 2 +- packages/atlas/src/utils/ypp.ts | 2 +- .../atlas/src/views/studio/CrtDashboard/CrtDashboard.tsx | 4 ++-- .../atlas/src/views/studio/YppDashboard/YppDashboard.tsx | 2 +- .../src/views/viewer/ChannelView/ChannelView.styles.ts | 2 +- packages/atlas/src/views/viewer/ChannelView/ChannelView.tsx | 6 +++--- .../src/views/viewer/MarketplaceView/MarketplaceView.tsx | 4 ++-- packages/atlas/src/views/viewer/MemberView/MemberView.tsx | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/atlas/src/components/_navigation/BottomNav/BottomNav.tsx b/packages/atlas/src/components/_navigation/BottomNav/BottomNav.tsx index 8a6c7a7e23..86f2394369 100644 --- a/packages/atlas/src/components/_navigation/BottomNav/BottomNav.tsx +++ b/packages/atlas/src/components/_navigation/BottomNav/BottomNav.tsx @@ -8,7 +8,7 @@ import { transitions } from '@/styles' import { Container, NavLink, NavTitle } from './BottomNav.styles' -const Link: FC = ({ to, icon, name }) => { +const Link: FC<(typeof viewerNavItems)[number]> = ({ to, icon, name }) => { const match = useMatch(to) return ( diff --git a/packages/atlas/src/utils/ypp.ts b/packages/atlas/src/utils/ypp.ts index d7b8f83383..5b486c2a83 100644 --- a/packages/atlas/src/utils/ypp.ts +++ b/packages/atlas/src/utils/ypp.ts @@ -2,7 +2,7 @@ import { atlasConfig } from '@/config' import { YppChannelStatus } from '@/views/global/YppLandingView/YppLandingView.types' const configTiers = atlasConfig.features.ypp.tiersDefinition -type ConfigTier = typeof configTiers[number]['tier'] +type ConfigTier = (typeof configTiers)[number]['tier'] export const yppBackendTierToConfig = (beTier?: YppChannelStatus): ConfigTier | undefined => { switch (beTier) { diff --git a/packages/atlas/src/views/studio/CrtDashboard/CrtDashboard.tsx b/packages/atlas/src/views/studio/CrtDashboard/CrtDashboard.tsx index 68944bda98..105e7665e4 100644 --- a/packages/atlas/src/views/studio/CrtDashboard/CrtDashboard.tsx +++ b/packages/atlas/src/views/studio/CrtDashboard/CrtDashboard.tsx @@ -31,14 +31,14 @@ import { CrtRevenueTab } from '@/views/studio/CrtDashboard/tabs/CrtRevenueTab' import { TABS } from './CrtDashboard.types' -type TabsNames = typeof TABS[number] +type TabsNames = (typeof TABS)[number] const getTabIndex = (tabName: TabsNames, allTabs: { name: TabsNames }[]): number => allTabs.findIndex((tab) => tab.name === tabName) export const CrtDashboard = () => { const [searchParams, setSearchParams] = useSearchParams() - const currentTabName = searchParams.get('tab') as typeof TABS[number] | null + const currentTabName = searchParams.get('tab') as (typeof TABS)[number] | null const { activeChannel, memberId } = useUser() const { data } = useGetFullCreatorTokenQuery({ variables: { diff --git a/packages/atlas/src/views/studio/YppDashboard/YppDashboard.tsx b/packages/atlas/src/views/studio/YppDashboard/YppDashboard.tsx index 6c491feea6..e7209c14d3 100644 --- a/packages/atlas/src/views/studio/YppDashboard/YppDashboard.tsx +++ b/packages/atlas/src/views/studio/YppDashboard/YppDashboard.tsx @@ -17,7 +17,7 @@ import { Header, TabsWrapper } from './YppDashboard.styles' import { YppDashboardMainTab, YppDashboardSettingsTab } from './tabs' const TABS = ['Dashboard', 'Referrals', 'Settings'] as const -type Tab = typeof TABS[number] +type Tab = (typeof TABS)[number] export const YppDashboard: FC = () => { const headTags = useHeadTags('Creator Rewards') diff --git a/packages/atlas/src/views/viewer/ChannelView/ChannelView.styles.ts b/packages/atlas/src/views/viewer/ChannelView/ChannelView.styles.ts index f107335783..881634190a 100644 --- a/packages/atlas/src/views/viewer/ChannelView/ChannelView.styles.ts +++ b/packages/atlas/src/views/viewer/ChannelView/ChannelView.styles.ts @@ -167,7 +167,7 @@ export const TabsWrapper = styled.div<{ isFiltersOpen: boolean }>` ` type TabsContainerProps = { - tab: typeof TABS[number] + tab: (typeof TABS)[number] } const geTabsContainerGridTemplate = ({ tab }: TabsContainerProps) => { diff --git a/packages/atlas/src/views/viewer/ChannelView/ChannelView.tsx b/packages/atlas/src/views/viewer/ChannelView/ChannelView.tsx index dd7c6cd792..655f2a783a 100644 --- a/packages/atlas/src/views/viewer/ChannelView/ChannelView.tsx +++ b/packages/atlas/src/views/viewer/ChannelView/ChannelView.tsx @@ -66,7 +66,7 @@ export const INITIAL_TILES_PER_ROW = 4 export const ChannelView: FC = () => { const [searchParams, setSearchParams] = useSearchParams() const [tilesPerRow, setTilesPerRow] = useState(INITIAL_TILES_PER_ROW) - const currentTabName = searchParams.get('tab') as typeof TABS[number] | null + const currentTabName = searchParams.get('tab') as (typeof TABS)[number] | null const videoRows = useVideoGridRows('main') const { trackPageView } = useSegmentAnalytics() const navigate = useNavigate() @@ -134,7 +134,7 @@ export const ChannelView: FC = () => { const { channelNftCollectors } = useChannelNftCollectors({ channelId: id || '' }) const { toggleFollowing, isFollowing } = useHandleFollowChannel(id, channel?.title) - const [currentTab, setCurrentTab] = useState(filteredTabs[0]) + const [currentTab, setCurrentTab] = useState<(typeof TABS)[number]>(filteredTabs[0]) const { url: avatarPhotoUrl } = useGetAssetUrl(channel?.avatarPhoto?.resolvedUrls, 'avatar') @@ -188,7 +188,7 @@ export const ChannelView: FC = () => { const mappedTabs = filteredTabs.map((tab) => ({ name: tab, badgeNumber: 0 })) - const getChannelContent = (tab: typeof TABS[number]) => { + const getChannelContent = (tab: (typeof TABS)[number]) => { switch (tab) { case 'Videos': return ( diff --git a/packages/atlas/src/views/viewer/MarketplaceView/MarketplaceView.tsx b/packages/atlas/src/views/viewer/MarketplaceView/MarketplaceView.tsx index 9b0d5be9f4..31d57ed63e 100644 --- a/packages/atlas/src/views/viewer/MarketplaceView/MarketplaceView.tsx +++ b/packages/atlas/src/views/viewer/MarketplaceView/MarketplaceView.tsx @@ -22,7 +22,7 @@ const TABS = [ icon: , }, ] as const -type TabsNames = typeof TABS[number]['name'] +type TabsNames = (typeof TABS)[number]['name'] const getTabIndex = (tabName: TabsNames, allTabs: typeof TABS): number => allTabs.findIndex((tab) => tab.name === tabName) @@ -30,7 +30,7 @@ const getTabIndex = (tabName: TabsNames, allTabs: typeof TABS): number => export const MarketplaceView: FC = () => { const smMatch = useMediaMatch('sm') const [searchParams, setSearchParams] = useSearchParams() - const currentTabName = searchParams.get('tab') as typeof TABS[number]['name'] | null + const currentTabName = searchParams.get('tab') as (typeof TABS)[number]['name'] | null const currentTab = currentTabName ? getTabIndex(currentTabName, TABS) : 0 useMountEffect(() => { diff --git a/packages/atlas/src/views/viewer/MemberView/MemberView.tsx b/packages/atlas/src/views/viewer/MemberView/MemberView.tsx index 85d4994fd0..4ce28409e5 100644 --- a/packages/atlas/src/views/viewer/MemberView/MemberView.tsx +++ b/packages/atlas/src/views/viewer/MemberView/MemberView.tsx @@ -49,7 +49,7 @@ export const MemberView: FC = () => { NftActivityOrderByInput.EventTimestampDesc ) const navigate = useNavigate() - const [currentTab, setCurrentTab] = useState(null) + const [currentTab, setCurrentTab] = useState<(typeof TABS)[number] | null>(null) const { memberId } = useUser() const { handle, id } = useParams() const headTags = useHeadTags(handle)