"use client"; import { type ReactNode, useMemo } from "react"; import Link from "next/link"; import { usePathname, useRouter } from "next/navigation"; import { cn } from "@/lib/utils"; import { GitHubIcon } from "@/components/icons/github"; import { Select } from "@/components/assistant-ui/select"; import { SUB_PROJECTS } from "@/lib/constants"; import { ThemeToggle } from "./theme-toggle"; import { HeaderBrandLink } from "./header-brand-link"; interface BreadcrumbItem { label: string; href: string; shimmer?: boolean; } interface SubProjectLayoutProps { name: string; githubPath: string; breadcrumbs?: BreadcrumbItem[]; children: ReactNode; hideFooter?: boolean; fullHeight?: boolean; } export function SubProjectLayout({ name, githubPath, breadcrumbs: breadcrumbsOverride, children, hideFooter = false, fullHeight = false, }: SubProjectLayoutProps): React.ReactElement { const pathname = usePathname(); const router = useRouter(); const breadcrumbs = useMemo(() => { if (breadcrumbsOverride) { return breadcrumbsOverride; } const basePath = `/${name}`; if (!pathname.startsWith(basePath) || pathname === basePath) { return []; } const subPath = pathname.slice(basePath.length); const segments = subPath.split("/").filter(Boolean); return segments.map((segment, index) => ({ label: segment, href: `${basePath}/${segments.slice(0, index + 1).join("/")}`, shimmer: false, })); }, [pathname, name, breadcrumbsOverride]); return (
); }