'use client' import { useSession } from 'next-auth/react' import { trpc } from '@/lib/trpc/client' import { Badge } from '@/components/ui/badge' import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from '@/components/ui/card' import { Skeleton } from '@/components/ui/skeleton' import { RequirementUploadList } from '@/components/shared/requirement-upload-slot' import { FileText, Upload, AlertTriangle, Clock, Video, File, Download, } from 'lucide-react' const fileTypeIcons: Record = { EXEC_SUMMARY: FileText, BUSINESS_PLAN: FileText, PRESENTATION: FileText, VIDEO_PITCH: Video, VIDEO: Video, OTHER: File, SUPPORTING_DOC: File, } const fileTypeLabels: Record = { EXEC_SUMMARY: 'Executive Summary', BUSINESS_PLAN: 'Business Plan', PRESENTATION: 'Presentation', VIDEO_PITCH: 'Video Pitch', VIDEO: 'Video', OTHER: 'Other Document', SUPPORTING_DOC: 'Supporting Document', } export default function ApplicantDocumentsPage() { const { status: sessionStatus } = useSession() const isAuthenticated = sessionStatus === 'authenticated' const { data, isLoading } = trpc.applicant.getMyDashboard.useQuery(undefined, { enabled: isAuthenticated, }) if (isLoading) { return (
) } if (!data?.project) { return (

Documents

No Project

Submit a project first to upload documents.

) } const { project, openRounds } = data const isDraft = !project.submittedAt return (
{/* Header */}

Documents

Upload and manage documents for your project: {project.title}

{/* Per-round upload sections */} {openRounds.length > 0 && (
{openRounds.map((round: { id: string; name: string; windowCloseAt?: string | Date | null }) => { const now = new Date() const hasDeadline = !!round.windowCloseAt const deadlinePassed = hasDeadline && now > new Date(round.windowCloseAt!) const isLate = deadlinePassed return (
{round.name} Upload documents for this round
{isLate && ( Late submission )} {hasDeadline && !deadlinePassed && ( Due {new Date(round.windowCloseAt!).toLocaleDateString()} )}
) })}
)} {/* Uploaded files list */} All Uploaded Documents All files associated with your project {project.files.length === 0 ? (

No documents uploaded yet

) : (
{project.files.map((file) => { const Icon = fileTypeIcons[file.fileType] || File const fileRecord = file as typeof file & { isLate?: boolean; roundId?: string | null } return (

{file.fileName}

{fileRecord.isLate && ( Late )}

{fileTypeLabels[file.fileType] || file.fileType} {' - '} {new Date(file.createdAt).toLocaleDateString()}

) })}
)}
{/* No open rounds message */} {openRounds.length === 0 && project.files.length === 0 && (

No rounds are currently open for document submissions.

)}
) }