Files
gridpilot.gg/apps/website/components/leagues/LeagueStandingsTable.tsx
2026-01-21 13:49:59 +01:00

51 lines
1.4 KiB
TypeScript

'use client';
import { LeaderboardTableShell } from '@/ui/LeaderboardTableShell';
import { LeaderboardList } from '@/ui/LeaderboardList';
import { RankingRow } from '@/components/leaderboards/RankingRow';
import { useRouter } from 'next/navigation';
import { routes } from '@/lib/routing/RouteConfig';
interface StandingEntry {
position: number;
driverName: string;
driverId?: string; // Added to support navigation
teamName?: string;
points: number;
wins: number;
podiums: number;
races: number;
avgFinish: number | null;
gap: string;
}
interface LeagueStandingsTableProps {
standings: StandingEntry[];
}
export function LeagueStandingsTable({ standings }: LeagueStandingsTableProps) {
const router = useRouter();
return (
<LeaderboardTableShell>
<LeaderboardList>
{standings.map((entry) => (
<RankingRow
key={entry.driverId || entry.driverName}
id={entry.driverId || ''}
rank={entry.position}
name={entry.driverName}
avatarUrl="" // Not provided in StandingEntry
nationality="INT"
skillLevel="pro"
racesCompleted={entry.races}
rating={0}
wins={entry.wins}
onClick={entry.driverId ? () => router.push(routes.driver.detail(entry.driverId!)) : undefined}
/>
))}
</LeaderboardList>
</LeaderboardTableShell>
);
}