@@ -13,6 +13,7 @@ import { useTheme } from '../providers/ThemeProvider';
1313import { useSiteSettings , defaultLogoUrl } from '../providers/SiteSettingsProvider' ;
1414import { effectiveDocUrl } from '../../shared/utils/docUrl' ;
1515import { useIsMobile } from '../../shared/hooks/useMediaQuery' ;
16+ import { usePersistentBoolean } from '../../shared/hooks/usePersistentBoolean' ;
1617import { TopLoadingLine } from '../../shared/components/PageLoading' ;
1718import {
1819 LayoutDashboard ,
@@ -77,6 +78,8 @@ const apiKeyMenuItems: MenuItem[] = [
7778 { path : '/usage' , labelKey : 'nav.my_usage' , icon : < ReceiptText className = "h-5 w-5" /> , sectionKey : 'nav.personal' } ,
7879] ;
7980
81+ const SIDEBAR_COLLAPSED_STORAGE_KEY = 'airgate:sidebar:collapsed' ;
82+
8083/**
8184 * 拉取插件菜单:所有登录用户均可调用 /plugins/menu,再按 page.audience 过滤显示。
8285 * audience = "admin"(或空,向后兼容)— 仅管理员可见,挂在「插件」分组
@@ -158,7 +161,7 @@ export function AppShell({ children }: AppShellProps) {
158161 const { t, i18n } = useTranslation ( ) ;
159162 const { theme, toggleTheme } = useTheme ( ) ;
160163 const site = useSiteSettings ( ) ;
161- const [ collapsed , setCollapsed ] = useState ( false ) ;
164+ const [ collapsed , setCollapsed ] = usePersistentBoolean ( SIDEBAR_COLLAPSED_STORAGE_KEY , false ) ;
162165 const [ mobileOpen , setMobileOpen ] = useState ( false ) ;
163166 const isMobile = useIsMobile ( ) ;
164167 const matchRoute = useMatchRoute ( ) ;
@@ -377,21 +380,20 @@ export function AppShell({ children }: AppShellProps) {
377380 < div
378381 className = "fixed inset-0 z-40 bg-black/40"
379382 onClick = { ( ) => setMobileOpen ( false ) }
380- style = { { animation : 'ag-fade-in 0.15s ease-out' } }
381383 />
382384 ) }
383385
384386 { /* Sidebar */ }
385387 { isMobile ? (
386388 < aside
387- className = "fixed inset-y-0 left-0 z-50 flex flex-col bg-surface border-r border-border transition-transform duration-300 ease-in -out"
389+ className = "fixed inset-y-0 left-0 z-50 flex flex-col bg-surface border-r border-border transition-transform duration-150 ease-out"
388390 style = { { width : 'var(--ag-sidebar-width)' , transform : mobileOpen ? 'translateX(0)' : 'translateX(-100%)' } }
389391 >
390392 { sidebarContent }
391393 </ aside >
392394 ) : (
393395 < aside
394- className = "relative flex flex-col border-r border-border bg-surface transition-all duration-300 ease-in -out"
396+ className = "relative flex flex-col border-r border-border bg-surface transition-[width] duration-150 ease-out"
395397 style = { { width : collapsed ? 'var(--ag-sidebar-collapsed)' : 'var(--ag-sidebar-width)' } }
396398 >
397399 { sidebarContent }
0 commit comments