![]() 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/jurist/ |
import React, { useEffect, useState } from 'react';
import { useSession } from 'next-auth/react';
import { useRouter } from 'next/router';
import LayoutWithSidebar from '@/components/LayoutWithSidebar';
import { toast } from 'react-hot-toast';
import {
BookOpen,
FileText,
Lightbulb,
Users,
GraduationCap,
UserCheck,
DollarSign,
TrendingUp,
Search,
Library,
Award,
Globe
} from 'lucide-react';
const navCards = [
{
title: 'Legal Research Hub',
description: 'Access academic databases, case law analysis, and legal theory resources.',
icon: <Search className="h-8 w-8 text-indigo-600" />,
href: '/jurist/research',
color: 'from-indigo-500 to-indigo-600',
},
{
title: 'Publication Management',
description: 'Manage scholarly articles, research papers, and academic publications.',
icon: <FileText className="h-8 w-8 text-blue-600" />,
href: '/jurist/publications',
color: 'from-blue-500 to-blue-600',
},
{
title: 'Theory Development',
description: 'Develop legal frameworks, policy recommendations, and theoretical analysis.',
icon: <Lightbulb className="h-8 w-8 text-yellow-600" />,
href: '/jurist/theory',
color: 'from-yellow-500 to-yellow-600',
},
{
title: 'Academic Collaboration',
description: 'Connect with research partners, peer reviews, and academic conferences.',
icon: <Users className="h-8 w-8 text-green-600" />,
href: '/jurist/collaboration',
color: 'from-green-500 to-green-600',
},
{
title: 'Teaching Resources',
description: 'Course materials, student assignments, and educational content management.',
icon: <GraduationCap className="h-8 w-8 text-purple-600" />,
href: '/jurist/teaching',
color: 'from-purple-500 to-purple-600',
},
{
title: 'Expert Consultation',
description: 'Provide expert witness services and legal opinions for cases.',
icon: <UserCheck className="h-8 w-8 text-teal-600" />,
href: '/jurist/consultation',
color: 'from-teal-500 to-teal-600',
},
{
title: 'Research Funding',
description: 'Manage grant applications, research budgets, and funding opportunities.',
icon: <DollarSign className="h-8 w-8 text-emerald-600" />,
href: '/jurist/funding',
color: 'from-emerald-500 to-emerald-600',
},
{
title: 'Citation Analytics',
description: 'Track publication impact, citations, and academic performance metrics.',
icon: <TrendingUp className="h-8 w-8 text-pink-600" />,
href: '/jurist/analytics',
color: 'from-pink-500 to-pink-600',
},
{
title: 'Profile',
description: 'Manage your academic profile and credentials.',
icon: <UserCheck className="h-8 w-8 text-orange-600" />,
href: '/jurist/profile',
color: 'from-orange-500 to-orange-600',
},
];
const JuristDashboard: React.FC = () => {
const { data: session, status } = useSession();
const router = useRouter();
const [loading, setLoading] = useState(true);
const [stats, setStats] = useState<any>(null);
useEffect(() => {
if (status === 'loading') return;
if (!session || !['JURIST', 'ADMIN', 'SUPERADMIN'].includes(session.user.role)) {
router.push('/');
return;
}
fetchStats();
}, [session, status, router]);
const fetchStats = async () => {
try {
// Placeholder: Replace with real API call
setStats({
publications: 12,
citations: 156,
researchProjects: 4,
collaborations: 8,
students: 24,
consultations: 6,
grants: 3,
hIndex: 8,
});
} catch (e) {
toast.error('Failed to load academic statistics');
} finally {
setLoading(false);
}
};
if (status === 'loading' || loading) {
return (
<LayoutWithSidebar>
<div className="flex items-center justify-center min-h-screen">
<div className="animate-spin rounded-full h-12 w-12 border-b-2 border-indigo-600"></div>
</div>
</LayoutWithSidebar>
);
}
return (
<LayoutWithSidebar>
<div className="max-w-7xl mx-auto px-4 py-8">
{/* Welcome Section */}
<div className="mb-8">
<h1 className="text-3xl font-bold text-gray-900 mb-2">
Welcome, Dr. {session?.user?.name || 'Jurist'}
</h1>
<p className="text-gray-600">
Your academic command center for legal research, publication management, and scholarly collaboration.
</p>
</div>
{/* Academic Stats */}
<div className="grid grid-cols-2 md:grid-cols-4 lg:grid-cols-8 gap-4 mb-10">
<div className="bg-gradient-to-r from-indigo-500 to-indigo-600 text-white rounded-lg p-4 shadow">
<div className="text-xs">Publications</div>
<div className="text-2xl font-bold">{stats?.publications ?? '-'}</div>
</div>
<div className="bg-gradient-to-r from-blue-500 to-blue-600 text-white rounded-lg p-4 shadow">
<div className="text-xs">Citations</div>
<div className="text-2xl font-bold">{stats?.citations ?? '-'}</div>
</div>
<div className="bg-gradient-to-r from-yellow-500 to-yellow-600 text-white rounded-lg p-4 shadow">
<div className="text-xs">Research Projects</div>
<div className="text-2xl font-bold">{stats?.researchProjects ?? '-'}</div>
</div>
<div className="bg-gradient-to-r from-green-500 to-green-600 text-white rounded-lg p-4 shadow">
<div className="text-xs">Collaborations</div>
<div className="text-2xl font-bold">{stats?.collaborations ?? '-'}</div>
</div>
<div className="bg-gradient-to-r from-purple-500 to-purple-600 text-white rounded-lg p-4 shadow">
<div className="text-xs">Students</div>
<div className="text-2xl font-bold">{stats?.students ?? '-'}</div>
</div>
<div className="bg-gradient-to-r from-teal-500 to-teal-600 text-white rounded-lg p-4 shadow">
<div className="text-xs">Consultations</div>
<div className="text-2xl font-bold">{stats?.consultations ?? '-'}</div>
</div>
<div className="bg-gradient-to-r from-emerald-500 to-emerald-600 text-white rounded-lg p-4 shadow">
<div className="text-xs">Active Grants</div>
<div className="text-2xl font-bold">{stats?.grants ?? '-'}</div>
</div>
<div className="bg-gradient-to-r from-pink-500 to-pink-600 text-white rounded-lg p-4 shadow">
<div className="text-xs">H-Index</div>
<div className="text-2xl font-bold">{stats?.hIndex ?? '-'}</div>
</div>
</div>
{/* Quick Actions */}
<div className="bg-white rounded-lg shadow-sm border border-gray-200 p-6 mb-8">
<h2 className="text-xl font-semibold text-gray-900 mb-4">Quick Actions</h2>
<div className="grid grid-cols-1 md:grid-cols-3 gap-4">
<button
onClick={() => router.push('/jurist/research')}
className="flex items-center p-4 border border-gray-200 rounded-lg hover:bg-gray-50 transition-colors"
>
<Library className="h-6 w-6 text-indigo-600 mr-3" />
<div className="text-left">
<div className="font-medium text-gray-900">Start Research</div>
<div className="text-sm text-gray-500">Access legal databases</div>
</div>
</button>
<button
onClick={() => router.push('/jurist/publications')}
className="flex items-center p-4 border border-gray-200 rounded-lg hover:bg-gray-50 transition-colors"
>
<BookOpen className="h-6 w-6 text-blue-600 mr-3" />
<div className="text-left">
<div className="font-medium text-gray-900">New Publication</div>
<div className="text-sm text-gray-500">Submit research paper</div>
</div>
</button>
<button
onClick={() => router.push('/jurist/collaboration')}
className="flex items-center p-4 border border-gray-200 rounded-lg hover:bg-gray-50 transition-colors"
>
<Globe className="h-6 w-6 text-green-600 mr-3" />
<div className="text-left">
<div className="font-medium text-gray-900">Find Collaborators</div>
<div className="text-sm text-gray-500">Connect with researchers</div>
</div>
</button>
</div>
</div>
{/* Navigation Cards */}
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
{navCards.map((card) => (
<button
key={card.title}
onClick={() => router.push(card.href)}
className={`bg-gradient-to-r ${card.color} rounded-xl p-6 shadow-lg hover:scale-105 transition-transform text-left focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500`}
>
<div className="flex items-center mb-4">{card.icon}</div>
<h2 className="text-xl font-semibold text-white mb-1">{card.title}</h2>
<p className="text-white text-sm opacity-90">{card.description}</p>
</button>
))}
</div>
{/* Recent Activity */}
<div className="mt-8 bg-white rounded-lg shadow-sm border border-gray-200 p-6">
<h2 className="text-xl font-semibold text-gray-900 mb-4">Recent Academic Activity</h2>
<div className="space-y-4">
<div className="flex items-center p-3 bg-blue-50 rounded-lg">
<Award className="h-5 w-5 text-blue-600 mr-3" />
<div>
<div className="font-medium text-gray-900">Paper Accepted for Publication</div>
<div className="text-sm text-gray-500">"Legal Theory in the Digital Age" - Harvard Law Review</div>
</div>
</div>
<div className="flex items-center p-3 bg-green-50 rounded-lg">
<TrendingUp className="h-5 w-5 text-green-600 mr-3" />
<div>
<div className="font-medium text-gray-900">Citation Milestone Reached</div>
<div className="text-sm text-gray-500">Your work cited 25+ times this month</div>
</div>
</div>
<div className="flex items-center p-3 bg-purple-50 rounded-lg">
<Users className="h-5 w-5 text-purple-600 mr-3" />
<div>
<div className="font-medium text-gray-900">Collaboration Invitation</div>
<div className="text-sm text-gray-500">International research project on AI and Law</div>
</div>
</div>
</div>
</div>
</div>
</LayoutWithSidebar>
);
};
export default JuristDashboard;