All checks were successful
Build and Push Docker Image / build (push) Successful in 8m43s
- Extract round detail monolith (2900→600 lines) into 13 standalone components - Add shared round/status config (round-config.ts) replacing 4 local copies - Delete 12 legacy competition-scoped pages, merge project pool into projects page - Add round-type-specific dashboard stat panels (submission, mentoring, live final, deliberation, summary) - Add contextual header quick actions based on active round type - Improve pipeline visualization: progress bars, checkmarks, chevron connectors, overflow fix - Add config tab completion dots (green/amber/red) and inline validation warnings - Enhance juries page with round assignments, member avatars, and cap mode badges - Add context-aware project list (recent submissions vs active evaluations) - Move competition settings into Manage Editions page Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
161 lines
5.3 KiB
TypeScript
161 lines
5.3 KiB
TypeScript
import { notFound } from 'next/navigation'
|
|
import Link from 'next/link'
|
|
import type { Route } from 'next'
|
|
import { api } from '@/lib/trpc/server'
|
|
import { Button } from '@/components/ui/button'
|
|
import { Badge } from '@/components/ui/badge'
|
|
import {
|
|
Card,
|
|
CardContent,
|
|
CardDescription,
|
|
CardHeader,
|
|
CardTitle,
|
|
} from '@/components/ui/card'
|
|
import {
|
|
Table,
|
|
TableBody,
|
|
TableCell,
|
|
TableHead,
|
|
TableHeader,
|
|
TableRow,
|
|
} from '@/components/ui/table'
|
|
import { ArrowLeft, Pencil, Plus } from 'lucide-react'
|
|
import { formatDateOnly } from '@/lib/utils'
|
|
import { CompetitionSettings } from '@/components/admin/program/competition-settings'
|
|
|
|
interface ProgramDetailPageProps {
|
|
params: Promise<{ id: string }>
|
|
}
|
|
|
|
const statusColors: Record<string, 'default' | 'success' | 'secondary' | 'destructive'> = {
|
|
DRAFT: 'secondary',
|
|
ACTIVE: 'default',
|
|
CLOSED: 'success',
|
|
ARCHIVED: 'secondary',
|
|
}
|
|
|
|
export default async function ProgramDetailPage({ params }: ProgramDetailPageProps) {
|
|
const { id } = await params
|
|
const caller = await api()
|
|
|
|
let program
|
|
try {
|
|
program = await caller.program.get({ id })
|
|
} catch {
|
|
notFound()
|
|
}
|
|
|
|
return (
|
|
<div className="space-y-6">
|
|
<div className="flex items-center justify-between">
|
|
<div className="flex items-center gap-4">
|
|
<Link href="/admin/programs">
|
|
<Button variant="ghost" size="icon">
|
|
<ArrowLeft className="h-4 w-4" />
|
|
</Button>
|
|
</Link>
|
|
<div>
|
|
<div className="flex items-center gap-2">
|
|
<h1 className="text-2xl font-bold">{program.name}</h1>
|
|
<Badge variant={statusColors[program.status] || 'secondary'}>
|
|
{program.status}
|
|
</Badge>
|
|
</div>
|
|
<p className="text-muted-foreground">
|
|
{program.year} Edition
|
|
</p>
|
|
</div>
|
|
</div>
|
|
<Button variant="outline" asChild>
|
|
<Link href={`/admin/programs/${id}/edit`}>
|
|
<Pencil className="mr-2 h-4 w-4" />
|
|
Edit
|
|
</Link>
|
|
</Button>
|
|
</div>
|
|
|
|
{program.description && (
|
|
<Card>
|
|
<CardHeader>
|
|
<CardTitle>Description</CardTitle>
|
|
</CardHeader>
|
|
<CardContent>
|
|
<p className="text-muted-foreground">{program.description}</p>
|
|
</CardContent>
|
|
</Card>
|
|
)}
|
|
|
|
{(() => {
|
|
const comp = (program as any).competitions?.[0]
|
|
if (!comp) return null
|
|
return (
|
|
<CompetitionSettings
|
|
competitionId={comp.id}
|
|
initialSettings={{
|
|
categoryMode: comp.categoryMode ?? 'SHARED',
|
|
startupFinalistCount: comp.startupFinalistCount ?? 3,
|
|
conceptFinalistCount: comp.conceptFinalistCount ?? 3,
|
|
notifyOnRoundAdvance: comp.notifyOnRoundAdvance ?? true,
|
|
notifyOnDeadlineApproach: comp.notifyOnDeadlineApproach ?? true,
|
|
deadlineReminderDays: comp.deadlineReminderDays ?? [7, 3, 1],
|
|
}}
|
|
/>
|
|
)
|
|
})()}
|
|
|
|
<Card>
|
|
<CardHeader className="flex flex-row items-center justify-between">
|
|
<div>
|
|
<CardTitle>Rounds</CardTitle>
|
|
<CardDescription>
|
|
Competition rounds for this program
|
|
</CardDescription>
|
|
</div>
|
|
<Button asChild>
|
|
<Link href={'/admin/rounds' as Route}>
|
|
<Plus className="mr-2 h-4 w-4" />
|
|
Manage Rounds
|
|
</Link>
|
|
</Button>
|
|
</CardHeader>
|
|
<CardContent>
|
|
{(program.stages as Array<{ id: string; name: string; status: string; _count: { projects: number; assignments: number }; createdAt?: Date }>).length === 0 ? (
|
|
<div className="py-8 text-center text-muted-foreground">
|
|
No rounds created yet. Set up a competition to get started.
|
|
</div>
|
|
) : (
|
|
<Table>
|
|
<TableHeader>
|
|
<TableRow>
|
|
<TableHead>Round</TableHead>
|
|
<TableHead>Status</TableHead>
|
|
<TableHead>Projects</TableHead>
|
|
<TableHead>Assignments</TableHead>
|
|
</TableRow>
|
|
</TableHeader>
|
|
<TableBody>
|
|
{(program.stages as Array<{ id: string; name: string; status: string; _count: { projects: number; assignments: number } }>).map((stage) => (
|
|
<TableRow key={stage.id}>
|
|
<TableCell>
|
|
<span className="font-medium">
|
|
{stage.name}
|
|
</span>
|
|
</TableCell>
|
|
<TableCell>
|
|
<Badge variant={statusColors[stage.status] || 'secondary'}>
|
|
{stage.status}
|
|
</Badge>
|
|
</TableCell>
|
|
<TableCell>{stage._count.projects}</TableCell>
|
|
<TableCell>{stage._count.assignments}</TableCell>
|
|
</TableRow>
|
|
))}
|
|
</TableBody>
|
|
</Table>
|
|
)}
|
|
</CardContent>
|
|
</Card>
|
|
</div>
|
|
)
|
|
}
|