mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-12 21:48:51 +01:00
* refactor(OpenSidebar): removed useless classNames
* style(Header): update hover styles across various components for improved UI consistency
* style(Nav): update hover styles in AccountSettings and SearchBar for improved UI consistency
* style: update button classes for consistent hover effects and improved UI responsiveness
* style(Nav, OpenSidebar, Header, Convo): improve UI responsiveness and animation transitions
* style(PresetsMenu, NewChat): update icon sizes and improve component styling for better UI consistency
* style(Nav, Root): enhance sidebar mobile animations and responsiveness for better UI experience
* style(ExportAndShareMenu, BookmarkMenu): update icon sizes for improved UI consistency
* style: remove transition duration from button classes for improved UI responsiveness
* style(CustomMenu, ModelSelector): update background colors for improved UI consistency and responsiveness
* style(ExportAndShareMenu): update icon color for improved UI consistency
* style(TemporaryChat): refine button styles for improved UI consistency and responsiveness
* style(BookmarkNav): refactor to use DropdownPopup and remove BookmarkNavItems for improved UI consistency and functionality
* style(CustomMenu, EndpointItem): enhance UI elements for improved consistency and accessibility
* style(EndpointItem): adjust gap in icon container for improved layout consistency
* style(CustomMenu, EndpointItem): update focus ring color for improved UI consistency
* style(EndpointItem): update icon color for improved UI consistency in dark theme
* style: update focus styles for improved accessibility and consistency across components
* refactor(Nav): extract sidebar width to NAV_WIDTH constant
Centralize mobile (320px) and desktop (260px) sidebar widths in a single
exported constant to avoid magic numbers and ensure consistency.
* fix(BookmarkNav): memoize handlers used in useMemo
Wrap handleTagClick and handleClear in useCallback and add them to the
dropdownItems useMemo dependency array to prevent stale closures.
* feat: introduce FilterInput component and replace existing inputs with it across multiple components
* feat(DataTable): replace custom input with FilterInput component for improved filtering
* fix: Nested dialog overlay stacking issue
Fixes overlay appearing behind content when opening nested dialogs.
Introduced dynamic z-index calculation based on dialog depth using React context.
- First dialog: overlay z-50, content z-100
- Nested dialogs increment by 60: overlay z-110/content z-160, etc.
Preserves a11y escape key handling from #10975 and #10851.
Regression from #11008 (afb67fcf1) which increased content z-index
without adjusting overlay z-index for nested dialog scenarios.
* Refactor admin settings components to use a unified AdminSettingsDialog
- Removed redundant code from AdminSettings, MCPAdminSettings, and Memories AdminSettings components.
- Introduced AdminSettingsDialog component to handle permission management for different sections.
- Updated permission handling logic to use a consistent structure across components.
- Enhanced role selection and permission confirmation features in the new dialog.
- Improved UI consistency and maintainability by centralizing dialog functionality.
* refactor(Memory): memory management UI components and replace MemoryViewer with MemoryPanel
* refactor(Memory): enhance UI components for Memory dialogs and improve input styling
* refactor(Bookmarks): improve bookmark management UI with enhanced styling
* refactor(translations): remove redundant filter input and bookmark count entries
* refactor(Convo): integrate useShiftKey hook for enhanced keyboard interaction and improve UI responsiveness
113 lines
3.9 KiB
TypeScript
113 lines
3.9 KiB
TypeScript
import React, { useState, useEffect } from 'react';
|
|
import { Outlet } from 'react-router-dom';
|
|
import { useMediaQuery } from '@librechat/client';
|
|
import type { ContextType } from '~/common';
|
|
import {
|
|
useSearchEnabled,
|
|
useAssistantsMap,
|
|
useAuthContext,
|
|
useAgentsMap,
|
|
useFileMap,
|
|
} from '~/hooks';
|
|
import {
|
|
PromptGroupsProvider,
|
|
AssistantsMapContext,
|
|
AgentsMapContext,
|
|
SetConvoProvider,
|
|
FileMapContext,
|
|
} from '~/Providers';
|
|
import { useUserTermsQuery, useGetStartupConfig } from '~/data-provider';
|
|
import { Nav, MobileNav, NAV_WIDTH } from '~/components/Nav';
|
|
import { TermsAndConditionsModal } from '~/components/ui';
|
|
import { useHealthCheck } from '~/data-provider';
|
|
import { Banner } from '~/components/Banners';
|
|
|
|
export default function Root() {
|
|
const [showTerms, setShowTerms] = useState(false);
|
|
const [bannerHeight, setBannerHeight] = useState(0);
|
|
const [navVisible, setNavVisible] = useState(() => {
|
|
const savedNavVisible = localStorage.getItem('navVisible');
|
|
return savedNavVisible !== null ? JSON.parse(savedNavVisible) : true;
|
|
});
|
|
|
|
const { isAuthenticated, logout } = useAuthContext();
|
|
const isSmallScreen = useMediaQuery('(max-width: 768px)');
|
|
|
|
// Global health check - runs once per authenticated session
|
|
useHealthCheck(isAuthenticated);
|
|
|
|
const assistantsMap = useAssistantsMap({ isAuthenticated });
|
|
const agentsMap = useAgentsMap({ isAuthenticated });
|
|
const fileMap = useFileMap({ isAuthenticated });
|
|
|
|
const { data: config } = useGetStartupConfig();
|
|
const { data: termsData } = useUserTermsQuery({
|
|
enabled: isAuthenticated && config?.interface?.termsOfService?.modalAcceptance === true,
|
|
});
|
|
|
|
useSearchEnabled(isAuthenticated);
|
|
|
|
useEffect(() => {
|
|
if (termsData) {
|
|
setShowTerms(!termsData.termsAccepted);
|
|
}
|
|
}, [termsData]);
|
|
|
|
const handleAcceptTerms = () => {
|
|
setShowTerms(false);
|
|
};
|
|
|
|
const handleDeclineTerms = () => {
|
|
setShowTerms(false);
|
|
logout('/login?redirect=false');
|
|
};
|
|
|
|
if (!isAuthenticated) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<SetConvoProvider>
|
|
<FileMapContext.Provider value={fileMap}>
|
|
<AssistantsMapContext.Provider value={assistantsMap}>
|
|
<AgentsMapContext.Provider value={agentsMap}>
|
|
<PromptGroupsProvider>
|
|
<Banner onHeightChange={setBannerHeight} />
|
|
<div className="flex" style={{ height: `calc(100dvh - ${bannerHeight}px)` }}>
|
|
<div className="relative z-0 flex h-full w-full overflow-hidden">
|
|
<Nav navVisible={navVisible} setNavVisible={setNavVisible} />
|
|
<div
|
|
className="relative flex h-full max-w-full flex-1 flex-col overflow-hidden"
|
|
style={
|
|
isSmallScreen
|
|
? {
|
|
transform: navVisible
|
|
? `translateX(${NAV_WIDTH.MOBILE}px)`
|
|
: 'translateX(0)',
|
|
transition: 'transform 0.2s ease-out',
|
|
}
|
|
: undefined
|
|
}
|
|
>
|
|
<MobileNav navVisible={navVisible} setNavVisible={setNavVisible} />
|
|
<Outlet context={{ navVisible, setNavVisible } satisfies ContextType} />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</PromptGroupsProvider>
|
|
</AgentsMapContext.Provider>
|
|
{config?.interface?.termsOfService?.modalAcceptance === true && (
|
|
<TermsAndConditionsModal
|
|
open={showTerms}
|
|
onOpenChange={setShowTerms}
|
|
onAccept={handleAcceptTerms}
|
|
onDecline={handleDeclineTerms}
|
|
title={config.interface.termsOfService.modalTitle}
|
|
modalContent={config.interface.termsOfService.modalContent}
|
|
/>
|
|
)}
|
|
</AssistantsMapContext.Provider>
|
|
</FileMapContext.Provider>
|
|
</SetConvoProvider>
|
|
);
|
|
}
|