// src/app/dashboard/page.js "use client"; import { useRouter } from "next/navigation"; import { useAuth } from "../context/AuthContext"; import { useEffect } from "react"; import { useTheme } from "../context/ThemeContext"; import EntriesTable from "../pages/entries/EntriesTable"; export default function DashboardPage() { const router = useRouter(); const { isAuthenticated, loading, userRole } = useAuth(); const { darkMode } = useTheme(); useEffect(() => { if (!loading && !isAuthenticated) { router.push("/"); } }, [isAuthenticated, loading, router]); // Handle theme loading state if (darkMode === undefined || loading) { return (

Loading...

); } if (!isAuthenticated) { return null; } return (
); }