"use client"; import { useState, useEffect } from "react"; import { ProtestViewModel } from "../../lib/view-models/ProtestViewModel"; import { RaceViewModel } from "../../lib/view-models/RaceViewModel"; import { DriverViewModel } from "../../lib/view-models/DriverViewModel"; import Card from "../ui/Card"; import Button from "../ui/Button"; import { Clock, Grid3x3, TrendingDown, AlertCircle, Filter, Flag } from "lucide-react"; interface PenaltyHistoryListProps { protests: ProtestViewModel[]; races: Record; drivers: Record; } export function PenaltyHistoryList({ protests, races, drivers, }: PenaltyHistoryListProps) { const [filteredProtests, setFilteredProtests] = useState([]); const [filterType, setFilterType] = useState<"all">("all"); useEffect(() => { setFilteredProtests(protests); }, [protests]); const getStatusColor = (status: string) => { switch (status) { case "upheld": return "text-red-400 bg-red-500/20"; case "dismissed": return "text-gray-400 bg-gray-500/20"; case "withdrawn": return "text-blue-400 bg-blue-500/20"; default: return "text-orange-400 bg-orange-500/20"; } }; return (
{filteredProtests.length === 0 ? (

No Resolved Protests

No protests have been resolved in this league

) : (
{filteredProtests.map((protest) => { const race = races[protest.raceId]; const protester = drivers[protest.protestingDriverId]; const accused = drivers[protest.accusedDriverId]; const incident = protest.incident; const resolvedDate = protest.reviewedAt || protest.filedAt; return (

Protest #{protest.id.substring(0, 8)}

{resolvedDate ? `Resolved ${new Date(resolvedDate).toLocaleDateString()}` : 'Resolved'}

{protest.status.toUpperCase()}

{protester?.name || 'Unknown'} vs {accused?.name || 'Unknown'}

{race && incident && (

{race.track} ({race.car}) - Lap {incident.lap}

)}
{incident && (

{incident.description}

)} {protest.decisionNotes && (

Steward Notes: {protest.decisionNotes}

)}
); })}
)}
); }