35 lines
803 B
TypeScript
35 lines
803 B
TypeScript
"use client";
|
|
|
|
import React from "react"
|
|
import { usePathname } from "next/navigation";
|
|
|
|
import { AppSidebar } from "@/components/app-sidebar";
|
|
import { Toaster } from "@/components/ui/sonner";
|
|
|
|
const PUBLIC_PATHS = ["/login"];
|
|
|
|
export function AppShell({ children }: { children: React.ReactNode }) {
|
|
const pathname = usePathname();
|
|
const isPublicPath = PUBLIC_PATHS.includes(pathname);
|
|
|
|
// Don't show sidebar on public paths like login
|
|
if (isPublicPath) {
|
|
return (
|
|
<>
|
|
{children}
|
|
<Toaster position="top-right" />
|
|
</>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<div className="flex h-screen overflow-hidden bg-background">
|
|
<AppSidebar />
|
|
<main className="flex-1 overflow-auto">
|
|
{children}
|
|
</main>
|
|
<Toaster position="top-right" />
|
|
</div>
|
|
);
|
|
}
|