![]() Server : Apache/2 System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 User : gositeme ( 1004) PHP Version : 8.2.29 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/gositeme/domains/lavocat.ca/private_html/src/pages/ |
import { useSession } from 'next-auth/react';
import { useRouter } from 'next/router';
import LayoutWithSidebar from '../components/LayoutWithSidebar';
import {
Loader2,
User,
Building,
Scale,
Users,
Shield,
AlertTriangle
} from 'lucide-react';
export default function DashboardSimple() {
const { data: session, status } = useSession();
const router = useRouter();
if (status === 'loading') {
return (
<LayoutWithSidebar>
<div className="min-h-screen flex items-center justify-center">
<div className="text-center">
<Loader2 className="h-8 w-8 animate-spin mx-auto mb-4 text-blue-600" />
<h2 className="text-xl font-semibold text-gray-900 mb-2">Loading Dashboard</h2>
<p className="text-gray-600">Checking authentication status...</p>
</div>
</div>
</LayoutWithSidebar>
);
}
if (!session) {
return (
<LayoutWithSidebar>
<div className="min-h-screen flex items-center justify-center">
<div className="text-center">
<AlertTriangle className="h-8 w-8 mx-auto mb-4 text-red-600" />
<h2 className="text-xl font-semibold text-gray-900 mb-2">Authentication Required</h2>
<p className="text-gray-600 mb-4">Please sign in to access your dashboard.</p>
<button
onClick={() => router.push('/auth/login')}
className="bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700 transition-colors"
>
Sign In
</button>
</div>
</div>
</LayoutWithSidebar>
);
}
const role = session.user.role;
const roleDisplayName = role.toLowerCase().replace('_', ' ');
return (
<LayoutWithSidebar>
<div className="min-h-screen p-6">
<div className="max-w-4xl mx-auto">
<div className="bg-white rounded-lg shadow-lg p-6 mb-6">
<div className="flex items-center mb-6">
{role === 'ADMIN' || role === 'SUPERADMIN' || role === 'SUPERADMIN' ? (
<Shield className="h-8 w-8 text-red-600 mr-3" />
) : role === 'LAWYER' ? (
<Scale className="h-8 w-8 text-blue-600 mr-3" />
) : role === 'JUDGE' ? (
<Building className="h-8 w-8 text-purple-600 mr-3" />
) : role === 'MEDIATOR' ? (
<Users className="h-8 w-8 text-green-600 mr-3" />
) : (
<User className="h-8 w-8 text-gray-600 mr-3" />
)}
<div>
<h1 className="text-2xl font-bold text-gray-900">
Welcome, {session.user.name}!
</h1>
<p className="text-gray-600">Role: {roleDisplayName}</p>
</div>
</div>
<div className="grid grid-cols-1 md:grid-cols-2 gap-6 mb-6">
<div className="bg-gray-50 p-4 rounded-lg">
<h3 className="font-semibold text-gray-900 mb-2">User Information</h3>
<div className="space-y-2 text-sm">
<div><strong>Name:</strong> {session.user.name}</div>
<div><strong>Email:</strong> {session.user.email}</div>
<div><strong>Role:</strong> {role}</div>
<div><strong>Session Expires:</strong> {session.expires}</div>
</div>
</div>
<div className="bg-gray-50 p-4 rounded-lg">
<h3 className="font-semibold text-gray-900 mb-2">Quick Actions</h3>
<div className="space-y-2">
<button
onClick={() => router.push('/user/dashboard')}
className="w-full bg-blue-600 text-white px-4 py-2 rounded hover:bg-blue-700 transition-colors"
>
Go to User Dashboard
</button>
<button
onClick={() => router.push('/admin/cases')}
className="w-full bg-green-600 text-white px-4 py-2 rounded hover:bg-green-700 transition-colors"
>
View Cases
</button>
<button
onClick={() => router.push('/user/profile')}
className="w-full bg-purple-600 text-white px-4 py-2 rounded hover:bg-purple-700 transition-colors"
>
My Profile
</button>
</div>
</div>
</div>
<div className="bg-blue-50 p-4 rounded-lg">
<h3 className="font-semibold text-blue-900 mb-2">Debug Information</h3>
<div className="text-sm text-blue-800">
<p><strong>Current Route:</strong> {router.pathname}</p>
<p><strong>Session Status:</strong> {status}</p>
<p><strong>Session Present:</strong> {session ? 'Yes' : 'No'}</p>
<p><strong>User Role:</strong> {role}</p>
</div>
</div>
</div>
</div>
</div>
</LayoutWithSidebar>
);
}