2024-12-06 14:16:05 +05:00
|
|
|
import { DeviceCartDrawer } from "@/components/device-cart";
|
2024-11-24 23:30:44 +05:00
|
|
|
import { ModeToggle } from "@/components/theme-toggle";
|
|
|
|
import { AppSidebar } from "@/components/ui/app-sidebar";
|
2024-12-06 14:16:05 +05:00
|
|
|
|
2024-11-24 23:30:44 +05:00
|
|
|
import { Separator } from "@/components/ui/separator";
|
|
|
|
import {
|
|
|
|
SidebarInset,
|
|
|
|
SidebarProvider,
|
|
|
|
SidebarTrigger,
|
|
|
|
} from "@/components/ui/sidebar";
|
|
|
|
import { auth } from "@/lib/auth";
|
|
|
|
import { headers } from "next/headers";
|
|
|
|
import { AccountPopover } from "./account-popver";
|
|
|
|
|
2024-11-27 14:18:17 +05:00
|
|
|
export async function ApplicationLayout({
|
|
|
|
children,
|
|
|
|
}: { children: React.ReactNode }) {
|
2024-11-24 23:30:44 +05:00
|
|
|
const session = await auth.api.getSession({
|
2024-12-01 07:40:21 +05:00
|
|
|
headers: await headers()
|
|
|
|
});
|
2024-12-01 23:19:31 +05:00
|
|
|
|
2024-11-24 23:30:44 +05:00
|
|
|
return (
|
|
|
|
<SidebarProvider>
|
2024-11-27 14:18:17 +05:00
|
|
|
<AppSidebar role={session?.user?.role || "USER"} />
|
2024-11-24 23:30:44 +05:00
|
|
|
<SidebarInset>
|
2024-11-27 14:18:17 +05:00
|
|
|
<header className="flex justify-between sticky top-0 bg-background h-16 shrink-0 items-center gap-2 border-b px-4 z-10">
|
|
|
|
<div className="flex items-center gap-2 ">
|
2024-11-24 23:30:44 +05:00
|
|
|
<SidebarTrigger className="-ml-1" />
|
|
|
|
<Separator orientation="vertical" className="mr-2 h-4" />
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div className="flex items-center gap-2">
|
2024-12-06 14:16:05 +05:00
|
|
|
<DeviceCartDrawer />
|
2024-11-24 23:30:44 +05:00
|
|
|
<ModeToggle />
|
2024-12-01 23:19:31 +05:00
|
|
|
<AccountPopover />
|
2024-11-24 23:30:44 +05:00
|
|
|
</div>
|
|
|
|
</header>
|
2024-11-30 23:38:32 +05:00
|
|
|
<div className="p-4">{children}</div>
|
2024-11-24 23:30:44 +05:00
|
|
|
</SidebarInset>
|
|
|
|
</SidebarProvider>
|
|
|
|
);
|
|
|
|
}
|