'use client'; import DriverIdentity from '@/components/drivers/DriverIdentity'; import type { DriverDTO } from '@gridpilot/racing/application/dto/DriverDTO'; import type { LeagueDriverSeasonStatsDTO } from '@gridpilot/racing/application/dto/LeagueDriverSeasonStatsDTO'; interface StandingsTableProps { standings: LeagueDriverSeasonStatsDTO[]; drivers: DriverDTO[]; leagueId: string; } export default function StandingsTable({ standings, drivers, leagueId }: StandingsTableProps) { const getDriver = (driverId: string): DriverDTO | undefined => { return drivers.find((d) => d.id === driverId); }; if (standings.length === 0) { return (
| Pos | Driver | Team | Total Pts | Pts / Race | Started | Finished | DNF | No‑Shows | Penalty | Bonus | Avg Finish | Rating Δ |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| {row.position} |
{driver ? (
|
{row.teamName ?? '—'} |
{row.totalPoints}
{row.penaltyPoints > 0 || row.bonusPoints !== 0 ? (
base {row.basePoints}
{row.penaltyPoints > 0 && (
−{row.penaltyPoints}
)}
{row.bonusPoints !== 0 && (
+{row.bonusPoints}
)}
) : null}
|
{row.pointsPerRace.toFixed(2)} | {row.racesStarted} | {row.racesFinished} | {row.dnfs} | {row.noShows} | 0 ? 'text-red-400' : 'text-gray-300'}> {row.penaltyPoints > 0 ? `-${row.penaltyPoints}` : '—'} | {row.bonusPoints !== 0 ? `+${row.bonusPoints}` : '—'} | {row.avgFinish !== null ? row.avgFinish.toFixed(2) : '—'} | 0 ? 'text-green-400' : row.ratingChange && row.ratingChange < 0 ? 'text-red-400' : 'text-gray-300'}> {ratingDelta} |