"use client" import Link from "next/link" import { usePathname } from "next/navigation" import { useState } from "react" import { ChevronDown, ChevronRight } from "lucide-react" interface SubMenuItem { title: string href: string } interface MenuItem { title: string href?: string submenu?: SubMenuItem[] } const sidebarItems: MenuItem[] = [ { title: "Introduction", href: "/docs/introduction" }, { title: "Installation", href: "/docs/installation" }, { title: "Hardware: GPUs and Coral", submenu: [ { title: "HW iGPU acceleration to an LXC", href: "/docs/hardware/igpu-acceleration-lxc" }, { title: "Coral TPU to an LXC", href: "/docs/hardware/coral-tpu-lxc" }, { title: "Install Coral TPU on the Host", href: "/docs/hardware/install-coral-tpu-host" }, ], }, { title: "Hard Drives, Disk Images, and Storage", submenu: [ { title: "Disk Passthrough to a VM", href: "/docs/storage/disk-passthrough-vm" }, { title: "Import Disk Image to a VM", href: "/docs/storage/import-disk-image-vm" }, ], }, ] export default function DocSidebar() { const pathname = usePathname() const [openSections, setOpenSections] = useState<{ [key: string]: boolean }>({}) const toggleSection = (title: string) => { setOpenSections((prev) => ({ ...prev, [title]: !prev[title] })) } const renderMenuItem = (item: MenuItem) => { if (item.submenu) { const isOpen = openSections[item.title] || false return (