![]() 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/backups/lavocat.quebec/backup-20250730-021618/src/pages/jurist/ |
import React, { useState, useEffect } from 'react';
import { useRouter } from 'next/router';
import { useSession } from 'next-auth/react';
import LayoutWithSidebar from '@/components/LayoutWithSidebar';
import {
FileText,
Plus,
Edit,
Trash2,
Eye,
Download,
Share2,
Bookmark,
Star,
Calendar,
Users,
TrendingUp,
CheckCircle,
Clock,
AlertCircle,
Filter,
Search,
ChevronDown,
ChevronUp,
ExternalLink,
Save,
Upload,
BarChart3,
Award,
Globe
} from 'lucide-react';
interface Publication {
id: string;
title: string;
abstract: string;
authors: string[];
coAuthors: string[];
status: 'draft' | 'submitted' | 'under_review' | 'accepted' | 'published' | 'rejected';
type: 'article' | 'book_chapter' | 'conference_paper' | 'research_report' | 'thesis';
journal?: string;
publisher?: string;
publicationDate?: string;
submissionDate: string;
doi?: string;
citations: number;
impactFactor?: number;
keywords: string[];
fileUrl?: string;
isBookmarked: boolean;
isPublic: boolean;
}
interface PublicationStats {
totalPublications: number;
published: number;
underReview: number;
draft: number;
totalCitations: number;
averageImpactFactor: number;
hIndex: number;
thisYearPublications: number;
}
const JuristPublications: React.FC = () => {
const { data: session, status } = useSession();
const router = useRouter();
const [isLoading, setIsLoading] = useState(true);
const [searchQuery, setSearchQuery] = useState('');
const [selectedStatus, setSelectedStatus] = useState<string>('all');
const [selectedType, setSelectedType] = useState<string>('all');
const [sortBy, setSortBy] = useState<string>('date');
const [showFilters, setShowFilters] = useState(false);
const [showNewPublicationModal, setShowNewPublicationModal] = useState(false);
// Mock data - replace with actual API calls
const [publications] = useState<Publication[]>([
{
id: '1',
title: 'The Evolution of Constitutional Rights in Modern Legal Systems',
abstract: 'This comprehensive study examines the development of constitutional rights across various legal systems, analyzing trends and implications for contemporary jurisprudence.',
authors: ['Dr. Marie Dubois'],
coAuthors: ['Prof. Jean-Luc Martin', 'Dr. Sarah Chen'],
status: 'published',
type: 'article',
journal: 'Harvard Law Review',
publisher: 'Harvard University Press',
publicationDate: '2024-03-15',
submissionDate: '2023-09-20',
doi: '10.1000/example.2024.001',
citations: 156,
impactFactor: 8.5,
keywords: ['Constitutional Law', 'Human Rights', 'Comparative Law'],
fileUrl: '/uploads/publications/constitutional-rights.pdf',
isBookmarked: true,
isPublic: true
},
{
id: '2',
title: 'Digital Privacy and Legal Frameworks: A Global Perspective',
abstract: 'Analysis of digital privacy laws across jurisdictions, examining the balance between technological advancement and individual rights protection.',
authors: ['Dr. Marie Dubois'],
coAuthors: ['Prof. Michael Johnson'],
status: 'under_review',
type: 'article',
journal: 'International Law Journal',
submissionDate: '2024-05-10',
citations: 0,
keywords: ['Privacy Law', 'Technology Law', 'International Law'],
isBookmarked: false,
isPublic: false
},
{
id: '3',
title: 'Environmental Justice and Legal Remedies',
abstract: 'Exploration of legal mechanisms for addressing environmental injustices and the role of courts in environmental protection.',
authors: ['Dr. Marie Dubois'],
coAuthors: ['Dr. Sarah Chen', 'Prof. David Wilson'],
status: 'accepted',
type: 'book_chapter',
publisher: 'Oxford University Press',
submissionDate: '2024-04-20',
citations: 0,
keywords: ['Environmental Law', 'Justice', 'Remedies'],
isBookmarked: true,
isPublic: false
},
{
id: '4',
title: 'Comparative Analysis of Judicial Systems',
abstract: 'A detailed comparison of judicial systems across different countries and their effectiveness in delivering justice.',
authors: ['Dr. Marie Dubois'],
coAuthors: [],
status: 'draft',
type: 'research_report',
submissionDate: '2024-06-15',
citations: 0,
keywords: ['Judicial Systems', 'Comparative Law', 'Justice'],
isBookmarked: false,
isPublic: false
}
]);
const [stats] = useState<PublicationStats>({
totalPublications: 24,
published: 18,
underReview: 3,
draft: 3,
totalCitations: 1247,
averageImpactFactor: 7.2,
hIndex: 12,
thisYearPublications: 4
});
useEffect(() => {
if (status === 'loading') return;
if (!session) {
router.push('/auth/login');
return;
}
if (session.user?.role !== 'JURIST') {
router.push('/unauthorized');
return;
}
setIsLoading(false);
}, [session, status, router]);
const getStatusColor = (status: string) => {
switch (status) {
case 'published': return 'bg-green-100 text-green-800';
case 'accepted': return 'bg-blue-100 text-blue-800';
case 'under_review': return 'bg-yellow-100 text-yellow-800';
case 'submitted': return 'bg-purple-100 text-purple-800';
case 'draft': return 'bg-gray-100 text-gray-800';
case 'rejected': return 'bg-red-100 text-red-800';
default: return 'bg-gray-100 text-gray-800';
}
};
const getTypeColor = (type: string) => {
switch (type) {
case 'article': return 'bg-blue-100 text-blue-800';
case 'book_chapter': return 'bg-purple-100 text-purple-800';
case 'conference_paper': return 'bg-green-100 text-green-800';
case 'research_report': return 'bg-orange-100 text-orange-800';
case 'thesis': return 'bg-red-100 text-red-800';
default: return 'bg-gray-100 text-gray-800';
}
};
if (isLoading) {
return (
<LayoutWithSidebar>
<div className="min-h-screen bg-gray-50 flex items-center justify-center">
<div className="text-center">
<div className="animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto"></div>
<p className="mt-4 text-gray-600">Loading publications...</p>
</div>
</div>
</LayoutWithSidebar>
);
}
return (
<LayoutWithSidebar>
<div className="min-h-screen bg-gray-50">
{/* Header */}
<div className="bg-white shadow-sm border-b">
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div className="flex justify-between items-center py-6">
<div>
<h1 className="text-3xl font-bold text-gray-900">Publication Management</h1>
<p className="mt-1 text-sm text-gray-500">
Manage your scholarly articles, research papers, and academic publications
</p>
</div>
<div className="flex items-center space-x-4">
<button
onClick={() => setShowNewPublicationModal(true)}
className="bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700 transition-colors flex items-center"
>
<Plus className="w-4 h-4 mr-2" />
New Publication
</button>
</div>
</div>
</div>
</div>
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
{/* Stats Grid */}
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8">
<div className="bg-white rounded-lg shadow p-6">
<div className="flex items-center">
<div className="p-2 bg-blue-100 rounded-lg">
<FileText className="w-6 h-6 text-blue-600" />
</div>
<div className="ml-4">
<p className="text-sm font-medium text-gray-600">Total Publications</p>
<p className="text-2xl font-bold text-gray-900">{stats.totalPublications}</p>
</div>
</div>
</div>
<div className="bg-white rounded-lg shadow p-6">
<div className="flex items-center">
<div className="p-2 bg-green-100 rounded-lg">
<CheckCircle className="w-6 h-6 text-green-600" />
</div>
<div className="ml-4">
<p className="text-sm font-medium text-gray-600">Published</p>
<p className="text-2xl font-bold text-gray-900">{stats.published}</p>
</div>
</div>
</div>
<div className="bg-white rounded-lg shadow p-6">
<div className="flex items-center">
<div className="p-2 bg-purple-100 rounded-lg">
<Star className="w-6 h-6 text-purple-600" />
</div>
<div className="ml-4">
<p className="text-sm font-medium text-gray-600">Total Citations</p>
<p className="text-2xl font-bold text-gray-900">{stats.totalCitations}</p>
</div>
</div>
</div>
<div className="bg-white rounded-lg shadow p-6">
<div className="flex items-center">
<div className="p-2 bg-orange-100 rounded-lg">
<TrendingUp className="w-6 h-6 text-orange-600" />
</div>
<div className="ml-4">
<p className="text-sm font-medium text-gray-600">H-Index</p>
<p className="text-2xl font-bold text-gray-900">{stats.hIndex}</p>
</div>
</div>
</div>
</div>
{/* Search and Filters */}
<div className="bg-white rounded-lg shadow p-6 mb-8">
<div className="flex items-center space-x-4">
<div className="flex-1">
<div className="relative">
<Search className="absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-5 h-5" />
<input
type="text"
placeholder="Search publications..."
value={searchQuery}
onChange={(e) => setSearchQuery(e.target.value)}
className="w-full pl-10 pr-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"
/>
</div>
</div>
<button
onClick={() => setShowFilters(!showFilters)}
className="flex items-center space-x-2 px-4 py-3 border border-gray-300 rounded-lg hover:bg-gray-50 transition-colors"
>
<Filter className="w-4 h-4" />
<span>Filters</span>
{showFilters ? <ChevronUp className="w-4 h-4" /> : <ChevronDown className="w-4 h-4" />}
</button>
</div>
{/* Filters */}
{showFilters && (
<div className="mt-6 grid grid-cols-1 md:grid-cols-3 gap-4">
<div>
<label className="block text-sm font-medium text-gray-700 mb-2">Status</label>
<select
value={selectedStatus}
onChange={(e) => setSelectedStatus(e.target.value)}
className="w-full border border-gray-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-blue-500 focus:border-transparent"
>
<option value="all">All Status</option>
<option value="published">Published</option>
<option value="accepted">Accepted</option>
<option value="under_review">Under Review</option>
<option value="submitted">Submitted</option>
<option value="draft">Draft</option>
<option value="rejected">Rejected</option>
</select>
</div>
<div>
<label className="block text-sm font-medium text-gray-700 mb-2">Type</label>
<select
value={selectedType}
onChange={(e) => setSelectedType(e.target.value)}
className="w-full border border-gray-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-blue-500 focus:border-transparent"
>
<option value="all">All Types</option>
<option value="article">Articles</option>
<option value="book_chapter">Book Chapters</option>
<option value="conference_paper">Conference Papers</option>
<option value="research_report">Research Reports</option>
<option value="thesis">Theses</option>
</select>
</div>
<div>
<label className="block text-sm font-medium text-gray-700 mb-2">Sort By</label>
<select
value={sortBy}
onChange={(e) => setSortBy(e.target.value)}
className="w-full border border-gray-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-blue-500 focus:border-transparent"
>
<option value="date">Date</option>
<option value="title">Title</option>
<option value="citations">Citations</option>
<option value="status">Status</option>
</select>
</div>
</div>
)}
</div>
{/* Publications List */}
<div className="bg-white rounded-lg shadow">
<div className="p-6 border-b border-gray-200">
<div className="flex items-center justify-between">
<h2 className="text-lg font-semibold text-gray-900">Your Publications</h2>
<span className="text-sm text-gray-500">{publications.length} publications</span>
</div>
</div>
<div className="p-6">
<div className="space-y-6">
{publications.map((publication) => (
<div key={publication.id} className="border border-gray-200 rounded-lg p-6 hover:shadow-md transition-shadow">
<div className="flex items-start justify-between">
<div className="flex-1">
<div className="flex items-center space-x-3 mb-2">
<span className={`px-2 py-1 text-xs font-medium rounded-full ${getStatusColor(publication.status)}`}>
{publication.status.replace('_', ' ').toUpperCase()}
</span>
<span className={`px-2 py-1 text-xs font-medium rounded-full ${getTypeColor(publication.type)}`}>
{publication.type.replace('_', ' ').toUpperCase()}
</span>
{publication.isPublic && (
<span className="px-2 py-1 text-xs font-medium rounded-full bg-green-100 text-green-800">
PUBLIC
</span>
)}
</div>
<h3 className="text-lg font-semibold text-gray-900 mb-2">{publication.title}</h3>
<p className="text-gray-700 mb-3">{publication.abstract}</p>
<div className="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4">
<div>
<p className="text-sm text-gray-600">
<strong>Authors:</strong> {publication.authors.join(', ')}
</p>
{publication.coAuthors.length > 0 && (
<p className="text-sm text-gray-600">
<strong>Co-authors:</strong> {publication.coAuthors.join(', ')}
</p>
)}
{publication.journal && (
<p className="text-sm text-gray-600">
<strong>Journal:</strong> {publication.journal}
</p>
)}
{publication.publisher && (
<p className="text-sm text-gray-600">
<strong>Publisher:</strong> {publication.publisher}
</p>
)}
</div>
<div>
<p className="text-sm text-gray-600">
<strong>Submitted:</strong> {new Date(publication.submissionDate).toLocaleDateString()}
</p>
{publication.publicationDate && (
<p className="text-sm text-gray-600">
<strong>Published:</strong> {new Date(publication.publicationDate).toLocaleDateString()}
</p>
)}
<p className="text-sm text-gray-600">
<strong>Citations:</strong> {publication.citations}
</p>
{publication.impactFactor && (
<p className="text-sm text-gray-600">
<strong>Impact Factor:</strong> {publication.impactFactor}
</p>
)}
</div>
</div>
<div className="flex items-center space-x-2 mb-4">
{publication.keywords.map((keyword) => (
<span key={keyword} className="px-2 py-1 bg-gray-100 text-gray-700 text-xs rounded">
{keyword}
</span>
))}
</div>
<div className="flex items-center justify-between">
<div className="flex items-center space-x-2">
{publication.doi && (
<span className="text-sm text-gray-500">DOI: {publication.doi}</span>
)}
</div>
<div className="flex items-center space-x-2">
<button className="p-2 text-gray-400 hover:text-gray-600">
<Bookmark className={`w-4 h-4 ${publication.isBookmarked ? 'text-blue-600 fill-current' : ''}`} />
</button>
<button className="p-2 text-gray-400 hover:text-gray-600">
<Eye className="w-4 h-4" />
</button>
<button className="p-2 text-gray-400 hover:text-gray-600">
<Edit className="w-4 h-4" />
</button>
{publication.fileUrl && (
<button className="p-2 text-gray-400 hover:text-gray-600">
<Download className="w-4 h-4" />
</button>
)}
<button className="p-2 text-gray-400 hover:text-gray-600">
<Share2 className="w-4 h-4" />
</button>
<button className="p-2 text-gray-400 hover:text-red-600">
<Trash2 className="w-4 h-4" />
</button>
</div>
</div>
</div>
</div>
</div>
))}
</div>
</div>
</div>
</div>
</div>
</LayoutWithSidebar>
);
};
export default JuristPublications;