feat: improve single-column layout

This commit is contained in:
codytseng 2025-10-19 18:41:22 +08:00
parent 1674671d7f
commit 936b15e5c2
13 changed files with 316 additions and 231 deletions

View file

@ -1,13 +1,21 @@
import { toSettings } from '@/lib/link'
import { useSecondaryPage } from '@/PageManager'
import { usePrimaryPage, useSecondaryPage } from '@/PageManager'
import { useUserPreferences } from '@/providers/UserPreferencesProvider'
import { Settings } from 'lucide-react'
import SidebarItem from './SidebarItem'
export default function SettingsButton({ collapse }: { collapse: boolean }) {
const { current, navigate } = usePrimaryPage()
const { push } = useSecondaryPage()
const { enableSingleColumnLayout } = useUserPreferences()
return (
<SidebarItem title="Settings" onClick={() => push(toSettings())} collapse={collapse}>
<SidebarItem
title="Settings"
onClick={() => (enableSingleColumnLayout ? navigate('settings') : push(toSettings()))}
collapse={collapse}
active={enableSingleColumnLayout ? current === 'settings' : false}
>
<Settings />
</SidebarItem>
)