import { ChevronLeft, type LucideIcon } from "lucide-react"; import type { ReactNode } from "react"; import { useCompany } from "@/context/CompanyContext"; import { useSidebar } from "@/context/SidebarContext"; import { useNavigate } from "@/lib/router"; import { readContextualSidebarOrigin, type ContextualSidebarSurface, } from "@/lib/shell-navigation"; import { cn } from "@/lib/utils"; import { SidebarNavExpandedProvider } from "./SidebarNavItem"; export function ContextualSidebarFrame({ surface, title, icon: Icon, fallbackTo = "/dashboard", showHeader = true, className, children, }: { surface: ContextualSidebarSurface; title: string; icon?: LucideIcon; fallbackTo?: string; showHeader?: boolean; className?: string; children: ReactNode; }) { const navigate = useNavigate(); const { selectedCompany } = useCompany(); const { isMobile, setSidebarOpen } = useSidebar(); function goBack() { navigate(readContextualSidebarOrigin({ surface, companyPrefix: selectedCompany?.issuePrefix, fallbackTo, })); if (isMobile) setSidebarOpen(false); } return ( ); }