import type { ReactNode } from "react"; import { aqiLabel, compass, formatClock, formatDistance, formatDuration, formatPrecip, formatPressure, formatTemp, formatWind, moonPhase, uvLabel, type Units, } from "@/lib/display"; import { pixelLabel, sectionHeading } from "@/lib/styles"; import type { WeatherReport } from "@/lib/weather/types"; import { Slot } from "./Slot"; /** * Every current reading the provider gives us, one tile each. * Tiles for readings the provider doesn't offer are simply left out. */ export function ConditionsGrid({ report, units }: { report: WeatherReport; units: Units }) { const { current: c, airQuality: aq, timeZone } = report; const today = report.daily[0]; const moon = moonPhase(); return (

Current conditions

} /> : undefined} /> {c.uvIndex !== null && ( } /> )} {aq && ( )} {c.pressureHpa !== null && } {c.visibilityKm !== null && } {c.cloudCover !== null && } {c.precipMm !== null && } {today?.sunrise && today.sunset && ( )} } />
); } /** * One reading. `icon` sits beside the value; `meter` sits underneath it. */ function Tile({ label, value, note, icon, meter }: { label: string; value: string; note?: string; icon?: ReactNode; meter?: ReactNode }) { return (

{label}

{value}

{icon}
{note &&

{note}

} {meter}
); } /** A row of lit/unlit segments, like a stamina gauge. */ function Segments({ total, lit }: { total: number; lit: number }) { return (