import { Accordion, AccordionContent, AccordionItem, AccordionTrigger, } from '@affine/admin/components/ui/accordion'; import { buttonVariants } from '@affine/admin/components/ui/button'; import { cn } from '@affine/admin/utils'; import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area'; import { ClipboardListIcon, SettingsIcon, UsersIcon } from 'lucide-react'; import { useEffect } from 'react'; import { Link } from 'react-router-dom'; import { useGetServerRuntimeConfig } from '../settings/use-get-server-runtime-config'; import { CollapsibleItem } from './collapsible-item'; import { useNav } from './context'; import { UserDropdown } from './user-dropdown'; const TabsMap: { [key: string]: string } = { accounts: 'Accounts', ai: 'AI', config: 'Config', settings: 'Settings', }; export function Nav() { const { moduleList } = useGetServerRuntimeConfig(); const { activeTab, setActiveTab, setCurrentModule } = useNav(); useEffect(() => { const path = window.location.pathname; for (const key in TabsMap) { if (path.includes(key)) { setActiveTab(TabsMap[key]); return; } } }, [setActiveTab]); return (
); }