refactor: move bookmarks entry location
This commit is contained in:
parent
a847c4dc56
commit
5c2a016d4b
13 changed files with 95 additions and 69 deletions
|
|
@ -4,7 +4,7 @@ import { SecondaryPageLink } from '@/PageManager'
|
|||
import { useFavoriteRelays } from '@/providers/FavoriteRelaysProvider'
|
||||
import { useFeed } from '@/providers/FeedProvider'
|
||||
import { useNostr } from '@/providers/NostrProvider'
|
||||
import { BookmarkIcon, UsersRound } from 'lucide-react'
|
||||
import { UsersRound } from 'lucide-react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import RelayIcon from '../RelayIcon'
|
||||
import RelaySetCard from '../RelaySetCard'
|
||||
|
|
@ -35,24 +35,6 @@ export default function FeedSwitcher({ close }: { close?: () => void }) {
|
|||
</FeedSwitcherItem>
|
||||
)}
|
||||
|
||||
{pubkey && (
|
||||
<FeedSwitcherItem
|
||||
isActive={feedInfo.feedType === 'bookmarks'}
|
||||
onClick={() => {
|
||||
if (!pubkey) return
|
||||
switchFeed('bookmarks', { pubkey })
|
||||
close?.()
|
||||
}}
|
||||
>
|
||||
<div className="flex gap-2 items-center">
|
||||
<div className="flex justify-center items-center w-6 h-6 shrink-0">
|
||||
<BookmarkIcon className="size-4" />
|
||||
</div>
|
||||
<div>{t('Bookmarks')}</div>
|
||||
</div>
|
||||
</FeedSwitcherItem>
|
||||
)}
|
||||
|
||||
<div className="flex justify-end items-center text-sm">
|
||||
<SecondaryPageLink
|
||||
to={toRelaySettings()}
|
||||
|
|
|
|||
20
src/components/Sidebar/BookmarkButton.tsx
Normal file
20
src/components/Sidebar/BookmarkButton.tsx
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import { usePrimaryPage } from '@/PageManager'
|
||||
import { useNostr } from '@/providers/NostrProvider'
|
||||
import { Bookmark } from 'lucide-react'
|
||||
import SidebarItem from './SidebarItem'
|
||||
|
||||
export default function BookmarkButton({ collapse }: { collapse: boolean }) {
|
||||
const { navigate, current } = usePrimaryPage()
|
||||
const { checkLogin } = useNostr()
|
||||
|
||||
return (
|
||||
<SidebarItem
|
||||
title="Bookmarks"
|
||||
onClick={() => checkLogin(() => navigate('bookmark'))}
|
||||
active={current === 'bookmark'}
|
||||
collapse={collapse}
|
||||
>
|
||||
<Bookmark />
|
||||
</SidebarItem>
|
||||
)
|
||||
}
|
||||
|
|
@ -1,11 +1,13 @@
|
|||
import Icon from '@/assets/Icon'
|
||||
import Logo from '@/assets/Logo'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { useNostr } from '@/providers/NostrProvider'
|
||||
import { useScreenSize } from '@/providers/ScreenSizeProvider'
|
||||
import { useTheme } from '@/providers/ThemeProvider'
|
||||
import { useUserPreferences } from '@/providers/UserPreferencesProvider'
|
||||
import { ChevronsLeft, ChevronsRight } from 'lucide-react'
|
||||
import AccountButton from './AccountButton'
|
||||
import BookmarkButton from './BookmarkButton'
|
||||
import RelaysButton from './ExploreButton'
|
||||
import HomeButton from './HomeButton'
|
||||
import NotificationsButton from './NotificationButton'
|
||||
|
|
@ -18,6 +20,7 @@ export default function PrimaryPageSidebar() {
|
|||
const { isSmallScreen } = useScreenSize()
|
||||
const { themeSetting } = useTheme()
|
||||
const { sidebarCollapse, updateSidebarCollapse, enableSingleColumnLayout } = useUserPreferences()
|
||||
const { pubkey } = useNostr()
|
||||
|
||||
if (isSmallScreen) return null
|
||||
|
||||
|
|
@ -43,6 +46,7 @@ export default function PrimaryPageSidebar() {
|
|||
<NotificationsButton collapse={sidebarCollapse && !enableSingleColumnLayout} />
|
||||
<SearchButton collapse={sidebarCollapse && !enableSingleColumnLayout} />
|
||||
<ProfileButton collapse={sidebarCollapse && !enableSingleColumnLayout} />
|
||||
{pubkey && <BookmarkButton collapse={sidebarCollapse && !enableSingleColumnLayout} />}
|
||||
<SettingsButton collapse={sidebarCollapse && !enableSingleColumnLayout} />
|
||||
<PostButton collapse={sidebarCollapse && !enableSingleColumnLayout} />
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue