import { Head, Link } from "@inertiajs/react";
import AuthenticatedLayout from "@/Layouts/AuthenticatedLayout";
import ReactMarkdown from "react-markdown";
import remarkGfm from "remark-gfm";
import {
BookOpen,
Search,
Menu,
FileText,
HelpCircle
} from "lucide-react";
import { useState } from "react";
import { ScrollArea } from "@/Components/ui/scroll-area";
import { Input } from "@/Components/ui/input";
import { cn } from "@/lib/utils";
interface Page {
title: string;
slug: string;
}
interface Section {
title: string;
pages: Page[];
}
interface Props {
toc: Section[];
currentSlug: string;
content: string;
}
export default function ManualIndex({ toc, currentSlug, content }: Props) {
const [searchQuery, setSearchQuery] = useState("");
const [isSidebarOpen, setIsSidebarOpen] = useState(true);
// Filter TOC based on search
const filteredToc = toc.map(section => ({
...section,
pages: section.pages.filter(page =>
page.title.toLowerCase().includes(searchQuery.toLowerCase()) ||
section.title.toLowerCase().includes(searchQuery.toLowerCase())
)
})).filter(section => section.pages.length > 0);
return (