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 { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from '@/components/ui/table' import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from '@/components/ui/dropdown-menu' import { Plus, MoreHorizontal, ClipboardList, Eye, Pencil, FileUp, Users, } from 'lucide-react' import { formatDateOnly, truncate } from '@/lib/utils' import { ProjectLogo } from '@/components/shared/project-logo' async function ProjectsContent() { const projects = await prisma.project.findMany({ // Note: PROGRAM_ADMIN filtering should be handled via middleware or a separate relation select: { id: true, title: true, teamName: true, status: true, logoKey: true, createdAt: true, round: { select: { id: true, name: true, status: true, program: { select: { name: true, }, }, }, }, _count: { select: { assignments: true, files: true, }, }, }, orderBy: { createdAt: 'desc' }, take: 100, }) if (projects.length === 0) { return (

No projects yet

Import projects via CSV or create them manually

) } const statusColors: Record = { SUBMITTED: 'secondary', UNDER_REVIEW: 'default', SHORTLISTED: 'success', FINALIST: 'success', WINNER: 'success', REJECTED: 'destructive', WITHDRAWN: 'secondary', } return ( <> {/* Desktop table view */} Project Round Files Assignments Status Actions {projects.map((project) => (

{truncate(project.title, 40)}

{project.teamName}

{project.round.name}

{project.round.program.name}

{project._count.files}
{project._count.assignments}
{project.status.replace('_', ' ')} View Details Edit Manage Assignments
))}
{/* Mobile card view */}
{projects.map((project) => (
{project.title} {project.status.replace('_', ' ')}
{project.teamName}
Round {project.round.name}
Assignments {project._count.assignments} jurors
))}
) } function ProjectsSkeleton() { return (
{[...Array(5)].map((_, i) => (
))}
) } export default function ProjectsPage() { return (
{/* Header */}

Projects

Manage submitted projects across all rounds

{/* Content */} }>
) }