"use client" import Link from "next/link" import { ChevronLeft, ChevronRight } from "lucide-react" import { usePathname } from "next/navigation" import { sidebarItems } from "@/components/DocSidebar" interface DocNavigationProps { className?: string } export function DocNavigation({ className }: DocNavigationProps) { const pathname = usePathname() const flattenSidebarItems = () => { const flatItems: Array<{ title: string; href: string; section?: string }> = [] sidebarItems.forEach((item) => { if (item.href) { flatItems.push({ title: item.title, href: item.href }) } if (item.submenu) { item.submenu.forEach((subItem) => { flatItems.push({ title: subItem.title, href: subItem.href, section: item.title, }) }) } }) return flatItems } const allPages = flattenSidebarItems() const currentPageIndex = allPages.findIndex((page) => page.href === pathname) const prevPage = currentPageIndex > 0 ? allPages[currentPageIndex - 1] : null const nextPage = currentPageIndex < allPages.length - 1 ? allPages[currentPageIndex + 1] : null if (!prevPage && !nextPage) return null return (