import { useState, useMemo } from "react";
import { Link, useLocation, Outlet } from "react-router-dom";
import {
Search,
Menu,
X,
ChevronRight,
BookOpen,
Code2,
Zap,
FileText,
GitBranch,
Layers,
BookMarked,
ArrowLeft,
Moon,
Sun,
} from "lucide-react";
import { Input } from "@/components/ui/input";
import { DocsThemeProvider, useDocsTheme } from "@/contexts/DocsThemeContext";
interface DocNavItem {
title: string;
path: string;
icon: React.ReactNode;
description?: string;
}
const docNavigation: DocNavItem[] = [
{
title: "Overview",
path: "/docs",
icon: ,
description: "Get started with AeThex",
},
{
title: "Getting Started",
path: "/docs/getting-started",
icon: ,
description: "Quick start guide",
},
{
title: "Platform",
path: "/docs/platform",
icon: ,
description: "Platform architecture & features",
},
{
title: "API Reference",
path: "/docs/api",
icon: ,
description: "Complete API documentation",
},
{
title: "CLI",
path: "/docs/cli",
icon: ,
description: "Command line tools",
},
{
title: "Tutorials",
path: "/docs/tutorials",
icon: ,
description: "Step-by-step guides",
},
{
title: "Examples",
path: "/docs/examples",
icon: ,
description: "Code examples",
},
{
title: "Integrations",
path: "/docs/integrations",
icon: ,
description: "Third-party integrations",
},
{
title: "Curriculum",
path: "/docs/curriculum",
icon: ,
description: "Learning paths",
},
];
interface DocsLayoutProps {
children?: React.ReactNode;
title?: string;
description?: string;
breadcrumbs?: Array<{ label: string; path?: string }>;
tableOfContents?: Array<{ id: string; label: string; level: number }>;
}
function DocsLayoutContent({
children,
title = "Documentation",
description,
breadcrumbs,
tableOfContents = [],
}: DocsLayoutProps) {
const [sidebarOpen, setSidebarOpen] = useState(false);
const [searchQuery, setSearchQuery] = useState("");
const location = useLocation();
const { colors, toggleTheme, theme } = useDocsTheme();
const filteredNav = useMemo(() => {
if (!searchQuery) return docNavigation;
const query = searchQuery.toLowerCase();
return docNavigation.filter(
(item) =>
item.title.toLowerCase().includes(query) ||
item.description?.toLowerCase().includes(query),
);
}, [searchQuery]);
const isCurrentPage = (path: string) => location.pathname === path;
// Subtle geometric grid for professional theme - black/white only
const gridPatternStyle =
theme === "professional"
? {
backgroundImage: `
linear-gradient(0deg, transparent 24%, rgba(0, 0, 0, 0.02) 25%, rgba(0, 0, 0, 0.02) 26%, transparent 27%, transparent 74%, rgba(0, 0, 0, 0.02) 75%, rgba(0, 0, 0, 0.02) 76%, transparent 77%, transparent),
linear-gradient(90deg, transparent 24%, rgba(0, 0, 0, 0.02) 25%, rgba(0, 0, 0, 0.02) 26%, transparent 27%, transparent 74%, rgba(0, 0, 0, 0.02) 75%, rgba(0, 0, 0, 0.02) 76%, transparent 77%, transparent)
`,
backgroundSize: "80px 80px",
}
: undefined;
return (
{/* Sidebar */}
{/* Main Content */}
{/* Mobile Header */}
← Back
{/* Content */}
{title && (
{title}
{description && (
{description}
)}
)}
{/* Content - either children (for wrapper) or Outlet (for routing) */}
{children || }
{/* Table of Contents - Right Sidebar */}
{tableOfContents.length > 0 && (
)}
{/* Footer */}
{/* Mobile Overlay */}
{sidebarOpen && (
setSidebarOpen(false)}
/>
)}
);
}
export default function DocsLayout(props: DocsLayoutProps) {
return (
);
}