Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/web/src/components/nav/desktop/LeftNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
MessagesNavItem,
WalletNavItem,
RewardsNavItem,
DashboardNavItem,
UploadNavItem,
DevToolsNavItem,
PlaylistsNavItem,
Expand Down Expand Up @@ -120,6 +121,7 @@ export const LeftNav = (props: OwnProps) => {
<WalletNavItem />
<ArtistCoinsNavItem />
<RewardsNavItem />
<DashboardNavItem />
<UploadNavItem />
<DevToolsNavItem />
<Box mv='s'>
Expand Down
17 changes: 1 addition & 16 deletions packages/web/src/components/nav/desktop/NavHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { route } from '@audius/common/utils'
import {
Flex,
IconAudiusLogoHorizontalNew,
IconDashboard,
IconSettings
} from '@audius/harmony'
import { Link } from 'react-router'
Expand All @@ -19,11 +18,10 @@ import { RestrictionType, useRequiresAccountFn } from 'hooks/useRequiresAccount'
import { NavHeaderButton } from './NavHeaderButton'
import { NotificationsButton } from './NotificationsButton'

const { HOME_PAGE, SETTINGS_PAGE, DASHBOARD_PAGE } = route
const { HOME_PAGE, SETTINGS_PAGE } = route

const messages = {
homeLink: 'Go to Home',
dashboardLabel: 'Go to Dashboard',
settingsLabel: 'Go to Settings'
}

Expand Down Expand Up @@ -72,10 +70,6 @@ const RestrictedLink = ({
}

export const NavHeader = () => {
const { data: trackCount } = useCurrentAccountUser({
select: (user) => user?.track_count
})

return (
<Flex
alignItems='center'
Expand All @@ -90,15 +84,6 @@ export const NavHeader = () => {
<IconAudiusLogoHorizontalNew color='subdued' size='m' width='auto' />
</Link>
<Flex justifyContent='center' alignItems='center'>
{trackCount ? (
<RestrictedLink to={DASHBOARD_PAGE} restriction='account'>
<NavHeaderButton
icon={IconDashboard}
aria-label={messages.dashboardLabel}
isActive={location.pathname === DASHBOARD_PAGE}
/>
</RestrictedLink>
) : null}
<RestrictedLink to={SETTINGS_PAGE} restriction='account'>
<NavHeaderButton
icon={IconSettings}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import React from 'react'

import { useCurrentAccountUser, useHasAccount } from '@audius/common/api'
import { route } from '@audius/common/utils'
import { IconDashboard } from '@audius/harmony'

import { LeftNavLink } from '../LeftNavLink'

const { DASHBOARD_PAGE } = route

export const DashboardNavItem = () => {
const hasAccount = useHasAccount()
const { data: trackCount } = useCurrentAccountUser({
select: (user) => user?.track_count
})

return trackCount ? (
<LeftNavLink
leftIcon={IconDashboard}
to={DASHBOARD_PAGE}
disabled={!hasAccount}
restriction='account'
>
Dashboard
</LeftNavLink>
) : null
}
1 change: 1 addition & 0 deletions packages/web/src/components/nav/desktop/nav-items/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export { LibraryNavItem } from './LibraryNavItem'
export { MessagesNavItem } from './MessagesNavItem'
export { WalletNavItem } from './WalletNavItem'
export { RewardsNavItem } from './RewardsNavItem'
export { DashboardNavItem } from './DashboardNavItem'
export { UploadNavItem } from './UploadNavItem'
export { DevToolsNavItem } from './DevToolsNavItem'
export { PlaylistsNavItem } from './PlaylistsNavItem'
Expand Down
Loading