BookmarkButton.tsx raw
1 import { usePrimaryPage } from '@/PageManager'
2 import { useKeyboardNavigation } from '@/providers/KeyboardNavigationProvider'
3 import { useNostr } from '@/providers/NostrProvider'
4 import { Library } from 'lucide-react'
5 import SidebarItem from './SidebarItem'
6
7 export default function BookmarkButton({ collapse, navIndex }: { collapse: boolean; navIndex?: number }) {
8 const { navigate, current, display } = usePrimaryPage()
9 const { checkLogin } = useNostr()
10 const { clearColumn } = useKeyboardNavigation()
11
12 const handleClick = () => {
13 checkLogin(() => {
14 navigate('bookmark')
15 clearColumn(1)
16 })
17 }
18
19 return (
20 <SidebarItem
21 title="Library"
22 onClick={handleClick}
23 active={display && current === 'bookmark'}
24 collapse={collapse}
25 navIndex={navIndex}
26 >
27 <Library />
28 </SidebarItem>
29 )
30 }
31