Polish live timing UI

This commit is contained in:
2026-05-25 10:45:35 -04:00
parent e539abcc5f
commit 9532206522
9 changed files with 269 additions and 42 deletions

View File

@@ -99,6 +99,29 @@ export function positionDelta(driver: LiveDriverData): string {
return driver.PrevPosition > driver.Position ? '▲' : '▼'
}
export function positionDeltaClass(driver: LiveDriverData): string {
if (!driver.PrevPosition || !driver.Position || driver.PrevPosition === driver.Position) return ''
return driver.PrevPosition > driver.Position ? 'pos-gain' : 'pos-loss'
}
const RC_FLAG_CSS: Record<string, string> = {
GREEN: 'rc-flag-green',
YELLOW: 'rc-flag-yellow',
'DOUBLE YELLOW': 'rc-flag-yellow',
RED: 'rc-flag-red',
SC: 'rc-flag-sc',
'SAFETY CAR': 'rc-flag-sc',
VSC: 'rc-flag-vsc',
'VIRTUAL SAFETY CAR': 'rc-flag-vsc',
CHEQUERED: 'rc-flag-chequered',
CHECKERED: 'rc-flag-chequered',
}
export function rcFlagClass(flag: string): string {
if (!flag) return ''
return RC_FLAG_CSS[flag.toUpperCase()] ?? ''
}
export function tyreLabel(tyre: LiveTyreData | undefined): string {
if (!tyre) return '?'
const compound = tyre.Compound?.charAt(0) || '?'