Initial commit

Next.js + Express event management app for Hope Family Church.
This commit is contained in:
2026-07-23 15:26:47 +02:00
commit 3d381944d2
246 changed files with 57565 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
"use client";
import React, { useEffect } from "react";
import { useAuth } from "@/hooks/useAuth";
import { useRouter } from "next/navigation";
export default function DashboardIndex() {
const { user, loading } = useAuth();
const router = useRouter();
useEffect(() => {
if (loading) return; // wait for auth to initialize
if (!user) {
router.replace("/login");
return;
}
// Role-aware routing
const role = user.role || "user";
if (role === "admin") router.replace("/dashboard/admin");
else if (role === "supervisor") router.replace("/dashboard/supervisor");
else if (role === "staff") router.replace("/dashboard/staff");
else router.replace("/dashboard/user");
}, [router, user, loading]);
// This route only ever exists to redirect elsewhere (login now goes straight to the role
// dashboard — see LoginForm — so this mainly serves bookmarks/direct links); show a deliberate
// loading state instead of a blank screen while that redirect is worked out.
return (
<div className="min-h-screen flex items-center justify-center bg-gray-50">
<div className="text-sm text-gray-400">Loading…</div>
</div>
);
}