import { type FC } from 'react'; import { useRecoilValue } from 'recoil'; import { useLocation } from 'react-router-dom'; import { TConversation } from 'librechat-data-provider'; import { Menu, MenuButton, MenuItems } from '@headlessui/react'; import { BookmarkFilledIcon, BookmarkIcon } from '@radix-ui/react-icons'; import { BookmarkContext } from '~/Providers/BookmarkContext'; import { useGetConversationTags } from '~/data-provider'; import BookmarkNavItems from './BookmarkNavItems'; import { useLocalize } from '~/hooks'; import { cn } from '~/utils'; import store from '~/store'; type BookmarkNavProps = { tags: string[]; setTags: (tags: string[]) => void; }; const BookmarkNav: FC = ({ tags, setTags }: BookmarkNavProps) => { const localize = useLocalize(); const location = useLocation(); const { data } = useGetConversationTags(); const activeConvo = useRecoilValue(store.conversationByIndex(0)); const globalConvo = useRecoilValue(store.conversation) ?? ({} as TConversation); let conversation: TConversation | null | undefined; if (location.state?.from?.pathname.includes('/chat')) { conversation = globalConvo; } else { conversation = activeConvo; } return ( {({ open }) => ( <>
{tags.length > 0 ? ( ) : ( )}
{tags.length > 0 ? tags.join(', ') : localize('com_ui_bookmarks')}
{data && conversation && ( tag.count > 0) }}> )} )}
); }; export default BookmarkNav;