'use client' import { useState } from 'react' import { trpc } from '@/lib/trpc/client' import { Card, CardContent, } from '@/components/ui/card' import { Badge } from '@/components/ui/badge' import { Button } from '@/components/ui/button' import { Skeleton } from '@/components/ui/skeleton' import { FileText, Video, Link as LinkIcon, File, Download, ExternalLink, BookOpen, } from 'lucide-react' const resourceTypeIcons = { PDF: FileText, VIDEO: Video, DOCUMENT: File, LINK: LinkIcon, OTHER: File, } const cohortColors: Record = { ALL: 'bg-gray-100 text-gray-800', SEMIFINALIST: 'bg-blue-100 text-blue-800', FINALIST: 'bg-purple-100 text-purple-800', } export default function MentorResourcesPage() { const [downloadingId, setDownloadingId] = useState(null) const { data, isLoading } = trpc.learningResource.myResources.useQuery({}) const utils = trpc.useUtils() const handleDownload = async (resourceId: string) => { setDownloadingId(resourceId) try { const { url } = await utils.learningResource.getDownloadUrl.fetch({ id: resourceId }) window.open(url, '_blank') } catch (error) { console.error('Download failed:', error) } finally { setDownloadingId(null) } } if (isLoading) { return (

Mentor Resources

Guides and materials to help you mentor effectively

{[1, 2, 3].map((i) => (
))}
) } const resources = data?.resources || [] return (

Mentor Resources

Guides and materials to help you mentor effectively

{resources.length === 0 ? (

No resources available yet

Mentor guides and training materials will appear here once they are published by the program administrators.

) : (
{resources.map((resource) => { const Icon = resourceTypeIcons[resource.resourceType as keyof typeof resourceTypeIcons] || File const isDownloading = downloadingId === resource.id return (

{resource.title}

{resource.description && (

{resource.description}

)}
{resource.cohortLevel} {resource.resourceType}
{resource.externalUrl ? ( ) : resource.objectKey ? ( ) : null}
) })}
)}
) }