import { Badge } from '@/components/ui/badge' import { Button } from '@/components/ui/button' import { TableCell, TableRow } from '@/components/ui/table' import type { ExtractionInfo } from '@/lib/api/services/extractions' import { formatDateDistanceToNow } from '@/utils/format-date' import { AlertCircle, Calendar, CheckCircle, Clock, ExternalLink, Loader2, User } from 'lucide-react' interface ExtractionsRowProps { extraction: ExtractionInfo } export function ExtractionsRow({ extraction }: ExtractionsRowProps) { const getStatusBadge = (status: ExtractionInfo['status']) => { switch (status) { case 'pending': return ( Pending ) case 'processing': return ( Processing ) case 'completed': return ( Completed ) case 'failed': return ( Failed ) } } const getServiceBadge = (service: string | undefined) => { if (!service) return - const serviceColors: Record = { youtube: 'bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-300', soundcloud: 'bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-300', vimeo: 'bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-300', tiktok: 'bg-pink-100 text-pink-800 dark:bg-pink-900 dark:text-pink-300', twitter: 'bg-sky-100 text-sky-800 dark:bg-sky-900 dark:text-sky-300', instagram: 'bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-300', } const colorClass = serviceColors[service.toLowerCase()] || 'bg-gray-100 text-gray-800 dark:bg-gray-900 dark:text-gray-300' return ( {service.toUpperCase()} ) } return ( {extraction.title || 'Extracting...'} {extraction.url} {getServiceBadge(extraction.service)} {extraction.user_name || 'Unknown'} {getStatusBadge(extraction.status)} {extraction.error && ( {extraction.error} )} {formatDateDistanceToNow(extraction.created_at)} ) }