'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 { Badge } from '@/components/ui/badge' import { Button } from '@/components/ui/button' import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from '@/components/ui/card' import { Skeleton } from '@/components/ui/skeleton' import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert' import { StatusTracker } from '@/components/shared/status-tracker' import { AnimatedCard } from '@/components/shared/animated-container' import { FileText, Calendar, Clock, AlertCircle, CheckCircle, Users, Crown, MessageSquare, Upload, ArrowRight, } from 'lucide-react' const statusColors: Record = { DRAFT: 'secondary', SUBMITTED: 'default', UNDER_REVIEW: 'default', ELIGIBLE: 'default', SEMIFINALIST: 'success', FINALIST: 'success', WINNER: 'success', REJECTED: 'destructive', } export default function ApplicantDashboardPage() { const { status: sessionStatus } = useSession() const isAuthenticated = sessionStatus === 'authenticated' const { data, isLoading } = trpc.applicant.getMyDashboard.useQuery(undefined, { enabled: isAuthenticated, }) if (sessionStatus === 'loading' || isLoading) { return (
) } // No project yet if (!data?.project) { return (

My Project

Your applicant dashboard

No Project Yet

You haven't submitted a project yet. Check for open application rounds on the MOPC website.

) } const { project, timeline, currentStatus, openRounds } = data const isDraft = !project.submittedAt const programYear = project.round?.program?.year const roundName = project.round?.name return (
{/* Header */}

{project.title}

{currentStatus && ( {currentStatus.replace('_', ' ')} )}

{programYear ? `${programYear} Edition` : ''}{roundName ? ` - ${roundName}` : ''}

{/* Draft warning */} {isDraft && ( Draft Submission This submission has not been submitted yet. You can continue editing and submit when ready. )}
{/* Main content */}
{/* Project details */} Project Details {project.teamName && (

Team/Organization

{project.teamName}

)} {project.description && (

Description

{project.description}

)} {project.tags && project.tags.length > 0 && (

Tags

{project.tags.map((tag) => ( {tag} ))}
)} {/* Metadata */} {project.metadataJson && Object.keys(project.metadataJson as Record).length > 0 && (

Additional Information

{Object.entries(project.metadataJson as Record).map(([key, value]) => (
{key.replace(/_/g, ' ')}
{String(value)}
))}
)} {/* Meta info row */}
Created {new Date(project.createdAt).toLocaleDateString()}
{project.submittedAt ? (
Submitted {new Date(project.submittedAt).toLocaleDateString()}
) : (
Draft
)}
{project.files.length} file(s)
{/* Quick actions */}

Documents

{openRounds.length > 0 ? `${openRounds.length} round(s) open` : 'View uploads'}

Team

{project.teamMembers.length} member(s)

Mentor

{project.mentorAssignment?.mentor?.name || 'Not assigned'}

{/* Sidebar */}
{/* Status timeline */} Status Timeline {/* Team overview */}
Team
{project.teamMembers.length > 0 ? ( project.teamMembers.slice(0, 5).map((member) => (
{member.role === 'LEAD' ? ( ) : ( {member.user.name?.charAt(0).toUpperCase() || '?'} )}

{member.user.name || member.user.email}

{member.role === 'LEAD' ? 'Team Lead' : member.role === 'ADVISOR' ? 'Advisor' : 'Member'}

)) ) : (

No team members yet

)} {project.teamMembers.length > 5 && (

+{project.teamMembers.length - 5} more

)}
{/* Key dates */} Key Dates
Created {new Date(project.createdAt).toLocaleDateString()}
{project.submittedAt && (
Submitted {new Date(project.submittedAt).toLocaleDateString()}
)}
Last Updated {new Date(project.updatedAt).toLocaleDateString()}
{project.round?.submissionDeadline && (
Deadline {new Date(project.round.submissionDeadline).toLocaleDateString()}
)}
) }