'use client'; import Link from 'next/link'; import { usePathname } from 'next/navigation'; import { Folder, FileText } from 'lucide-react'; import { cn } from '@/lib/utils'; import type { ManualTreeNode } from '@/lib/types'; interface TreeNavProps { nodes: ManualTreeNode[]; } /** 递归渲染节点(含子孙) */ function TreeItem({ node, depth = 0 }: { node: ManualTreeNode; depth?: number }) { const pathname = usePathname(); const href = `/manual/${node.id}`; const active = pathname === href; // ===== 顶层目录 → 分区标题(带分隔线 + 缩进引导线) ===== if (depth === 0 && node.type === 0) { return (