File size: 890 Bytes
d1a980e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"use client";

import { useSession } from "next-auth/react";
import Sidebar from "./Sidebar";
import { usePathname } from "next/navigation";

export default function AppShell({ children }: { children: React.ReactNode }) {
    const { status } = useSession();
    const pathname = usePathname();

    // Don't show shell on auth pages
    if (pathname.startsWith("/auth") || status === "unauthenticated") {
        return <main className="min-h-screen bg-[hsl(var(--background))]">{children}</main>;
    }

    return (
        <div className="flex min-h-screen bg-[hsl(var(--background))]">

            <Sidebar />

            <main className="flex-1 ml-64 p-8 overflow-y-auto h-screen">

                <div className="max-w-7xl mx-auto space-y-8 animate-fade-in">

                    {children}

                </div>

            </main>

        </div>
    );
}