'use client' import Link from 'next/link' import type { Route } from 'next' import { useRouter } from 'next/navigation' import { trpc } from '@/lib/trpc/client' import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card' import { Badge } from '@/components/ui/badge' import { Skeleton } from '@/components/ui/skeleton' import { Button } from '@/components/ui/button' import { StatusBadge } from '@/components/shared/status-badge' import { ProjectLogo } from '@/components/shared/project-logo' import { ArrowLeft, ArrowRight, ClipboardList, CheckCircle2, Clock, FileEdit, } from 'lucide-react' import { formatDateOnly, formatEnumLabel } from '@/lib/utils' import { CountryDisplay } from '@/components/shared/country-display' export default function JuryAssignmentsPage() { const router = useRouter() const { data: assignments, isLoading } = trpc.assignment.myAssignments.useQuery({}) if (isLoading) { return (
{[1, 2, 3, 4].map((i) => ( ))}
) } // Group assignments by round const byRound = new Map() for (const a of assignments ?? []) { if (!a.round) continue if (!byRound.has(a.round.id)) { byRound.set(a.round.id, { round: a.round, items: [] }) } byRound.get(a.round.id)!.items!.push(a) } const roundGroups = Array.from(byRound.values()) return (

My Assignments

Projects assigned to you for evaluation

{roundGroups.length === 0 ? (

No Assignments

You don't have any assignments yet. Assignments will appear once an administrator assigns projects to you.

) : (
{roundGroups.map(({ round, items }) => { const completed = (items ?? []).filter( (a) => a.evaluation?.status === 'SUBMITTED' ).length const total = items?.length ?? 0 return (
{round.name} {formatEnumLabel(round.roundType)} {round.status !== 'ROUND_ACTIVE' && ( {formatEnumLabel(round.status)} )} {completed}/{total} completed {round.windowCloseAt && ( Due {formatDateOnly(round.windowCloseAt)} )}
{(items ?? []).map((assignment) => { const project = assignment.project const evalStatus = assignment.evaluation?.status const isSubmitted = evalStatus === 'SUBMITTED' const isDraft = evalStatus === 'DRAFT' return (

{project.title}

{project.teamName}{project.teamName && project.country ? ' ยท ' : ''}{project.country ? : ''}

{isSubmitted ? ( Submitted ) : isDraft ? ( Draft ) : ( Pending )}
) })}
) })}
)}
) }