update fastestLapDriverId to be nullable
This commit is contained in:
@@ -75,7 +75,7 @@ export function TracksEditor({ tracks, drivers, pointsTable, onChange }: TracksE
|
|||||||
id: crypto.randomUUID(),
|
id: crypto.randomUUID(),
|
||||||
name: `Race ${tracks.length + 1}`,
|
name: `Race ${tracks.length + 1}`,
|
||||||
results: drivers.map((d) => ({ driverId: d.id, score: 'DNS' as const })),
|
results: drivers.map((d) => ({ driverId: d.id, score: 'DNS' as const })),
|
||||||
fastestLapDriverId: ''
|
fastestLapDriverId: null
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
};
|
};
|
||||||
@@ -95,8 +95,8 @@ export function TracksEditor({ tracks, drivers, pointsTable, onChange }: TracksE
|
|||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<label className="text-xs text-gray-400">FL Driver:</label>
|
<label className="text-xs text-gray-400">FL Driver:</label>
|
||||||
<select
|
<select
|
||||||
value={track.fastestLapDriverId}
|
value={track.fastestLapDriverId ?? ''}
|
||||||
onChange={(e) => updateTrack(ti, { fastestLapDriverId: e.target.value })}
|
onChange={(e) => updateTrack(ti, { fastestLapDriverId: e.target.value || null })}
|
||||||
className="rounded bg-gray-600 px-2 py-1 text-sm text-white"
|
className="rounded bg-gray-600 px-2 py-1 text-sm text-white"
|
||||||
>
|
>
|
||||||
<option value="">—</option>
|
<option value="">—</option>
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ export const leaderboardTrackSchema = z.object({
|
|||||||
id: z.string(),
|
id: z.string(),
|
||||||
name: z.string().min(1),
|
name: z.string().min(1),
|
||||||
results: z.array(z.object({ driverId: z.string(), score: resultValueSchema })),
|
results: z.array(z.object({ driverId: z.string(), score: resultValueSchema })),
|
||||||
fastestLapDriverId: z.string()
|
fastestLapDriverId: z.string().nullable()
|
||||||
});
|
});
|
||||||
export type LeaderboardTrack = z.infer<typeof leaderboardTrackSchema>;
|
export type LeaderboardTrack = z.infer<typeof leaderboardTrackSchema>;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user