"use client" import Link from "next/link" import { usePathname } from "next/navigation" import type { source } from "@/lib/source" import { Sidebar, SidebarContent, SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarMenu, SidebarMenuButton, SidebarMenuItem, } from "@/components/ui/sidebar" const TOP_LEVEL_SECTIONS = [ { name: "Introduction", href: "/docs" }, { name: "Registry", href: "/docs/registry" }, { name: "Components", href: "/docs/components" }, { name: "How It Works", href: "/docs/how-it-works" }, { name: "Debug Logs", href: "/docs/debug-logs" }, ] const BLOCKS_SECTIONS = [ { name: "Account", href: "/blocks/account" }, { name: "AI Agents", href: "/blocks/ai-agents" }, { name: "Billing", href: "/blocks/billing" }, { name: "Blog", href: "/blocks/blog" }, { name: "Contact", href: "/blocks/contact" }, { name: "CRUDs", href: "/blocks/cruds" }, { name: "Ecommerce", href: "/blocks/ecommerce" }, { name: "FAQs", href: "/blocks/faqs" }, { name: "Footers", href: "/blocks/footers" }, { name: "Modals", href: "/blocks/modals" }, { name: "Testimonials", href: "/blocks/testimonials" }, { name: "Web3", href: "/blocks/web3" }, ] const EXCLUDED_SECTIONS = ["installation", "dark-mode", "(root)"] const EXCLUDED_PAGES: string[] = [] export function DocsSidebar({ tree, ...props }: React.ComponentProps & { tree: typeof source.pageTree }) { const pathname = usePathname() return (
Getting Started {TOP_LEVEL_SECTIONS.map(({ name, href }) => { return ( {name} ) })} Blocks {BLOCKS_SECTIONS.map(({ name, href }) => { return ( {name} ) })} {tree.children.map((item) => { if (EXCLUDED_SECTIONS.includes(item.$id ?? "")) { return null } return ( {item.name} {item.type === "folder" && ( {item.children.map((item) => { return ( item.type === "page" && !EXCLUDED_PAGES.includes(item.url) && ( {item.name} ) ) })} )} ) })} ) }