import { Suspense } from 'react' import Link from 'next/link' import { prisma } from '@/lib/prisma' export const dynamic = 'force-dynamic' import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from '@/components/ui/card' import { Badge } from '@/components/ui/badge' import { Button } from '@/components/ui/button' import { Skeleton } from '@/components/ui/skeleton' import { Avatar, AvatarFallback } from '@/components/ui/avatar' import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from '@/components/ui/table' import type { Route } from 'next' import { Plus, GraduationCap, Eye } from 'lucide-react' import { formatDate, getInitials } from '@/lib/utils' async function MentorsContent() { const mentors = await prisma.user.findMany({ where: { role: 'MENTOR', }, include: { _count: { select: { mentorAssignments: true, }, }, }, orderBy: [{ status: 'asc' }, { name: 'asc' }], }) if (mentors.length === 0) { return (

No mentors yet

Invite mentors to start matching them with projects

) } const statusColors: Record = { ACTIVE: 'success', INVITED: 'secondary', SUSPENDED: 'destructive', } return ( <> {/* Desktop table view */} Mentor Expertise Assigned Projects Status Last Login Actions {mentors.map((mentor) => (
{getInitials(mentor.name || mentor.email || 'M')}

{mentor.name || 'Unnamed'}

{mentor.email}

{mentor.expertiseTags && mentor.expertiseTags.length > 0 ? (
{mentor.expertiseTags.slice(0, 3).map((tag) => ( {tag} ))} {mentor.expertiseTags.length > 3 && ( +{mentor.expertiseTags.length - 3} )}
) : ( - )}
{mentor._count.mentorAssignments} project{mentor._count.mentorAssignments !== 1 ? 's' : ''} {mentor.status} {mentor.lastLoginAt ? ( formatDate(mentor.lastLoginAt) ) : ( Never )}
))}
{/* Mobile card view */}
{mentors.map((mentor) => (
{getInitials(mentor.name || mentor.email || 'M')}
{mentor.name || 'Unnamed'} {mentor.email}
{mentor.status}
Assigned Projects {mentor._count.mentorAssignments}
{mentor.expertiseTags && mentor.expertiseTags.length > 0 && (
{mentor.expertiseTags.map((tag) => ( {tag} ))}
)}
))}
) } function MentorsSkeleton() { return (
{[...Array(5)].map((_, i) => (
))}
) } export default function MentorsPage() { return (
{/* Header */}

Mentors

Manage mentors and their project assignments

{/* Content */} }>
) }