'use client'; import {useEffect} from 'react'; import Link from 'next/link'; import {usePathname} from 'next/navigation'; import {dashboardNavigation} from '@/lib/constants/navigation'; import {cn} from '@/lib/utils/cn'; import {isNavigationItemActive} from '@/lib/utils/navigation'; import {useAppShellStore} from '@/store/app-shell'; import type {NavigationIconKey, NavigationItem} from '@/types/navigation'; function SidebarIcon({icon}: { icon: NavigationIconKey }) { const commonProps = { className: 'h-[18px] w-[18px]', fill: 'none', stroke: 'currentColor', strokeWidth: 1.8, strokeLinecap: 'round' as const, strokeLinejoin: 'round' as const, viewBox: '0 0 24 24', }; switch (icon) { case 'home': return ( ); case 'node': return ( ); case 'website': return ( ); case 'domain': return ( ); case 'certificate': return ( ); case 'proxy': return ( ); case 'release': return ( ); case 'user': return ( ); case 'setting': return ( ); } } function SidebarNavItem({ item, currentPath, isSidebarCollapsed, forceExpanded, onNavigate, depth = 0, }: { item: NavigationItem; currentPath: string; isSidebarCollapsed: boolean; forceExpanded?: boolean; onNavigate?: () => void; depth?: number; }) { const active = isNavigationItemActive(currentPath, item); const hasChildren = Boolean(item.children?.length); const showLabel = forceExpanded || !isSidebarCollapsed; return (
ATSFlare
控制面