mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 00:40:14 +01:00
📑 fix: Access Control for Bookmarks (UI) (#4612)
This commit is contained in:
parent
95011ce349
commit
9437e95315
2 changed files with 8 additions and 19 deletions
|
|
@ -1,7 +1,5 @@
|
||||||
import { type FC } from 'react';
|
import { type FC } from 'react';
|
||||||
import { useRecoilValue } from 'recoil';
|
import { useRecoilValue } from 'recoil';
|
||||||
import { useLocation } from 'react-router-dom';
|
|
||||||
import { TConversation } from 'librechat-data-provider';
|
|
||||||
import { Menu, MenuButton, MenuItems } from '@headlessui/react';
|
import { Menu, MenuButton, MenuItems } from '@headlessui/react';
|
||||||
import { BookmarkFilledIcon, BookmarkIcon } from '@radix-ui/react-icons';
|
import { BookmarkFilledIcon, BookmarkIcon } from '@radix-ui/react-icons';
|
||||||
import { BookmarkContext } from '~/Providers/BookmarkContext';
|
import { BookmarkContext } from '~/Providers/BookmarkContext';
|
||||||
|
|
@ -19,19 +17,8 @@ type BookmarkNavProps = {
|
||||||
|
|
||||||
const BookmarkNav: FC<BookmarkNavProps> = ({ tags, setTags, isSmallScreen }: BookmarkNavProps) => {
|
const BookmarkNav: FC<BookmarkNavProps> = ({ tags, setTags, isSmallScreen }: BookmarkNavProps) => {
|
||||||
const localize = useLocalize();
|
const localize = useLocalize();
|
||||||
const location = useLocation();
|
|
||||||
|
|
||||||
const { data } = useGetConversationTags();
|
const { data } = useGetConversationTags();
|
||||||
|
const conversation = useRecoilValue(store.conversationByIndex(0));
|
||||||
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 (
|
return (
|
||||||
<Menu as="div" className="group relative">
|
<Menu as="div" className="group relative">
|
||||||
|
|
|
||||||
|
|
@ -176,11 +176,13 @@ const Nav = ({
|
||||||
{isSearchEnabled === true && (
|
{isSearchEnabled === true && (
|
||||||
<SearchBar clearSearch={clearSearch} isSmallScreen={isSmallScreen} />
|
<SearchBar clearSearch={clearSearch} isSmallScreen={isSmallScreen} />
|
||||||
)}
|
)}
|
||||||
|
{hasAccessToBookmarks === true && (
|
||||||
<BookmarkNav
|
<BookmarkNav
|
||||||
tags={tags}
|
tags={tags}
|
||||||
setTags={setTags}
|
setTags={setTags}
|
||||||
isSmallScreen={isSmallScreen}
|
isSmallScreen={isSmallScreen}
|
||||||
/>
|
/>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue