Files
MOPC-Portal/src/app/(applicant)/applicant/competition/page.tsx
Matt 5a609457c2
All checks were successful
Build and Push Docker Image / build (push) Successful in 9m6s
Overhaul applicant portal: timeline, evaluations, nav, resources
- Fix programId/competitionId bug in competition timeline
- Add applicantVisibility config to EvaluationConfigSchema (JSONB)
- Add admin UI card for controlling applicant feedback visibility
- Add 6 new tRPC procedures: getNavFlags, getMyCompetitionTimeline,
  getMyEvaluations, getUpcomingDeadlines, getDocumentCompleteness,
  and extend getMyDashboard with hasPassedIntake
- Rewrite competition timeline to show only EVALUATION + Grand Finale,
  synthesize FILTERING rejections, handle manually-created projects
- Dynamic ApplicantNav with conditional Evaluations/Mentoring/Resources
- Dashboard: conditional timeline, jury feedback card, deadlines,
  document completeness, conditional mentor tile
- New /applicant/evaluations page with anonymous jury feedback
- New /applicant/resources pages (clone of jury learning hub)
- Rename /applicant/competitions → /applicant/competition
- Remove broken /applicant/competitions/[windowId] page
- Add permission info banner to team invite dialog

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 19:51:17 +01:00

124 lines
4.7 KiB
TypeScript

'use client'
import { useSession } from 'next-auth/react'
import Link from 'next/link'
import type { Route } from 'next'
import { trpc } from '@/lib/trpc/client'
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
import { Button } from '@/components/ui/button'
import { Skeleton } from '@/components/ui/skeleton'
import { ApplicantCompetitionTimeline } from '@/components/applicant/competition-timeline'
import { ArrowLeft, FileText, Calendar } from 'lucide-react'
export default function ApplicantCompetitionPage() {
const { data: session } = useSession()
const { data: myProject, isLoading } = trpc.applicant.getMyDashboard.useQuery(undefined, {
enabled: !!session,
})
if (isLoading) {
return (
<div className="space-y-6">
<Skeleton className="h-8 w-64" />
<Skeleton className="h-96" />
</div>
)
}
const hasProject = !!myProject?.project
return (
<div className="space-y-6">
<div className="flex items-center justify-between">
<div>
<h1 className="text-2xl font-bold tracking-tight">Competition Timeline</h1>
<p className="text-muted-foreground mt-1">
Track your progress through competition rounds
</p>
</div>
<Button variant="ghost" size="sm" asChild>
<Link href={'/applicant' as Route} aria-label="Back to applicant dashboard">
<ArrowLeft className="mr-2 h-4 w-4" />
Back to Dashboard
</Link>
</Button>
</div>
{!hasProject ? (
<Card>
<CardContent className="flex flex-col items-center justify-center py-12">
<FileText className="h-12 w-12 text-muted-foreground/50 mb-4" />
<h2 className="text-xl font-semibold mb-2">No Active Competition</h2>
<p className="text-muted-foreground text-center max-w-md">
You don&apos;t have an active project in any competition yet. Submit your application
when a competition opens.
</p>
</CardContent>
</Card>
) : (
<div className="grid gap-6 lg:grid-cols-3">
<div className="lg:col-span-2">
<ApplicantCompetitionTimeline />
</div>
<div className="space-y-4">
<Card>
<CardHeader>
<CardTitle className="flex items-center gap-2">
<Calendar className="h-5 w-5" />
Quick Actions
</CardTitle>
</CardHeader>
<CardContent className="space-y-3">
<Button variant="outline" className="w-full justify-start" asChild>
<Link href={'/applicant/documents' as Route}>
<FileText className="mr-2 h-4 w-4" />
View Documents
</Link>
</Button>
{myProject?.openRounds && myProject.openRounds.length > 0 && (
<p className="text-sm text-muted-foreground px-3 py-2 bg-muted/50 rounded-md">
{myProject.openRounds.length} submission window
{myProject.openRounds.length !== 1 ? 's' : ''} currently open
</p>
)}
</CardContent>
</Card>
<Card>
<CardHeader>
<CardTitle>Timeline Info</CardTitle>
</CardHeader>
<CardContent className="space-y-2 text-sm">
<div className="flex justify-between">
<span className="text-muted-foreground">Current Status:</span>
<span className="font-medium">
{myProject?.currentStatus || 'Unknown'}
</span>
</div>
{myProject?.project && (
<>
<div className="flex justify-between">
<span className="text-muted-foreground">Project:</span>
<span className="font-medium truncate ml-2" title={myProject.project.title}>
{myProject.project.title}
</span>
</div>
{myProject.project.submittedAt && (
<div className="flex justify-between">
<span className="text-muted-foreground">Submitted:</span>
<span className="font-medium">
{new Date(myProject.project.submittedAt).toLocaleDateString()}
</span>
</div>
)}
</>
)}
</CardContent>
</Card>
</div>
</div>
)}
</div>
)
}