website cleanup
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
"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 { 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";
|
||||
@@ -11,9 +11,9 @@ import { Clock, Grid3x3, TrendingDown, AlertCircle, Filter, Flag } from "lucide-
|
||||
type PenaltyType = "time_penalty" | "grid_penalty" | "points_deduction" | "disqualification" | "warning" | "license_points";
|
||||
|
||||
interface PenaltyHistoryListProps {
|
||||
protests: Protest[];
|
||||
races: Record<string, Race>;
|
||||
drivers: Record<string, DriverDTO>;
|
||||
protests: ProtestViewModel[];
|
||||
races: Record<string, RaceViewModel>;
|
||||
drivers: Record<string, DriverViewModel>;
|
||||
}
|
||||
|
||||
export function PenaltyHistoryList({
|
||||
@@ -21,7 +21,7 @@ export function PenaltyHistoryList({
|
||||
races,
|
||||
drivers,
|
||||
}: PenaltyHistoryListProps) {
|
||||
const [filteredProtests, setFilteredProtests] = useState<Protest[]>([]);
|
||||
const [filteredProtests, setFilteredProtests] = useState<ProtestViewModel[]>([]);
|
||||
const [filterType, setFilterType] = useState<"all">("all");
|
||||
|
||||
useEffect(() => {
|
||||
@@ -61,6 +61,8 @@ export function PenaltyHistoryList({
|
||||
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 (
|
||||
<Card key={protest.id} className="p-4">
|
||||
@@ -75,7 +77,7 @@ export function PenaltyHistoryList({
|
||||
Protest #{protest.id.substring(0, 8)}
|
||||
</h3>
|
||||
<p className="text-sm text-gray-400">
|
||||
Resolved {new Date(protest.reviewedAt || protest.filedAt).toLocaleDateString()}
|
||||
{resolvedDate ? `Resolved ${new Date(resolvedDate).toLocaleDateString()}` : 'Resolved'}
|
||||
</p>
|
||||
</div>
|
||||
<span className={`px-3 py-1 rounded-full text-xs font-medium flex-shrink-0 ${getStatusColor(protest.status)}`}>
|
||||
@@ -86,13 +88,15 @@ export function PenaltyHistoryList({
|
||||
<p className="text-gray-400">
|
||||
<span className="font-medium">{protester?.name || 'Unknown'}</span> vs <span className="font-medium">{accused?.name || 'Unknown'}</span>
|
||||
</p>
|
||||
{race && (
|
||||
{race && incident && (
|
||||
<p className="text-gray-500">
|
||||
{race.track} ({race.car}) - Lap {protest.incident.lap}
|
||||
{race.track} ({race.car}) - Lap {incident.lap}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
<p className="text-gray-300 text-sm">{protest.incident.description}</p>
|
||||
{incident && (
|
||||
<p className="text-gray-300 text-sm">{incident.description}</p>
|
||||
)}
|
||||
{protest.decisionNotes && (
|
||||
<div className="mt-2 p-2 rounded bg-iron-gray/30 border border-charcoal-outline/50">
|
||||
<p className="text-xs text-gray-400">
|
||||
|
||||
Reference in New Issue
Block a user