import { Suspense } from "react"
import { Dashboard } from "@/components/dashboard"
import { getServerSession } from "@/lib/auth"
import { redirect } from "next/navigation"
export default async function HomePage() {
const session = await getServerSession()
if (!session) {
redirect("/login")
}
return (
<main className="min-h-screen bg-background">
<Suspense fallback={<DashboardSkeleton />}>
<Dashboard user={session.user} />
</Suspense>
</main>
)
}
function DashboardSkeleton() {
return (
<div className="flex h-screen items-center justify-center">
<div className="animate-pulse space-y-4">
<div className="h-8 w-48 rounded bg-muted" />
<div className="h-64 w-96 rounded bg-muted" />
</div>
</div>
)
}