"use client"; import { useState, useEffect } from "react"; import { Protest } from "@gridpilot/racing/domain/entities/Protest"; import { Race } from "@gridpilot/racing/domain/entities/Race"; import { DriverDTO } from "@gridpilot/racing/application/dto/DriverDTO"; import Card from "../ui/Card"; import Button from "../ui/Button"; import { Clock, Grid3x3, TrendingDown, AlertCircle, Filter, Flag } from "lucide-react"; type PenaltyType = "time_penalty" | "grid_penalty" | "points_deduction" | "disqualification" | "warning" | "license_points"; interface PenaltyHistoryListProps { protests: Protest[]; 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]; return (

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

Resolved {new Date(protest.reviewedAt || protest.filedAt).toLocaleDateString()}

{protest.status.toUpperCase()}

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

{race && (

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

)}

{protest.incident.description}

{protest.decisionNotes && (

Steward Notes: {protest.decisionNotes}

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