mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-21 10:50:14 +01:00
* feat: add tags property in Conversation model * feat: add ConversationTag model * feat: add the tags parameter to getConvosByPage * feat: add API route to ConversationTag * feat: add types of ConversationTag * feat: add data access functions for conversation tags * feat: add Bookmark table component * feat: Add an action to bookmark * feat: add Bookmark nav component * fix: failed test * refactor: made 'Saved' tag a constant * feat: add new bookmark to current conversation * chore: Add comment * fix: delete tag from conversations when it's deleted * fix: Update the query cache when the tag title is changed. * chore: fix typo * refactor: add description of rebuilding bookmarks * chore: remove unused variables * fix: position when adding a new bookmark * refactor: add comment, rename a function * refactor: add a unique constraint in ConversationTag * chore: add localizations
52 lines
2.1 KiB
TypeScript
52 lines
2.1 KiB
TypeScript
import { useMemo } from 'react';
|
|
import { useOutletContext } from 'react-router-dom';
|
|
import { getConfigDefaults } from 'librechat-data-provider';
|
|
import { useGetStartupConfig } from 'librechat-data-provider/react-query';
|
|
import type { ContextType } from '~/common';
|
|
import { EndpointsMenu, ModelSpecsMenu, PresetsMenu, HeaderNewChat } from './Menus';
|
|
import ExportAndShareMenu from './ExportAndShareMenu';
|
|
import HeaderOptions from './Input/HeaderOptions';
|
|
import BookmarkMenu from './Menus/BookmarkMenu';
|
|
import AddMultiConvo from './AddMultiConvo';
|
|
import { useMediaQuery } from '~/hooks';
|
|
|
|
const defaultInterface = getConfigDefaults().interface;
|
|
|
|
export default function Header() {
|
|
const { data: startupConfig } = useGetStartupConfig();
|
|
const { navVisible } = useOutletContext<ContextType>();
|
|
const modelSpecs = useMemo(() => startupConfig?.modelSpecs?.list ?? [], [startupConfig]);
|
|
const interfaceConfig = useMemo(
|
|
() => startupConfig?.interface ?? defaultInterface,
|
|
[startupConfig],
|
|
);
|
|
|
|
const isSmallScreen = useMediaQuery('(max-width: 768px)');
|
|
|
|
return (
|
|
<div className="sticky top-0 z-10 flex h-14 w-full items-center justify-between bg-white p-2 font-semibold dark:bg-gray-800 dark:text-white">
|
|
<div className="hide-scrollbar flex w-full items-center justify-between gap-2 overflow-x-auto">
|
|
<div className="flex items-center gap-2">
|
|
{!navVisible && <HeaderNewChat />}
|
|
{interfaceConfig.endpointsMenu && <EndpointsMenu />}
|
|
{modelSpecs?.length > 0 && <ModelSpecsMenu modelSpecs={modelSpecs} />}
|
|
{<HeaderOptions interfaceConfig={interfaceConfig} />}
|
|
{interfaceConfig.presets && <PresetsMenu />}
|
|
{isSmallScreen && (
|
|
<ExportAndShareMenu
|
|
isSharedButtonEnabled={startupConfig?.sharedLinksEnabled ?? false}
|
|
className="pl-0"
|
|
/>
|
|
)}
|
|
<BookmarkMenu />
|
|
<AddMultiConvo />
|
|
</div>
|
|
{!isSmallScreen && (
|
|
<ExportAndShareMenu isSharedButtonEnabled={startupConfig?.sharedLinksEnabled ?? false} />
|
|
)}
|
|
</div>
|
|
{/* Empty div for spacing */}
|
|
<div />
|
|
</div>
|
|
);
|
|
}
|