website refactor
This commit is contained in:
@@ -30,21 +30,22 @@ interface StandingEntry {
|
||||
|
||||
interface LeagueStandingsTableProps {
|
||||
standings: StandingEntry[];
|
||||
'data-testid'?: string;
|
||||
}
|
||||
|
||||
export function LeagueStandingsTable({ standings }: LeagueStandingsTableProps) {
|
||||
export function LeagueStandingsTable({ standings, 'data-testid': dataTestId }: LeagueStandingsTableProps) {
|
||||
const router = useRouter();
|
||||
|
||||
if (!standings || standings.length === 0) {
|
||||
return (
|
||||
<Box p={12} textAlign="center" border borderColor="zinc-800" bg="zinc-900/30">
|
||||
<Box p={12} textAlign="center" border borderColor="zinc-800" bg="zinc-900/30" data-testid={dataTestId}>
|
||||
<Text color="text-zinc-500" italic>No standings data available for this season.</Text>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<LeaderboardTableShell>
|
||||
<LeaderboardTableShell data-testid={dataTestId}>
|
||||
<LeaderboardList>
|
||||
{standings.map((entry) => (
|
||||
<RankingRow
|
||||
@@ -60,6 +61,8 @@ export function LeagueStandingsTable({ standings }: LeagueStandingsTableProps) {
|
||||
rating={0}
|
||||
wins={entry.wins}
|
||||
onClick={entry.driverId ? () => router.push(routes.driver.detail(entry.driverId!)) : undefined}
|
||||
data-testid="standings-row"
|
||||
droppedRaceIds={entry.droppedRaceIds}
|
||||
/>
|
||||
))}
|
||||
</LeaderboardList>
|
||||
|
||||
Reference in New Issue
Block a user