Files
MOPC-Portal/src/components/jury/project-files-section.tsx
Matt 6ca39c976b
All checks were successful
Build and Push Docker Image / build (push) Successful in 7m45s
Competition/Round architecture: full platform rewrite (Phases 1-9)
Replace Pipeline/Stage system with Competition/Round architecture.
New schema: Competition, Round (7 types), JuryGroup, AssignmentPolicy,
ProjectRoundState, DeliberationSession, ResultLock, SubmissionWindow.
New services: round-engine, round-assignment, deliberation, result-lock,
submission-manager, competition-context, ai-prompt-guard.
Full admin/jury/applicant/mentor UI rewrite. AI prompt hardening with
structured prompts, retry logic, and injection detection. All legacy
pipeline/stage code removed. 4 new migrations + seed aligned.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 23:04:15 +01:00

80 lines
2.3 KiB
TypeScript

'use client'
import { trpc } from '@/lib/trpc/client'
import { FileViewer } from '@/components/shared/file-viewer'
import { Skeleton } from '@/components/ui/skeleton'
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
import { AlertCircle, FileX } from 'lucide-react'
interface ProjectFilesSectionProps {
projectId: string
roundId: string
}
export function ProjectFilesSection({ projectId, roundId }: ProjectFilesSectionProps) {
const { data: files, isLoading, error } = trpc.file.listByProject.useQuery({
projectId,
roundId,
})
if (isLoading) {
return <ProjectFilesSectionSkeleton />
}
if (error) {
return (
<Card>
<CardContent className="flex flex-col items-center justify-center py-8 text-center">
<AlertCircle className="h-12 w-12 text-destructive/50" />
<p className="mt-2 font-medium text-destructive">Failed to load files</p>
<p className="text-sm text-muted-foreground">
{error.message || 'An error occurred while loading project files'}
</p>
</CardContent>
</Card>
)
}
if (!files || files.length === 0) {
return (
<Card>
<CardContent className="flex flex-col items-center justify-center py-8 text-center">
<FileX className="h-12 w-12 text-muted-foreground/50" />
<p className="mt-2 font-medium">No files available</p>
<p className="text-sm text-muted-foreground">
This project has no files uploaded yet
</p>
</CardContent>
</Card>
)
}
return (
<div className="space-y-4">
<FileViewer files={files} />
</div>
)
}
function ProjectFilesSectionSkeleton() {
return (
<Card>
<CardHeader>
<Skeleton className="h-5 w-28" />
</CardHeader>
<CardContent className="space-y-3">
{[1, 2, 3].map((i) => (
<div key={i} className="flex items-center gap-3 rounded-lg border p-3">
<Skeleton className="h-10 w-10 rounded-lg" />
<div className="flex-1 space-y-2">
<Skeleton className="h-4 w-48" />
<Skeleton className="h-3 w-24" />
</div>
<Skeleton className="h-9 w-20" />
</div>
))}
</CardContent>
</Card>
)
}