"use client"; import { KBIndexType, KBStats } from "@/types"; import { Code, FileText, MessageSquare, BookOpen, ChevronRight, AlertTriangle, Scale, GitBranch, ClipboardCheck, Lightbulb } from "lucide-react"; import { Skeleton } from "@/components/ui/skeleton"; const categoryConfig: Record = { [KBIndexType.CODE]: { label: "Code", description: "Source code, functions, and classes", icon: , }, [KBIndexType.DOCUMENTATION]: { label: "Documentation", description: "READMEs, guides, and API docs", icon: , }, [KBIndexType.CONVERSATIONS]: { label: "Conversations", description: "Agent discussions and decisions", icon: , }, [KBIndexType.JOURNALS]: { label: "Journals", description: "Agent reflections and learnings", icon: , }, [KBIndexType.ERRORS]: { label: "Errors", description: "Error patterns and solutions", icon: , }, [KBIndexType.STANDARDS]: { label: "Standards", description: "Coding, security, and workflow rules", icon: , }, [KBIndexType.DECISIONS]: { label: "Decisions", description: "Architectural and design decisions", icon: , }, [KBIndexType.REVIEWS]: { label: "Reviews", description: "Code review feedback", icon: , }, [KBIndexType.LEARNINGS]: { label: "Learnings", description: "Cross-agent shared learnings", icon: , }, }; interface KBCategoryNavProps { stats: KBStats | undefined; isLoading: boolean; selectedCategory: KBIndexType | null; onSelectCategory: (category: KBIndexType) => void; } export function KBCategoryNav({ stats, isLoading, selectedCategory, onSelectCategory, }: KBCategoryNavProps) { if (isLoading) { return (
{[1, 2, 3, 4].map((i) => (
))}
); } const getDocCount = (type: KBIndexType) => { if (!stats || !Array.isArray(stats.indexes)) return 0; const idx = stats.indexes.find((i) => i.index_type === type); return idx?.document_count ?? 0; }; return (
{Object.values(KBIndexType).map((type) => { const config = categoryConfig[type]; const count = getDocCount(type); const isSelected = selectedCategory === type; return ( ); })}
); }