'use client' import { Suspense, use } from 'react' import Link from 'next/link' import type { Route } from 'next' import { trpc } from '@/lib/trpc/client' import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from '@/components/ui/card' import { Button } from '@/components/ui/button' import { Badge } from '@/components/ui/badge' import { Skeleton } from '@/components/ui/skeleton' import { Separator } from '@/components/ui/separator' import { FileViewer } from '@/components/shared/file-viewer' import { ProjectLogoWithUrl } from '@/components/shared/project-logo-with-url' import { ArrowLeft, AlertCircle, Users, MapPin, Waves, GraduationCap, Crown, Mail, Phone, Calendar, FileText, ExternalLink, } from 'lucide-react' import { formatDateOnly, getInitials } from '@/lib/utils' interface PageProps { params: Promise<{ id: string }> } // Status badge colors const statusColors: Record = { SUBMITTED: 'secondary', ELIGIBLE: 'default', ASSIGNED: 'default', SEMIFINALIST: 'default', FINALIST: 'default', REJECTED: 'destructive', } function ProjectDetailContent({ projectId }: { projectId: string }) { const { data: project, isLoading, error } = trpc.mentor.getProjectDetail.useQuery({ projectId, }) if (isLoading) { return } if (error || !project) { return (

{error?.message || 'Project Not Found'}

You may not have access to view this project.

) } const teamLead = project.teamMembers?.find((m) => m.role === 'LEAD') const otherMembers = project.teamMembers?.filter((m) => m.role !== 'LEAD') || [] return (
{/* Header */}
{project.round.program.year} Edition {project.round.name}

{project.title}

{project.status.replace('_', ' ')}
{project.teamName && (

{project.teamName}

)}
{project.assignedAt && (
Assigned to you on {formatDateOnly(project.assignedAt)}
)} {/* Project Info */} Project Information {/* Category & Ocean Issue badges */}
{project.competitionCategory && ( {project.competitionCategory === 'STARTUP' ? 'Start-up' : 'Business Concept'} )} {project.oceanIssue && ( {project.oceanIssue.replace(/_/g, ' ')} )}
{project.description && (

Description

{project.description}

)} {/* Location & Institution */}
{(project.country || project.geographicZone) && (

Location

{[project.geographicZone, project.country].filter(Boolean).join(', ')}

)} {project.institution && (

Institution

{project.institution}

)}
{/* Submission URLs */} {(project.phase1SubmissionUrl || project.phase2SubmissionUrl) && (

Submission Links

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

Tags

{project.tags.map((tag) => ( {tag} ))}
)}
{/* Team Members Section */} Team Members ({project.teamMembers?.length || 0}) Contact information for the project team {/* Team Lead */} {teamLead && (

{teamLead.user.name || 'Unnamed'}

Team Lead
{teamLead.title && (

{teamLead.title}

)}
)} {/* Other Team Members */} {otherMembers.length > 0 && (
{otherMembers.map((member) => (
{getInitials(member.user.name || member.user.email)}

{member.user.name || 'Unnamed'}

{member.role === 'ADVISOR' ? 'Advisor' : 'Member'}
{member.title && (

{member.title}

)} {member.user.email}
))}
)} {!project.teamMembers?.length && (

No team members listed for this project.

)}
{/* Files Section */} Project Files Documents and materials submitted by the team {project.files && project.files.length > 0 ? ( ({ id: f.id, fileName: f.fileName, fileType: f.fileType, mimeType: f.mimeType, size: f.size, bucket: f.bucket, objectKey: f.objectKey, }))} /> ) : (

No files have been uploaded for this project yet.

)}
) } function ProjectDetailSkeleton() { return (
) } export default function MentorProjectDetailPage({ params }: PageProps) { const { id } = use(params) return ( }> ) }