37 lines
890 B
TypeScript
37 lines
890 B
TypeScript
"use client"
|
|
|
|
import { AppShell } from "@/components/layout/app-shell"
|
|
import { UserProvider, useUser } from "@/providers/user-provider"
|
|
import { NotificationProvider } from "@/providers/notification-provider"
|
|
import { Loader2 } from "lucide-react"
|
|
|
|
function DashboardContent({ children }: { children: React.ReactNode }) {
|
|
const { user, loading } = useUser()
|
|
|
|
if (loading) {
|
|
return (
|
|
<div className="flex h-screen items-center justify-center">
|
|
<Loader2 className="h-8 w-8 animate-spin text-muted-foreground" />
|
|
</div>
|
|
)
|
|
}
|
|
|
|
if (!user) return null
|
|
|
|
return <AppShell>{children}</AppShell>
|
|
}
|
|
|
|
export default function DashboardLayout({
|
|
children,
|
|
}: {
|
|
children: React.ReactNode
|
|
}) {
|
|
return (
|
|
<UserProvider>
|
|
<NotificationProvider>
|
|
<DashboardContent>{children}</DashboardContent>
|
|
</NotificationProvider>
|
|
</UserProvider>
|
|
)
|
|
}
|