import { createFileRoute, Outlet } from "@tanstack/react-router";
import Cookies from "js-cookie";
import Nav from "../../components/navBar/Nav";
import SideBarNav from "../../components/navBar/SideBarNav";
import { SidebarProvider } from "../../components/ui/sidebar";

export const Route = createFileRoute("/_app")({
	component: RouteComponent,
});

function RouteComponent() {
	const defaultOpen = Cookies.get("sidebar_state") === "true";
	return (
		<div className="flex flex-col h-screen overflow-hidden">
			<div className="flex flex-col h-screen overflow-hidden">
				<Nav />
				<div className="flex  flex-1 overflow-hidden">
					<SidebarProvider defaultOpen={defaultOpen}>
						<SideBarNav />

						<div className="flex-2 overflow-y-auto">
							<Outlet />
						</div>
					</SidebarProvider>
				</div>
			</div>
		</div>
	);
}
