feat: allow clicking the logo to go home (#636)
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import Icon from '@/assets/Icon'
|
import Icon from '@/assets/Icon'
|
||||||
import Logo from '@/assets/Logo'
|
import Logo from '@/assets/Logo'
|
||||||
import { cn } from '@/lib/utils'
|
import { cn } from '@/lib/utils'
|
||||||
|
import { usePrimaryPage } from '@/PageManager'
|
||||||
import { useNostr } from '@/providers/NostrProvider'
|
import { useNostr } from '@/providers/NostrProvider'
|
||||||
import { useScreenSize } from '@/providers/ScreenSizeProvider'
|
import { useScreenSize } from '@/providers/ScreenSizeProvider'
|
||||||
import { useTheme } from '@/providers/ThemeProvider'
|
import { useTheme } from '@/providers/ThemeProvider'
|
||||||
@@ -22,6 +23,7 @@ export default function PrimaryPageSidebar() {
|
|||||||
const { themeSetting } = useTheme()
|
const { themeSetting } = useTheme()
|
||||||
const { sidebarCollapse, updateSidebarCollapse, enableSingleColumnLayout } = useUserPreferences()
|
const { sidebarCollapse, updateSidebarCollapse, enableSingleColumnLayout } = useUserPreferences()
|
||||||
const { pubkey } = useNostr()
|
const { pubkey } = useNostr()
|
||||||
|
const { navigate } = usePrimaryPage()
|
||||||
|
|
||||||
if (isSmallScreen) return null
|
if (isSmallScreen) return null
|
||||||
|
|
||||||
@@ -34,13 +36,21 @@ export default function PrimaryPageSidebar() {
|
|||||||
>
|
>
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
{sidebarCollapse ? (
|
{sidebarCollapse ? (
|
||||||
<div className="px-3 py-1 mb-6 w-full">
|
<button
|
||||||
|
className="px-3 py-1 mb-4 w-full cursor-pointer hover:opacity-80 transition-opacity"
|
||||||
|
onClick={() => navigate('home')}
|
||||||
|
aria-label="Go to home"
|
||||||
|
>
|
||||||
<Icon />
|
<Icon />
|
||||||
</div>
|
</button>
|
||||||
) : (
|
) : (
|
||||||
<div className="px-4 mb-6 w-full">
|
<button
|
||||||
|
className="px-4 mb-4 w-full cursor-pointer hover:opacity-80 transition-opacity"
|
||||||
|
onClick={() => navigate('home')}
|
||||||
|
aria-label="Go to home"
|
||||||
|
>
|
||||||
<Logo />
|
<Logo />
|
||||||
</div>
|
</button>
|
||||||
)}
|
)}
|
||||||
<HomeButton collapse={sidebarCollapse} />
|
<HomeButton collapse={sidebarCollapse} />
|
||||||
<RelaysButton collapse={sidebarCollapse} />
|
<RelaysButton collapse={sidebarCollapse} />
|
||||||
|
|||||||
Reference in New Issue
Block a user