feat(ui): Session-aware live timing enhancements
10
frontend/package-lock.json
generated
@@ -10,6 +10,7 @@
|
||||
"dependencies": {
|
||||
"@tanstack/react-query": "^5.62.0",
|
||||
"@tanstack/react-router": "^1.81.0",
|
||||
"lucide-react": "^1.23.0",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1"
|
||||
},
|
||||
@@ -2556,6 +2557,15 @@
|
||||
"yallist": "^3.0.2"
|
||||
}
|
||||
},
|
||||
"node_modules/lucide-react": {
|
||||
"version": "1.23.0",
|
||||
"resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-1.23.0.tgz",
|
||||
"integrity": "sha512-38BpJcD0JhFosxHApP/BYsBetLpQFRoTRzEzstM/XCc3jsAG7wqaY1lgVwxiUe3xqYE+lNxo2PkCmYwXWrwwIw==",
|
||||
"license": "ISC",
|
||||
"peerDependencies": {
|
||||
"react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/lz-string": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.5.0.tgz",
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
"dependencies": {
|
||||
"@tanstack/react-query": "^5.62.0",
|
||||
"@tanstack/react-router": "^1.81.0",
|
||||
"lucide-react": "^1.23.0",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1"
|
||||
},
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { useState } from 'react'
|
||||
import { Copy, Check } from 'lucide-react'
|
||||
|
||||
interface Command {
|
||||
comment?: string
|
||||
@@ -39,8 +40,9 @@ function CliCommandLine({ cmd }: { cmd: string }) {
|
||||
return (
|
||||
<div className="cli-cmd-row">
|
||||
<code className="cli-cmd">{cmd}</code>
|
||||
<button type="button" className="cli-copy-btn" onClick={handleCopy} aria-label={`Copy ${cmd}`}>
|
||||
{copied ? 'Copied' : 'Copy'}
|
||||
<button type="button" className="cli-copy-btn interactive" onClick={handleCopy} aria-label={`Copy ${cmd}`} style={{ display: 'flex', alignItems: 'center', gap: '4px', padding: '4px 8px', background: copied ? 'var(--green)' : 'rgba(255,255,255,0.05)', color: copied ? '#000' : 'var(--text)', border: 'none', borderRadius: '4px', cursor: 'pointer', transition: 'all 0.2s' }}>
|
||||
{copied ? <Check size={14} /> : <Copy size={14} />}
|
||||
<span>{copied ? 'Copied' : 'Copy'}</span>
|
||||
</button>
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { RaceHub } from '../types'
|
||||
import { compareFinishPosition, formatDuration, formatGap, formatLapTime } from '../utils'
|
||||
import { countRaceHubDatasets } from '../lib/coverage'
|
||||
import { Thermometer, Map, Droplets, Wind, CloudRain } from 'lucide-react'
|
||||
|
||||
interface Props {
|
||||
data: RaceHub
|
||||
@@ -74,7 +75,7 @@ export function OverviewView({ data }: Props) {
|
||||
</div>
|
||||
|
||||
<div className="rh-overview-row">
|
||||
<section className="rh-panel">
|
||||
<section className="rh-panel ui-card">
|
||||
<div className="sec-header">
|
||||
<span className="sec-title">Conditions</span>
|
||||
{latestWeather && (
|
||||
@@ -83,17 +84,20 @@ export function OverviewView({ data }: Props) {
|
||||
</div>
|
||||
{latestWeather ? (
|
||||
<div className="rh-condition-strip" data-testid="rh-conditions">
|
||||
<ConditionChip label="Air" value={`${latestWeather.air_temperature.toFixed(1)}°C`} />
|
||||
<ConditionChip icon={Thermometer} label="Air" value={`${latestWeather.air_temperature.toFixed(1)}°C`} />
|
||||
<ConditionChip
|
||||
icon={Map}
|
||||
label="Track"
|
||||
value={`${latestWeather.track_temperature.toFixed(1)}°C`}
|
||||
/>
|
||||
<ConditionChip label="Humidity" value={`${latestWeather.humidity.toFixed(0)}%`} />
|
||||
<ConditionChip icon={Droplets} label="Humidity" value={`${latestWeather.humidity.toFixed(0)}%`} />
|
||||
<ConditionChip
|
||||
icon={Wind}
|
||||
label="Wind"
|
||||
value={`${latestWeather.wind_speed.toFixed(1)} m/s`}
|
||||
/>
|
||||
<ConditionChip
|
||||
icon={CloudRain}
|
||||
label="Rain"
|
||||
value={latestWeather.rainfall > 0 ? 'Yes' : 'No'}
|
||||
accent={latestWeather.rainfall > 0 ? 'wet' : undefined}
|
||||
@@ -104,7 +108,7 @@ export function OverviewView({ data }: Props) {
|
||||
)}
|
||||
</section>
|
||||
|
||||
<section className="rh-panel">
|
||||
<section className="rh-panel ui-card">
|
||||
<div className="sec-header">
|
||||
<span className="sec-title">Race Control · Latest</span>
|
||||
<span className="sec-meta mono">{data.race_control.length}</span>
|
||||
@@ -126,7 +130,7 @@ export function OverviewView({ data }: Props) {
|
||||
)}
|
||||
</section>
|
||||
|
||||
<section className="rh-panel">
|
||||
<section className="rh-panel ui-card">
|
||||
<div className="sec-header">
|
||||
<span className="sec-title">Local Coverage</span>
|
||||
<span className="sec-meta mono">
|
||||
@@ -173,7 +177,7 @@ function StatCard({
|
||||
}: StatCardProps) {
|
||||
if (placeholder) {
|
||||
return (
|
||||
<div className="rh-stat-card rh-stat-empty">
|
||||
<div className="rh-stat-card ui-card rh-stat-empty">
|
||||
<div className="rh-stat-label mono">{label}</div>
|
||||
<div className="rh-stat-primary">—</div>
|
||||
<div className="rh-stat-secondary">No data ingested</div>
|
||||
@@ -181,7 +185,7 @@ function StatCard({
|
||||
)
|
||||
}
|
||||
return (
|
||||
<div className="rh-stat-card">
|
||||
<div className="rh-stat-card ui-card interactive">
|
||||
<div className="rh-stat-label mono">{label}</div>
|
||||
<div className="rh-stat-primary" style={primaryColor ? { color: primaryColor } : undefined}>
|
||||
{primary}
|
||||
@@ -196,7 +200,7 @@ function StatCard({
|
||||
function PodiumCard({ podium }: { podium: Array<{ name_acronym: string; team_colour: string; position: number; full_name: string; gap_to_leader: number | string | number[] | null; duration: number | number[] | null; driver_number: number }> }) {
|
||||
if (podium.length === 0) {
|
||||
return (
|
||||
<div className="rh-stat-card rh-stat-empty">
|
||||
<div className="rh-stat-card ui-card rh-stat-empty">
|
||||
<div className="rh-stat-label mono">Podium</div>
|
||||
<div className="rh-stat-primary">—</div>
|
||||
<div className="rh-stat-secondary">No classified finishers</div>
|
||||
@@ -204,7 +208,7 @@ function PodiumCard({ podium }: { podium: Array<{ name_acronym: string; team_col
|
||||
)
|
||||
}
|
||||
return (
|
||||
<div className="rh-stat-card">
|
||||
<div className="rh-stat-card ui-card interactive">
|
||||
<div className="rh-stat-label mono">Podium</div>
|
||||
<ol className="rh-podium-list">
|
||||
{podium.map((r) => (
|
||||
@@ -232,13 +236,16 @@ function ConditionChip({
|
||||
label,
|
||||
value,
|
||||
accent,
|
||||
icon: Icon,
|
||||
}: {
|
||||
label: string
|
||||
value: string
|
||||
accent?: 'wet'
|
||||
icon?: React.ElementType
|
||||
}) {
|
||||
return (
|
||||
<div className={`rh-condition-chip${accent === 'wet' ? ' rh-condition-wet' : ''}`}>
|
||||
<div className={`rh-condition-chip${accent === 'wet' ? ' rh-condition-wet' : ''}`} style={{ display: 'flex', alignItems: 'center', gap: '6px' }}>
|
||||
{Icon && <Icon size={14} style={{ opacity: 0.7 }} />}
|
||||
<span className="rh-condition-label mono">{label}</span>
|
||||
<span className="rh-condition-value">{value}</span>
|
||||
</div>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { useState, Fragment } from 'react'
|
||||
import { teamColor } from '../../utils'
|
||||
import type { LiveStintData } from '../../types'
|
||||
import type { LiveTimingRow } from '../../lib/live'
|
||||
@@ -11,6 +12,7 @@ import {
|
||||
import type { GapHistoryMap } from '../../lib/gapHistory'
|
||||
import { GapSparkline } from './GapSparkline'
|
||||
import { StintHistory } from './StintHistory'
|
||||
import { Pin } from 'lucide-react'
|
||||
|
||||
interface Props {
|
||||
rows: LiveTimingRow[]
|
||||
@@ -19,6 +21,7 @@ interface Props {
|
||||
battleNumbers?: Set<string>
|
||||
pinned?: string[]
|
||||
onTogglePin?: (racingNumber: string) => void
|
||||
sessionType?: string
|
||||
}
|
||||
|
||||
function posClass(pos: number): string {
|
||||
@@ -35,7 +38,11 @@ export function TimingTower({
|
||||
battleNumbers,
|
||||
pinned,
|
||||
onTogglePin,
|
||||
sessionType = '',
|
||||
}: Props) {
|
||||
const [expandedRow, setExpandedRow] = useState<string | null>(null)
|
||||
const [gapMode, setGapMode] = useState<'interval' | 'leader'>('interval')
|
||||
|
||||
if (rows.length === 0) {
|
||||
return (
|
||||
<div className="missing-notice">
|
||||
@@ -44,21 +51,38 @@ export function TimingTower({
|
||||
)
|
||||
}
|
||||
|
||||
const sType = sessionType.toLowerCase()
|
||||
const isRace = sType.includes('race') || sType.includes('sprint')
|
||||
const isQuali = sType.includes('qualifying') || sType.includes('practice') || !isRace
|
||||
|
||||
const isQ1 = sType === 'qualifying 1' || sType.includes('q1')
|
||||
const isQ2 = sType === 'qualifying 2' || sType.includes('q2')
|
||||
|
||||
return (
|
||||
<div className="scroll-x">
|
||||
<table className="data-table live-tower" style={{ minWidth: 620 }}>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Pos</th>
|
||||
<th>Δ</th>
|
||||
{isRace && <th>Δ</th>}
|
||||
<th>Driver</th>
|
||||
<th>Tyre</th>
|
||||
<th>Last Lap</th>
|
||||
<th>Gap</th>
|
||||
<th>Trend</th>
|
||||
<th
|
||||
className="interactive"
|
||||
onClick={() => setGapMode(g => g === 'interval' ? 'leader' : 'interval')}
|
||||
title="Click to toggle Gap vs Interval"
|
||||
style={{ cursor: 'pointer', textDecoration: 'underline' }}
|
||||
>
|
||||
{gapMode === 'interval' && isRace ? 'Interval' : 'Gap to P1'}
|
||||
</th>
|
||||
{isRace && <th>Trend</th>}
|
||||
{isQuali && <th>S1</th>}
|
||||
{isQuali && <th>S2</th>}
|
||||
{isQuali && <th>S3</th>}
|
||||
<th className="hide-mobile">Best</th>
|
||||
<th className="hide-mobile">Stints</th>
|
||||
<th className="hide-mobile r">Laps</th>
|
||||
{isRace && <th className="hide-mobile r">Laps</th>}
|
||||
<th className="r"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -68,54 +92,123 @@ export function TimingTower({
|
||||
const deltaClass = positionDeltaClass(driver)
|
||||
const isPinned = pinned?.includes(row.RacingNumber) ?? false
|
||||
const inBattle = battleNumbers?.has(row.RacingNumber) ?? false
|
||||
const isExpanded = expandedRow === row.RacingNumber
|
||||
|
||||
// Knockout zone border
|
||||
let koClass = ''
|
||||
if (isQuali && (isQ1 || isQ2)) {
|
||||
if (isQ1 && row.Position === 15) koClass = 'ko-line-p15'
|
||||
if (isQ2 && row.Position === 10) koClass = 'ko-line-p10'
|
||||
} else if (isQuali) {
|
||||
if (row.Position === 15) koClass = 'ko-line-p15'
|
||||
if (row.Position === 10) koClass = 'ko-line-p10'
|
||||
}
|
||||
|
||||
const gapText = gapMode === 'interval' && isRace ? (driver.Interval || driver.GapToLeader) : driver.GapToLeader
|
||||
|
||||
// Render micro sectors
|
||||
const renderSector = (idx: number) => {
|
||||
const sec = driver.Sectors?.[idx]
|
||||
if (!sec) return '-'
|
||||
let sClass = 'mono'
|
||||
if (sec.OverallFastest) sClass = 'mono txt-purple'
|
||||
else if (sec.PersonalFastest) sClass = 'mono txt-green'
|
||||
else if (sec.Value) sClass = 'mono txt-yellow'
|
||||
return <span className={sClass}>{sec.Value || '-'}</span>
|
||||
}
|
||||
|
||||
return (
|
||||
<tr
|
||||
key={row.RacingNumber}
|
||||
className={[
|
||||
driver.InPit ? 'in-pit' : '',
|
||||
driver.PitOut ? 'pit-out' : '',
|
||||
driver.Retired ? 'retired' : '',
|
||||
inBattle ? 'battle-row' : '',
|
||||
isPinned ? 'pinned-row' : '',
|
||||
onTogglePin ? 'pinnable' : '',
|
||||
].filter(Boolean).join(' ')}
|
||||
onClick={onTogglePin ? () => onTogglePin(row.RacingNumber) : undefined}
|
||||
title={onTogglePin ? (isPinned ? 'Click to unpin' : 'Click to pin (max 3)') : undefined}
|
||||
>
|
||||
<td className={`mono ${posClass(row.Position)}`}>{row.Position}</td>
|
||||
<td className={`pos-delta${deltaClass ? ` ${deltaClass}` : ''}`}>{delta}</td>
|
||||
<td>
|
||||
<div className="drv-cell">
|
||||
<div className="drv-bar" style={{ background: teamColor(row.Info?.TeamColour) }} />
|
||||
<span className="drv-code">{driverCode(row)}</span>
|
||||
<span className="drv-num">{row.RacingNumber}</span>
|
||||
{isPinned && <span className="pin-mark" title="Pinned">◈</span>}
|
||||
{driver.InPit && <span className="badge badge-pit">PIT</span>}
|
||||
{driver.PitOut && !driver.InPit && <span className="badge badge-pit">OUT</span>}
|
||||
{driver.Retired && <span className="badge badge-out">RET</span>}
|
||||
{driver.KnockedOut && <span className="badge badge-knocked">KO</span>}
|
||||
{driver.Cutoff && !driver.KnockedOut && <span className="badge badge-cutoff">CUT</span>}
|
||||
{driver.OnFlyingLap && <span className="badge badge-flying">FL</span>}
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<span className={`tyre-badge ${tyreClass(row.Tyre)}`}>{tyreLabel(row.Tyre)}</span>
|
||||
</td>
|
||||
<td className={driver.LastLapOB ? 'mono lap-ob' : driver.LastLapPB ? 'mono lap-pb' : 'mono'}>
|
||||
{driver.LastLapTime || '-'}
|
||||
</td>
|
||||
<td className="mono">{driver.GapToLeader || driver.Interval || '-'}</td>
|
||||
<td className="spark-cell">
|
||||
<GapSparkline samples={history?.[row.RacingNumber]} />
|
||||
</td>
|
||||
<td className={`hide-mobile ${driver.BestLapOB ? 'mono lap-ob' : 'mono'}`}>
|
||||
{driver.BestLapTime || '-'}
|
||||
</td>
|
||||
<td className="hide-mobile">
|
||||
<StintHistory stints={stints?.[row.RacingNumber]} />
|
||||
</td>
|
||||
<td className="hide-mobile mono r">{driver.NumberOfLaps || '-'}</td>
|
||||
</tr>
|
||||
<Fragment key={row.RacingNumber}>
|
||||
<tr
|
||||
className={[
|
||||
driver.InPit ? 'in-pit' : '',
|
||||
driver.PitOut ? 'pit-out' : '',
|
||||
driver.Retired ? 'retired' : '',
|
||||
inBattle ? 'battle-row' : '',
|
||||
isPinned ? 'pinned-row' : '',
|
||||
koClass,
|
||||
'interactive-row'
|
||||
].filter(Boolean).join(' ')}
|
||||
onClick={() => setExpandedRow(isExpanded ? null : row.RacingNumber)}
|
||||
style={{ cursor: 'pointer' }}
|
||||
>
|
||||
<td className={`mono ${posClass(row.Position)}`}>{row.Position}</td>
|
||||
{isRace && <td className={`pos-delta${deltaClass ? ` ${deltaClass}` : ''}`}>{delta}</td>}
|
||||
<td>
|
||||
<div className="drv-cell">
|
||||
<div className="drv-bar" style={{ background: teamColor(row.Info?.TeamColour) }} />
|
||||
<span className="drv-code">{driverCode(row)}</span>
|
||||
<span className="drv-num">{row.RacingNumber}</span>
|
||||
{driver.InPit && <span className="badge badge-pit">PIT</span>}
|
||||
{driver.PitOut && !driver.InPit && <span className="badge badge-pit">OUT</span>}
|
||||
{driver.Retired && <span className="badge badge-out">RET</span>}
|
||||
{driver.KnockedOut && <span className="badge badge-knocked">KO</span>}
|
||||
{driver.Cutoff && !driver.KnockedOut && <span className="badge badge-cutoff">CUT</span>}
|
||||
{driver.OnFlyingLap && <span className="badge badge-flying">FL</span>}
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<span className={`tyre-badge ${tyreClass(row.Tyre)}`}>{tyreLabel(row.Tyre)}</span>
|
||||
</td>
|
||||
<td className={driver.LastLapOB ? 'mono lap-ob' : driver.LastLapPB ? 'mono lap-pb' : 'mono'}>
|
||||
{driver.LastLapTime || '-'}
|
||||
</td>
|
||||
<td className="mono">{gapText || '-'}</td>
|
||||
|
||||
{isRace && (
|
||||
<td className="spark-cell">
|
||||
<GapSparkline samples={history?.[row.RacingNumber]} />
|
||||
</td>
|
||||
)}
|
||||
|
||||
{isQuali && <td>{renderSector(0)}</td>}
|
||||
{isQuali && <td>{renderSector(1)}</td>}
|
||||
{isQuali && <td>{renderSector(2)}</td>}
|
||||
|
||||
<td className={`hide-mobile ${driver.BestLapOB ? 'mono lap-ob' : 'mono'}`}>
|
||||
{driver.BestLapTime || '-'}
|
||||
</td>
|
||||
|
||||
{isRace && <td className="hide-mobile mono r">{driver.NumberOfLaps || '-'}</td>}
|
||||
|
||||
<td className="r">
|
||||
{onTogglePin && (
|
||||
<button
|
||||
className="pin-btn interactive"
|
||||
onClick={(e) => { e.stopPropagation(); onTogglePin(row.RacingNumber); }}
|
||||
style={{ opacity: isPinned ? 1 : 0.3, background: 'none', border: 'none', cursor: 'pointer', color: 'var(--text)' }}
|
||||
title={isPinned ? 'Unpin driver' : 'Pin driver'}
|
||||
>
|
||||
<Pin size={14} fill={isPinned ? 'currentColor' : 'none'} />
|
||||
</button>
|
||||
)}
|
||||
</td>
|
||||
</tr>
|
||||
{isExpanded && (
|
||||
<tr className="expanded-row">
|
||||
<td colSpan={12} style={{ padding: '16px', background: 'rgba(255,255,255,0.02)', borderBottom: '1px solid var(--border)' }}>
|
||||
<div style={{ display: 'flex', gap: '24px', alignItems: 'center' }}>
|
||||
<div>
|
||||
<div className="mono" style={{ color: 'var(--text-3)', fontSize: '10px', marginBottom: '4px' }}>STINTS</div>
|
||||
<StintHistory stints={stints?.[row.RacingNumber]} />
|
||||
</div>
|
||||
{!isRace && (
|
||||
<div>
|
||||
<div className="mono" style={{ color: 'var(--text-3)', fontSize: '10px', marginBottom: '4px' }}>LAPS</div>
|
||||
<div className="mono">{driver.NumberOfLaps || 0}</div>
|
||||
</div>
|
||||
)}
|
||||
{driver.SpeedTrap && (
|
||||
<div>
|
||||
<div className="mono" style={{ color: 'var(--text-3)', fontSize: '10px', marginBottom: '4px' }}>SPEED TRAP</div>
|
||||
<div className="mono">{driver.SpeedTrap} km/h</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
)}
|
||||
</Fragment>
|
||||
)
|
||||
})}
|
||||
</tbody>
|
||||
|
||||
@@ -17,6 +17,7 @@ import {
|
||||
import { countryAccent, countryDecal, countryFlag, formatGpDateRange } from '../lib/gpIdentity'
|
||||
import type { Meeting, Session, Weekend, WeekendSession } from '../types'
|
||||
import { PaddockBriefing } from '../components/PaddockBriefing'
|
||||
import { Play, Activity, Calendar } from 'lucide-react'
|
||||
|
||||
type WeekendStatusKind = 'live' | 'current' | 'next' | 'recent' | 'fallback'
|
||||
|
||||
@@ -217,7 +218,7 @@ export function CommandCenterPage() {
|
||||
)}
|
||||
|
||||
{focusMeeting && (
|
||||
<section className="cc-weekend-band" data-testid="cc-focus">
|
||||
<section className="cc-weekend-band ui-card glass-panel" data-testid="cc-focus">
|
||||
<div className="cc-band-accent" aria-hidden="true" />
|
||||
<div className="cc-band-body">
|
||||
<div className="cc-band-row">
|
||||
@@ -250,19 +251,19 @@ export function CommandCenterPage() {
|
||||
<div className="cc-actions-row" data-testid="cc-actions">
|
||||
<Link
|
||||
to="/live"
|
||||
className={`cc-pri-action ${liveActive ? 'is-live' : ''}`}
|
||||
className={`cc-pri-action ui-card interactive ${liveActive ? 'is-live ui-cta-primary' : ''}`}
|
||||
data-testid="cc-action-live"
|
||||
>
|
||||
<span className="cc-pri-label">Watch Live</span>
|
||||
<span className="cc-pri-label" style={{ display: 'flex', alignItems: 'center', gap: '8px' }}><Play size={16} /> Watch Live</span>
|
||||
<span className="cc-pri-meta mono">{liveActive ? 'Feed active' : 'Standby'}</span>
|
||||
</Link>
|
||||
<Link
|
||||
to="/race-hub"
|
||||
search={analysisSessionKey ? { session_key: analysisSessionKey } : {}}
|
||||
className="cc-pri-action"
|
||||
className="cc-pri-action ui-card interactive"
|
||||
data-testid="cc-action-race-hub"
|
||||
>
|
||||
<span className="cc-pri-label">Open Analysis</span>
|
||||
<span className="cc-pri-label" style={{ display: 'flex', alignItems: 'center', gap: '8px' }}><Activity size={16} /> Open Analysis</span>
|
||||
<span className="cc-pri-meta mono">
|
||||
{actionSession
|
||||
? `${actionSession.session_name} · session ${actionSession.session_key}`
|
||||
@@ -272,14 +273,14 @@ export function CommandCenterPage() {
|
||||
{nextSession && sessionStartTime(nextSession) && (
|
||||
<a
|
||||
href="#cc-schedule"
|
||||
className="cc-pri-action"
|
||||
className="cc-pri-action ui-card interactive"
|
||||
data-testid="cc-action-schedule"
|
||||
onClick={(e) => {
|
||||
e.preventDefault()
|
||||
document.getElementById('cc-schedule')?.scrollIntoView({ behavior: 'smooth' })
|
||||
}}
|
||||
>
|
||||
<span className="cc-pri-label">Schedule</span>
|
||||
<span className="cc-pri-label" style={{ display: 'flex', alignItems: 'center', gap: '8px' }}><Calendar size={16} /> Schedule</span>
|
||||
<span className="cc-pri-meta mono">
|
||||
next: {nextSession.session_name}
|
||||
</span>
|
||||
@@ -299,13 +300,14 @@ export function CommandCenterPage() {
|
||||
const status = classifySessionStatus(session, nowDate)
|
||||
const isNext = nextSession?.session_key === session.session_key
|
||||
const isCurrent = currentSession?.session_key === session.session_key
|
||||
const isLive = isCurrent && liveActive
|
||||
return (
|
||||
<Link
|
||||
key={session.session_key}
|
||||
to="/race-hub"
|
||||
search={{ session_key: session.session_key }}
|
||||
className={`cc-session-card cc-status-${status}${isNext ? ' is-next' : ''}${
|
||||
isCurrent ? ' is-current' : ''
|
||||
className={`cc-session-card ui-card interactive cc-status-${status}${isNext ? ' is-next' : ''}${
|
||||
isLive ? ' is-live glass-panel' : ''
|
||||
}`}
|
||||
data-testid={`cc-session-${session.session_key}`}
|
||||
role="listitem"
|
||||
|
||||
@@ -18,6 +18,7 @@ import { TimingTower } from '../components/live/TimingTower'
|
||||
import { BattleChips } from '../components/live/BattleChips'
|
||||
import { PinnedDrivers } from '../components/live/PinnedDrivers'
|
||||
import { RaceControlFeed } from '../components/live/RaceControlFeed'
|
||||
import { Radio } from 'lucide-react'
|
||||
|
||||
type StreamStatus = 'connecting' | 'connected' | 'disconnected' | 'error'
|
||||
|
||||
@@ -128,14 +129,15 @@ export function LiveTimingPage() {
|
||||
)}
|
||||
|
||||
{!isLoading && !snapshot && (
|
||||
<div className="empty-state" data-testid="live-empty">
|
||||
<div className="live-empty-status">
|
||||
<div className="empty-state ui-card glass-panel" style={{ padding: '40px', textAlign: 'center', marginTop: '20vh', maxWidth: '400px', marginLeft: 'auto', marginRight: 'auto' }} data-testid="live-empty">
|
||||
<div className="live-empty-status" style={{ marginBottom: '16px' }}>
|
||||
<span className={`live-conn live-conn-${streamStatus}`}>{streamStatus}</span>
|
||||
</div>
|
||||
<div className="empty-state-title">No live session active</div>
|
||||
<div className="empty-state-desc">
|
||||
No timing data in the current snapshot. The feed will update automatically when an F1 session goes live.
|
||||
</div>
|
||||
<Radio size={48} style={{ color: 'var(--text-3)', margin: '0 auto 16px auto', display: 'block' }} />
|
||||
<h2 className="empty-state-title" style={{ fontSize: '20px', marginBottom: '8px' }}>No live session active</h2>
|
||||
<p className="empty-state-desc" style={{ color: 'var(--text-2)' }}>
|
||||
The telemetry feed is currently offline. <br /><br /> Check the <a href="/" style={{ color: 'var(--red)', textDecoration: 'underline' }}>Command Center</a> for the weekend schedule or explore historical data in the <a href="/race-hub" style={{ color: 'var(--red)', textDecoration: 'underline' }}>Race Hub</a>.
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -158,6 +160,7 @@ export function LiveTimingPage() {
|
||||
battleNumbers={inBattle}
|
||||
pinned={pinned}
|
||||
onTogglePin={handleTogglePin}
|
||||
sessionType={snapshot.Session?.SessionType}
|
||||
/>
|
||||
</div>
|
||||
<div className="live-rc-col">
|
||||
|
||||
@@ -1,32 +1,56 @@
|
||||
/* ── Design tokens ── */
|
||||
:root {
|
||||
--bg: #0d0d0d;
|
||||
--surface: #141414;
|
||||
/* Base Backgrounds (Off-black for depth) */
|
||||
--bg: #0a0a0a;
|
||||
--surface: #121212;
|
||||
--surface-h: #1a1a1a;
|
||||
--surface-2: #1e1e1e;
|
||||
--border: #232323;
|
||||
--border-2: #333;
|
||||
--surface-2: #1f1f1f;
|
||||
--surface-3: #262626;
|
||||
|
||||
/* Borders - slightly softer */
|
||||
--border: #262626;
|
||||
--border-2: #333333;
|
||||
--border-glow: rgba(255, 255, 255, 0.05);
|
||||
|
||||
--text: #e0e0e0;
|
||||
--text-2: #909090;
|
||||
--text-3: #484848;
|
||||
/* Typography */
|
||||
--text: #f0f0f0;
|
||||
--text-2: #a3a3a3;
|
||||
--text-3: #525252;
|
||||
|
||||
--red: #e10600;
|
||||
--green: #39c73a;
|
||||
--yellow: #ffd600;
|
||||
--purple: #c278ff;
|
||||
--tyre-soft: #ff3333;
|
||||
--tyre-medium: #ffd600;
|
||||
--tyre-hard: #d8d8d8;
|
||||
--tyre-inter: #39b54a;
|
||||
--tyre-wet: #0080ff;
|
||||
/* Accent Colors (Tuned for Dark Mode) */
|
||||
--red: #e62429;
|
||||
--green: #10b981;
|
||||
--yellow: #f59e0b;
|
||||
--purple: #a855f7;
|
||||
--blue: #3b82f6;
|
||||
|
||||
/* Tyre Colors */
|
||||
--tyre-soft: #ef4444;
|
||||
--tyre-medium: #f59e0b;
|
||||
--tyre-hard: #e5e5e5;
|
||||
--tyre-inter: #22c55e;
|
||||
--tyre-wet: #3b82f6;
|
||||
|
||||
/* Team Colors (Desaturated for WCAG/Halation) */
|
||||
--team-rbr: #2563eb; /* Red Bull */
|
||||
--team-mer: #14b8a6; /* Mercedes */
|
||||
--team-fer: #dc2626; /* Ferrari */
|
||||
--team-mcl: #f97316; /* McLaren */
|
||||
--team-ast: #059669; /* Aston Martin */
|
||||
--team-alp: #f472b6; /* Alpine */
|
||||
--team-wil: #0ea5e9; /* Williams */
|
||||
--team-rbf: #6366f1; /* RB */
|
||||
--team-sau: #84cc16; /* Sauber */
|
||||
--team-haa: #fafafa; /* Haas */
|
||||
|
||||
/* Fonts */
|
||||
--f-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
|
||||
--f-mono: 'JetBrains Mono', 'Cascadia Code', 'Consolas', monospace;
|
||||
--f-mono: 'JetBrains Mono', 'Space Grotesk', 'Consolas', monospace;
|
||||
|
||||
/* Spacing & Layout */
|
||||
--s1: 2px; --s2: 4px; --s3: 6px; --s4: 10px;
|
||||
--s5: 16px; --s6: 24px; --s7: 40px;
|
||||
--nav-h: 44px;
|
||||
--nav-h: 52px; /* Slightly taller nav */
|
||||
}
|
||||
|
||||
/* ── Reset ── */
|
||||
@@ -55,8 +79,10 @@ a { color: inherit; text-decoration: none; }
|
||||
align-items: center;
|
||||
gap: var(--s5);
|
||||
padding: 0 var(--s6);
|
||||
background: var(--surface);
|
||||
border-bottom: 1px solid var(--border);
|
||||
background: rgba(18, 18, 18, 0.75);
|
||||
backdrop-filter: blur(16px);
|
||||
-webkit-backdrop-filter: blur(16px);
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.08);
|
||||
overflow-x: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
scrollbar-width: none;
|
||||
@@ -4029,6 +4055,29 @@ a { color: inherit; text-decoration: none; }
|
||||
.champ-sim-delta.down {
|
||||
color: var(--red);
|
||||
}
|
||||
.data-table .pinnable:hover td {
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
}
|
||||
|
||||
.interactive-row:hover td {
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
}
|
||||
|
||||
.ko-line-p15 td, .ko-line-p10 td {
|
||||
border-bottom: 1px dashed var(--red) !important;
|
||||
}
|
||||
|
||||
.txt-purple {
|
||||
color: var(--purple);
|
||||
}
|
||||
|
||||
.txt-green {
|
||||
color: var(--green);
|
||||
}
|
||||
|
||||
.txt-yellow {
|
||||
color: var(--yellow);
|
||||
}
|
||||
.champ-sim-row-moved td {
|
||||
background: rgba(255, 255, 255, 0.03);
|
||||
}
|
||||
@@ -4043,3 +4092,45 @@ a { color: inherit; text-decoration: none; }
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
||||
/* ── UI/UX Revamp Styles ── */
|
||||
|
||||
/* Glassmorphism */
|
||||
.glass-panel {
|
||||
background: rgba(18, 18, 18, 0.65);
|
||||
backdrop-filter: blur(12px);
|
||||
-webkit-backdrop-filter: blur(12px);
|
||||
border: 1px solid var(--border-glow);
|
||||
}
|
||||
|
||||
/* Base Card Enhancements (Soft borders, inner shadow, hover) */
|
||||
.ui-card {
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 8px;
|
||||
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 4px 12px rgba(0,0,0,0.4);
|
||||
transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s;
|
||||
}
|
||||
|
||||
.ui-card.interactive:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 8px 24px rgba(0,0,0,0.6);
|
||||
border-color: var(--border-2);
|
||||
}
|
||||
|
||||
/* Button & CTA Enhancements */
|
||||
.ui-cta-primary {
|
||||
background: var(--red);
|
||||
color: #fff;
|
||||
border: none;
|
||||
font-weight: 600;
|
||||
border-radius: 4px;
|
||||
padding: 6px 12px;
|
||||
transition: all 0.2s;
|
||||
cursor: pointer;
|
||||
}
|
||||
.ui-cta-primary:hover {
|
||||
background: #f82f34;
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
|
||||
@@ -176,10 +176,10 @@ describe('TimingTower', () => {
|
||||
expect(lecRow).toHaveClass('pinned-row')
|
||||
})
|
||||
|
||||
it('toggles a pin when a row is clicked', () => {
|
||||
it('toggles a pin when the pin button is clicked', () => {
|
||||
const onTogglePin = vi.fn()
|
||||
render(<TimingTower rows={rows} onTogglePin={onTogglePin} />)
|
||||
fireEvent.click(screen.getByText('NOR').closest('tr')!)
|
||||
fireEvent.click(screen.getByText('NOR').closest('tr')!.querySelector('.pin-btn')!)
|
||||
expect(onTogglePin).toHaveBeenCalledWith('4')
|
||||
})
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 123 KiB |
|
Before Width: | Height: | Size: 111 KiB After Width: | Height: | Size: 112 KiB |
|
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 62 KiB |
|
Before Width: | Height: | Size: 88 KiB After Width: | Height: | Size: 91 KiB |
|
Before Width: | Height: | Size: 95 KiB After Width: | Height: | Size: 94 KiB |
|
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 60 KiB |
|
Before Width: | Height: | Size: 102 KiB After Width: | Height: | Size: 104 KiB |
|
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 63 KiB |