'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: groupedFiles, isLoading, error } = trpc.file.listByProjectForRound.useQuery({ projectId, roundId, }) if (isLoading) { return } if (error) { return (

Failed to load files

{error.message || 'An error occurred while loading project files'}

) } if (!groupedFiles || groupedFiles.length === 0) { return (

No files available

This project has no files uploaded yet

) } // Flatten all files from all round groups for FileViewer const allFiles = groupedFiles.flatMap((group) => group.files) return (
{groupedFiles.map((group) => (

{group.roundName}

))}
) } function ProjectFilesSectionSkeleton() { return ( {[1, 2, 3].map((i) => (
))}
) }