mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-11 04:58:51 +01:00
style: AccessRolesPicker to use DropdownPopup, theming, import order, localization refactor: Update localization keys for Agent Marketplace in NewChat component, remove duplicate key style: Adjust layout and font size in NewChat component for Agent Marketplace button style: theming in AgentGrid style: Update theming and text colors across Agent components for improved consistency chore: import order style: Replace Dialog with OGDialog and update content components in AgentDetail refactor: Simplify AgentDetail component by removing dropdown menu and replacing it with a copy link button style: Enhance scrollbar visibility and layout in AgentMarketplace and CategoryTabs components style: Adjust layout in AgentMarketplace component by removing unnecessary padding from the container style: Refactor layout in AgentMarketplace component by reorganizing hero section and sticky wrapper for improved structure with collapsible header effect style: Improve responsiveness and layout in AgentMarketplace component by adjusting header visibility and modifying container styles based on screen size fix: Update localization key for no categories message in CategoryTabs component and corresponding test style: Add className prop to OpenSidebar component for improved styling flexibility and update Header to utilize it for responsive design style: Enhance layout and scrolling behavior in CategoryTabs component by adding scroll snap properties and adjusting class names for improved user experience style: Update AgentGrid component layout and skeleton structure for improved visual consistency and responsiveness
85 lines
3.2 KiB
TypeScript
85 lines
3.2 KiB
TypeScript
import { useMemo } from 'react';
|
|
import { useOutletContext } from 'react-router-dom';
|
|
import { getConfigDefaults, PermissionTypes, Permissions } from 'librechat-data-provider';
|
|
import type { ContextType } from '~/common';
|
|
import ModelSelector from './Menus/Endpoints/ModelSelector';
|
|
import { PresetsMenu, HeaderNewChat, OpenSidebar } from './Menus';
|
|
import { useGetStartupConfig } from '~/data-provider';
|
|
import ExportAndShareMenu from './ExportAndShareMenu';
|
|
import { useMediaQuery, useHasAccess } from '~/hooks';
|
|
import BookmarkMenu from './Menus/BookmarkMenu';
|
|
import { TemporaryChat } from './TemporaryChat';
|
|
import AddMultiConvo from './AddMultiConvo';
|
|
|
|
const defaultInterface = getConfigDefaults().interface;
|
|
|
|
export default function Header() {
|
|
const { data: startupConfig } = useGetStartupConfig();
|
|
const { navVisible, setNavVisible } = useOutletContext<ContextType>();
|
|
|
|
const interfaceConfig = useMemo(
|
|
() => startupConfig?.interface ?? defaultInterface,
|
|
[startupConfig],
|
|
);
|
|
|
|
const hasAccessToBookmarks = useHasAccess({
|
|
permissionType: PermissionTypes.BOOKMARKS,
|
|
permission: Permissions.USE,
|
|
});
|
|
|
|
const hasAccessToMultiConvo = useHasAccess({
|
|
permissionType: PermissionTypes.MULTI_CONVO,
|
|
permission: Permissions.USE,
|
|
});
|
|
|
|
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 text-text-primary dark:bg-gray-800">
|
|
<div className="hide-scrollbar flex w-full items-center justify-between gap-2 overflow-x-auto">
|
|
<div className="mx-1 flex items-center gap-2">
|
|
<div
|
|
className={`flex items-center gap-2 ${
|
|
!isSmallScreen ? 'transition-all duration-200 ease-in-out' : ''
|
|
} ${
|
|
!navVisible
|
|
? 'translate-x-0 opacity-100'
|
|
: 'pointer-events-none translate-x-[-100px] opacity-0'
|
|
}`}
|
|
>
|
|
<OpenSidebar setNavVisible={setNavVisible} className="max-md:hidden" />
|
|
<HeaderNewChat />
|
|
</div>
|
|
<div
|
|
className={`flex items-center gap-2 ${
|
|
!isSmallScreen ? 'transition-all duration-200 ease-in-out' : ''
|
|
} ${!navVisible ? 'translate-x-0' : 'translate-x-[-100px]'}`}
|
|
>
|
|
<ModelSelector startupConfig={startupConfig} />
|
|
{interfaceConfig.presets === true && interfaceConfig.modelSelect && <PresetsMenu />}
|
|
{hasAccessToBookmarks === true && <BookmarkMenu />}
|
|
{hasAccessToMultiConvo === true && <AddMultiConvo />}
|
|
{isSmallScreen && (
|
|
<>
|
|
<ExportAndShareMenu
|
|
isSharedButtonEnabled={startupConfig?.sharedLinksEnabled ?? false}
|
|
/>
|
|
<TemporaryChat />
|
|
</>
|
|
)}
|
|
</div>
|
|
</div>
|
|
{!isSmallScreen && (
|
|
<div className="flex items-center gap-2">
|
|
<ExportAndShareMenu
|
|
isSharedButtonEnabled={startupConfig?.sharedLinksEnabled ?? false}
|
|
/>
|
|
<TemporaryChat />
|
|
</div>
|
|
)}
|
|
</div>
|
|
{/* Empty div for spacing */}
|
|
<div />
|
|
</div>
|
|
);
|
|
}
|