feat: allow clicking the logo to go home (#636)

This commit is contained in:
Alex Gleason
2025-10-31 01:27:25 -05:00
committed by GitHub
parent 98bc077bb5
commit f5ea1ce69e

View File

@@ -1,6 +1,7 @@
import Icon from '@/assets/Icon'
import Logo from '@/assets/Logo'
import { cn } from '@/lib/utils'
import { usePrimaryPage } from '@/PageManager'
import { useNostr } from '@/providers/NostrProvider'
import { useScreenSize } from '@/providers/ScreenSizeProvider'
import { useTheme } from '@/providers/ThemeProvider'
@@ -22,6 +23,7 @@ export default function PrimaryPageSidebar() {
const { themeSetting } = useTheme()
const { sidebarCollapse, updateSidebarCollapse, enableSingleColumnLayout } = useUserPreferences()
const { pubkey } = useNostr()
const { navigate } = usePrimaryPage()
if (isSmallScreen) return null
@@ -34,13 +36,21 @@ export default function PrimaryPageSidebar() {
>
<div className="space-y-2">
{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 />
</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 />
</div>
</button>
)}
<HomeButton collapse={sidebarCollapse} />
<RelaysButton collapse={sidebarCollapse} />