"use client"; import { usePathname } from "next/navigation"; import React, { ReactNode } from "react"; import { SidebarInset, SidebarProvider } from "@/components/ui/sidebar"; import { AppSidebar } from "./AppSidebar"; interface AppLayoutProps { children: ReactNode; headerActions?: ReactNode; stickyTabs?: ReactNode; } const AppLayout: React.FC = ({ children, headerActions, stickyTabs, }) => { const pathname = usePathname(); // Check if current route should have sidebar // Hide sidebar for root (/) and /handler routes (Stack Auth routes) const shouldShowSidebar = pathname !== "/" && !pathname.startsWith("/handler"); // Check if we're in workflow editor mode - collapse sidebar by default const isWorkflowEditor = /^\/workflow\/\d+/.test(pathname); // If no sidebar needed, just return children if (!shouldShowSidebar) { return <>{children}; } return (
{/* Optional header area for specific pages */} {headerActions && (
{headerActions}
)} {/* Optional sticky tabs */} {stickyTabs && (
{stickyTabs}
)} {/* Main content area */}
{children}
); }; export default AppLayout;