"use client"; import type { AmosData } from "@/lib/dashboard-types"; function runwayTempClass(temp: number | null | undefined): string { if (temp == null || !Number.isFinite(temp)) return ""; if (temp >= 40) return "temp-extreme-hot"; if (temp <= -5) return "temp-extreme-cold"; return ""; } export function AmosRunwayPanel({ amos, isEn, tempSymbol, airportCurrent, }: { amos?: AmosData | null; isEn: boolean; tempSymbol: string; airportCurrent?: { temp?: number | null; wind_speed_kt?: number | null; wind_dir?: number | null; pressure_hpa?: number | null; visibility_mi?: number | null; raw_metar?: string | null; source_label?: string | null; obs_time?: string | null; stale_for_today?: boolean | null; } | null; }) { const runwayPairs = amos?.runway_obs?.runway_pairs; const runwayTemps = amos?.runway_obs?.temperatures ?? amos?.runway_temps; const runwayWinds = amos?.runway_obs?.wind_speeds; const runwayVis = amos?.runway_obs?.visibility_mor; const runwayRvr = amos?.runway_obs?.rvr; const hasAmosRunway = runwayPairs && runwayPairs.length > 0; // Fallback: single-card METAR observation for non-AMOS airports if (!hasAmosRunway) { if (airportCurrent?.temp == null && airportCurrent?.wind_speed_kt == null) return null; const sourceLabel = airportCurrent?.source_label || (isEn ? "METAR" : "机场报文"); const staleNote = airportCurrent?.stale_for_today ? isEn ? " (stale)" : "(过旧)" : ""; return (