'use client' import Link from 'next/link' import { motion } from 'motion/react' import { ClipboardList, ArrowRight } from 'lucide-react' import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from '@/components/ui/card' import { StatusBadge } from '@/components/shared/status-badge' import { ProjectLogo } from '@/components/shared/project-logo' import { getCountryName } from '@/lib/countries' import { formatDateOnly, truncate, formatRelativeTime } from '@/lib/utils' type BaseProject = { id: string title: string teamName: string | null country: string | null competitionCategory: string | null oceanIssue: string | null logoKey: string | null createdAt: Date submittedAt: Date | null status: string } type ActiveProject = BaseProject & { latestEvaluator: string | null latestScore: number | null evaluatedAt: Date | null } type ProjectListCompactProps = { projects: BaseProject[] activeProjects?: ActiveProject[] mode?: 'recent' | 'active' } export function ProjectListCompact({ projects, activeProjects, mode = 'recent', }: ProjectListCompactProps) { const isActiveMode = mode === 'active' && activeProjects && activeProjects.length > 0 const displayProjects = isActiveMode ? activeProjects : projects return (
{isActiveMode ? 'Recently Active' : 'Recent Projects'} {isActiveMode ? 'Latest evaluation activity' : 'Latest submissions'}
All projects
{displayProjects.length === 0 ? (

No projects submitted yet

) : (
{displayProjects.map((project, idx) => { const activeProject = isActiveMode ? (project as ActiveProject) : null return (

{truncate(project.title, 50)}

{activeProject?.latestScore != null ? ( {activeProject.latestScore.toFixed(1)}/10 ) : ( )}

{isActiveMode && activeProject ? ( <> {activeProject.latestEvaluator && ( {activeProject.latestEvaluator} )} {activeProject.evaluatedAt && ( · {formatRelativeTime(activeProject.evaluatedAt)} )} ) : ( [ project.teamName, project.country ? getCountryName(project.country) : null, formatDateOnly(project.submittedAt || project.createdAt), ] .filter(Boolean) .join(' \u00b7 ') )}

) })}
)}
) }