'use client'; import React from 'react'; import { AlertCircle, AlertTriangle, Video } from 'lucide-react'; import { Card } from '@/ui/Card'; import { Box } from '@/ui/Box'; import { Stack } from '@/ui/Stack'; import { Text } from '@/ui/Text'; import { Link } from '@/ui/Link'; import { Button } from '@/ui/Button'; import { Icon } from '@/ui/Icon'; import { Surface } from '@/ui/Surface'; interface Protest { id: string; status: string; protestingDriverId: string; accusedDriverId: string; filedAt: string; incident: { lap: number; description: string; }; proofVideoUrl?: string; decisionNotes?: string; } interface Driver { id: string; name: string; } interface ProtestCardProps { protest: Protest; protester?: Driver; accused?: Driver; isAdmin: boolean; onReview: (id: string) => void; formatDate: (date: string) => string; } export function ProtestCard({ protest, protester, accused, isAdmin, onReview, formatDate }: ProtestCardProps) { const daysSinceFiled = Math.floor( (Date.now() - new Date(protest.filedAt).getTime()) / (1000 * 60 * 60 * 24) ); const isUrgent = daysSinceFiled > 2 && protest.status === 'pending'; const getStatusBadge = (status: string) => { const variants: Record = { pending: { bg: 'rgba(245, 158, 11, 0.2)', text: '#f59e0b', label: 'Pending' }, under_review: { bg: 'rgba(245, 158, 11, 0.2)', text: '#f59e0b', label: 'Pending' }, upheld: { bg: 'rgba(239, 68, 68, 0.2)', text: '#ef4444', label: 'Upheld' }, dismissed: { bg: 'rgba(115, 115, 115, 0.2)', text: '#9ca3af', label: 'Dismissed' }, withdrawn: { bg: 'rgba(59, 130, 246, 0.2)', text: '#3b82f6', label: 'Withdrawn' }, }; const config = variants[status] || variants.pending; return ( {config.label} ); }; return ( {protester?.name || 'Unknown'} vs {accused?.name || 'Unknown'} {getStatusBadge(protest.status)} {isUrgent && ( {daysSinceFiled}d old )} Lap {protest.incident.lap} Filed {formatDate(protest.filedAt)} {protest.proofVideoUrl && ( <> Video Evidence )} {protest.incident.description} {protest.decisionNotes && ( Steward Decision {protest.decisionNotes} )} {isAdmin && protest.status === 'pending' && ( )} ); }