Files
Noel Sabia d908c3264d
ci / check (push) Successful in 54s
ci / check (pull_request) Successful in 56s
feat: simplify the Cool City phone decision
- replace the three stacked route cards with a Shortest | Shaded | Accessible segmented control and one large card
- default to Accessible for Ruth; keep the 16:00 trade-off visible as one sentence
- fold the audience vote into the card's primary action so the mobile action stays above the fold
- soften cards with a 28 px radius, soft shadow and one subtle selected ring
- leave the stage and city information architecture intact
2026-11-14 14:15:28 +01:00

53 lines
1.5 KiB
TypeScript

import type { CoolRouteValues } from '#shared/cool'
export function coolValue(value: number | null | undefined, suffix = ''): string {
if (value === null || value === undefined || Number.isNaN(value)) return 'TBD'
return `${value}${suffix}`
}
export function coolShade(value: number | null | undefined): string {
if (value === null || value === undefined) return 'TBD'
return `${value.toFixed(1)}%`
}
export function coolDistance(value: number | null | undefined): string {
if (value === null || value === undefined) return 'TBD'
if (value >= 1000) return `${(value / 1000).toFixed(2)} km`
return `${Math.floor(value)} m`
}
export function coolMinutes(value: number | null | undefined): string {
if (value === null || value === undefined) return 'TBD'
return `${value.toFixed(1)} min`
}
export function coolYesNo(value: boolean | null | undefined): string {
if (value === null || value === undefined) return 'TBD'
return value ? 'Yes' : 'No'
}
export function coolStops(value: number | null | undefined): string {
if (value === null || value === undefined) return 'TBD'
return String(value)
}
export function coolValues(values: CoolRouteValues | null | undefined): CoolRouteValues {
return (
values ?? {
shadePct: null,
directSunMin: null,
distanceM: null,
durationMin: null,
stepFree: null,
waterStops: null,
benchStops: null,
rampInclinePct: null,
}
)
}
export function coolTallyPct(count: number, total: number): number {
if (!total) return 0
return Math.round((count / total) * 100)
}