fix: update sidebar button active state logic
This commit is contained in:
@@ -4,14 +4,14 @@ import { Bookmark } from 'lucide-react'
|
|||||||
import SidebarItem from './SidebarItem'
|
import SidebarItem from './SidebarItem'
|
||||||
|
|
||||||
export default function BookmarkButton({ collapse }: { collapse: boolean }) {
|
export default function BookmarkButton({ collapse }: { collapse: boolean }) {
|
||||||
const { navigate, current } = usePrimaryPage()
|
const { navigate, current, display } = usePrimaryPage()
|
||||||
const { checkLogin } = useNostr()
|
const { checkLogin } = useNostr()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SidebarItem
|
<SidebarItem
|
||||||
title="Bookmarks"
|
title="Bookmarks"
|
||||||
onClick={() => checkLogin(() => navigate('bookmark'))}
|
onClick={() => checkLogin(() => navigate('bookmark'))}
|
||||||
active={current === 'bookmark'}
|
active={display && current === 'bookmark'}
|
||||||
collapse={collapse}
|
collapse={collapse}
|
||||||
>
|
>
|
||||||
<Bookmark />
|
<Bookmark />
|
||||||
|
|||||||
@@ -5,13 +5,13 @@ import SidebarItem from './SidebarItem'
|
|||||||
|
|
||||||
export default function RelaysButton({ collapse }: { collapse: boolean }) {
|
export default function RelaysButton({ collapse }: { collapse: boolean }) {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const { navigate, current } = usePrimaryPage()
|
const { navigate, current, display } = usePrimaryPage()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SidebarItem
|
<SidebarItem
|
||||||
title={t('Explore')}
|
title={t('Explore')}
|
||||||
onClick={() => navigate('explore')}
|
onClick={() => navigate('explore')}
|
||||||
active={current === 'explore'}
|
active={display && current === 'explore'}
|
||||||
collapse={collapse}
|
collapse={collapse}
|
||||||
>
|
>
|
||||||
<Compass />
|
<Compass />
|
||||||
|
|||||||
@@ -3,13 +3,13 @@ import { Home } from 'lucide-react'
|
|||||||
import SidebarItem from './SidebarItem'
|
import SidebarItem from './SidebarItem'
|
||||||
|
|
||||||
export default function HomeButton({ collapse }: { collapse: boolean }) {
|
export default function HomeButton({ collapse }: { collapse: boolean }) {
|
||||||
const { navigate, current } = usePrimaryPage()
|
const { navigate, current, display } = usePrimaryPage()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SidebarItem
|
<SidebarItem
|
||||||
title="Home"
|
title="Home"
|
||||||
onClick={() => navigate('home')}
|
onClick={() => navigate('home')}
|
||||||
active={current === 'home'}
|
active={display && current === 'home'}
|
||||||
collapse={collapse}
|
collapse={collapse}
|
||||||
>
|
>
|
||||||
<Home />
|
<Home />
|
||||||
|
|||||||
@@ -6,14 +6,14 @@ import SidebarItem from './SidebarItem'
|
|||||||
|
|
||||||
export default function NotificationsButton({ collapse }: { collapse: boolean }) {
|
export default function NotificationsButton({ collapse }: { collapse: boolean }) {
|
||||||
const { checkLogin } = useNostr()
|
const { checkLogin } = useNostr()
|
||||||
const { navigate, current } = usePrimaryPage()
|
const { navigate, current, display } = usePrimaryPage()
|
||||||
const { hasNewNotification } = useNotification()
|
const { hasNewNotification } = useNotification()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SidebarItem
|
<SidebarItem
|
||||||
title="Notifications"
|
title="Notifications"
|
||||||
onClick={() => checkLogin(() => navigate('notifications'))}
|
onClick={() => checkLogin(() => navigate('notifications'))}
|
||||||
active={current === 'notifications'}
|
active={display && current === 'notifications'}
|
||||||
collapse={collapse}
|
collapse={collapse}
|
||||||
>
|
>
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
|
|||||||
@@ -4,14 +4,14 @@ import { UserRound } from 'lucide-react'
|
|||||||
import SidebarItem from './SidebarItem'
|
import SidebarItem from './SidebarItem'
|
||||||
|
|
||||||
export default function ProfileButton({ collapse }: { collapse: boolean }) {
|
export default function ProfileButton({ collapse }: { collapse: boolean }) {
|
||||||
const { navigate, current } = usePrimaryPage()
|
const { navigate, current, display } = usePrimaryPage()
|
||||||
const { checkLogin } = useNostr()
|
const { checkLogin } = useNostr()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SidebarItem
|
<SidebarItem
|
||||||
title="Profile"
|
title="Profile"
|
||||||
onClick={() => checkLogin(() => navigate('profile'))}
|
onClick={() => checkLogin(() => navigate('profile'))}
|
||||||
active={current === 'profile'}
|
active={display && current === 'profile'}
|
||||||
collapse={collapse}
|
collapse={collapse}
|
||||||
>
|
>
|
||||||
<UserRound />
|
<UserRound />
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { Settings } from 'lucide-react'
|
|||||||
import SidebarItem from './SidebarItem'
|
import SidebarItem from './SidebarItem'
|
||||||
|
|
||||||
export default function SettingsButton({ collapse }: { collapse: boolean }) {
|
export default function SettingsButton({ collapse }: { collapse: boolean }) {
|
||||||
const { current, navigate } = usePrimaryPage()
|
const { current, navigate, display } = usePrimaryPage()
|
||||||
const { push } = useSecondaryPage()
|
const { push } = useSecondaryPage()
|
||||||
const { enableSingleColumnLayout } = useUserPreferences()
|
const { enableSingleColumnLayout } = useUserPreferences()
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ export default function SettingsButton({ collapse }: { collapse: boolean }) {
|
|||||||
title="Settings"
|
title="Settings"
|
||||||
onClick={() => (enableSingleColumnLayout ? navigate('settings') : push(toSettings()))}
|
onClick={() => (enableSingleColumnLayout ? navigate('settings') : push(toSettings()))}
|
||||||
collapse={collapse}
|
collapse={collapse}
|
||||||
active={current === 'settings'}
|
active={display && current === 'settings'}
|
||||||
>
|
>
|
||||||
<Settings />
|
<Settings />
|
||||||
</SidebarItem>
|
</SidebarItem>
|
||||||
|
|||||||
Reference in New Issue
Block a user