mirror of
https://github.com/AmanTahiliani/box-box.git
synced 2026-08-07 19:56:18 -04:00
Upgrade live timing page for race weekends
- Track status flag banner (green/yellow/SC/VSC/red, defensive mapping) - Weather strip: air/track temp, humidity, wind with compass, rain badge - Gap trend sparklines from a per-driver interval ring buffer - Battle detection: consecutive cars within 1.0s chained and highlighted - Stint history column with compound sequence per driver - Pinnable drivers (max 3) with focus cards, persisted to localStorage Pure logic lives in lib/gapHistory.ts and lib/battles.ts with unit tests; 137 frontend tests passing. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
51
frontend/src/components/live/WeatherStrip.tsx
Normal file
51
frontend/src/components/live/WeatherStrip.tsx
Normal file
@@ -0,0 +1,51 @@
|
||||
import type { LiveWeatherData } from '../../types'
|
||||
import { windDirectionLabel } from '../../lib/live'
|
||||
|
||||
interface Props {
|
||||
weather: LiveWeatherData | null | undefined
|
||||
}
|
||||
|
||||
export function WeatherStrip({ weather }: Props) {
|
||||
if (!weather) return null
|
||||
const hasData =
|
||||
weather.AirTemp > 0 ||
|
||||
weather.TrackTemp > 0 ||
|
||||
weather.Humidity > 0 ||
|
||||
weather.WindSpeed > 0 ||
|
||||
weather.Rainfall
|
||||
if (!hasData) return null
|
||||
|
||||
const windDir = windDirectionLabel(weather.WindDir)
|
||||
|
||||
return (
|
||||
<div className="live-weather-strip" data-testid="weather-strip">
|
||||
{weather.AirTemp > 0 && (
|
||||
<span className="weather-item">
|
||||
<span className="weather-k">air</span>
|
||||
<span className="weather-v">{weather.AirTemp.toFixed(0)}°C</span>
|
||||
</span>
|
||||
)}
|
||||
{weather.TrackTemp > 0 && (
|
||||
<span className="weather-item">
|
||||
<span className="weather-k">track</span>
|
||||
<span className="weather-v">{weather.TrackTemp.toFixed(0)}°C</span>
|
||||
</span>
|
||||
)}
|
||||
{weather.Humidity > 0 && (
|
||||
<span className="weather-item">
|
||||
<span className="weather-k">hum</span>
|
||||
<span className="weather-v">{weather.Humidity.toFixed(0)}%</span>
|
||||
</span>
|
||||
)}
|
||||
{weather.WindSpeed > 0 && (
|
||||
<span className="weather-item">
|
||||
<span className="weather-k">wind</span>
|
||||
<span className="weather-v">
|
||||
{weather.WindSpeed.toFixed(1)} m/s{windDir ? ` ${windDir}` : ''}
|
||||
</span>
|
||||
</span>
|
||||
)}
|
||||
{weather.Rainfall && <span className="badge badge-wet">RAIN</span>}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user