'use client' import Link from 'next/link' import type { Route } from 'next' import { trpc } from '@/lib/trpc/client' import { Card, CardContent, CardDescription, 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 { ArrowLeft, ArrowRight, ClipboardList, Target } from 'lucide-react' import { toast } from 'sonner' export default function JuryCompetitionsPage() { const { data: competitions, isLoading } = trpc.competition.getMyCompetitions.useQuery() if (isLoading) { return (
{[1, 2, 3].map((i) => ( ))}
) } return (

My Competitions

View competitions and rounds you're assigned to

{!competitions || competitions.length === 0 ? (

No Competitions

You don't have any active competition assignments yet.

) : (
{competitions.map((competition) => { const activeRounds = competition.rounds?.filter(r => r.status !== 'ROUND_ARCHIVED') || [] const totalRounds = competition.rounds?.length || 0 return (
{competition.name}
{totalRounds} round{totalRounds !== 1 ? 's' : ''}
{activeRounds.length > 0 ? ( activeRounds.slice(0, 2).map((round) => (
{round.name}
)) ) : (

No active rounds

)} {activeRounds.length > 2 && (

+{activeRounds.length - 2} more round{activeRounds.length - 2 !== 1 ? 's' : ''}

)}
) })}
)}
) }