import Link from "next/link"; import { listDocuments } from "@mcpedia/core"; const SECTIONS = [ { id: "docs", label: "Documentation" }, { id: "writeups", label: "Writeups" }, { id: "research", label: "Research" }, { id: "notes", label: "Notes" }, ] as const; export default async function Sidebar() { const docs = await listDocuments(); // Build a tree: section → top-level slugs + children const bySection: Record = {}; for (const doc of docs) { if (!bySection[doc.section]) bySection[doc.section] = []; // Count depth from dots in a flattened slug: docs/websocket/contract // We'll show all docs at their depth level bySection[doc.section].push({ slug: doc.slug, title: doc.title, depth: doc.slug.split("/").length, }); } return ( ); }