"use client";
import clsx from "clsx";
import { temp } from "@/components/dashboard/scan-terminal/utils";
export function TemperatureStatsBars({
isEn,
compact,
timeframe,
tempSymbol,
runwayHeaderLabel,
metarHeaderLabel,
runwayHighLabel,
metarHighLabel,
isShenzhen,
displayRunwayTemp,
observedHighMetar,
observedHighRunway,
wundergroundDailyHigh,
debVal,
modelMin,
modelMax,
spread,
spreadLabel,
spreadLabelEn,
formattedUpdateTime,
}: {
isEn: boolean;
compact: boolean;
timeframe: string;
tempSymbol: string;
runwayHeaderLabel: string;
metarHeaderLabel: string;
runwayHighLabel: string;
metarHighLabel: string;
isShenzhen: boolean;
displayRunwayTemp: number | null;
observedHighMetar: number | null;
observedHighRunway: number | null;
wundergroundDailyHigh: number | null;
debVal: number | null;
modelMin: number | null;
modelMax: number | null;
spread: number | null;
spreadLabel: string;
spreadLabelEn: string;
formattedUpdateTime: string;
}) {
if (compact) {
return (
{timeframe === "1D" ? (
{isEn ? "Runway" : runwayHeaderLabel}:{" "}
{temp(displayRunwayTemp, tempSymbol)}
|
{isEn ? "METAR" : (isShenzhen ? "当日最高" : metarHeaderLabel)}:{" "}
{temp(observedHighMetar, tempSymbol)}
) : (
DEB: {temp(debVal, tempSymbol)}
{modelMin !== null && modelMax !== null && (
<>
|
{isEn ? "Models" : "多模型"}:{" "}
{temp(modelMin, tempSymbol)} - {temp(modelMax, tempSymbol)}
>
)}
)}
{timeframe === "1D" && formattedUpdateTime.includes(" ") ? formattedUpdateTime.split(" ")[1].slice(0, 5) : ""}
);
}
return (
{timeframe === "1D" ? (
{isEn ? "Runway Live (1m)" : `${runwayHeaderLabel}`}
{temp(displayRunwayTemp, tempSymbol)}
{isEn ? "METAR Settlement · Daily High" : `${metarHeaderLabel} · 当日最高`}
{temp(observedHighMetar, tempSymbol)}
) : (
DEB Max
{temp(debVal, tempSymbol)}
{isEn ? "Model Range" : "多模型区间"}
{modelMin !== null && modelMax !== null ? `${temp(modelMin, tempSymbol)} - ${temp(modelMax, tempSymbol)}` : "--"}
)}
{isEn ? "Daily Peak" : "当日最高气温"}
{isEn ? "Runway" : runwayHighLabel}: {temp(observedHighRunway, tempSymbol)}
|
{isEn ? "METAR" : metarHighLabel}: {temp(observedHighMetar, tempSymbol)}
{wundergroundDailyHigh !== null && (
<>
|
WU: {temp(wundergroundDailyHigh, tempSymbol)}
>
)}
{timeframe === "1D" && (
{isEn ? "Model Range" : "模型区间"}
{modelMin !== null && modelMax !== null ? `${temp(modelMin, tempSymbol)} - ${temp(modelMax, tempSymbol)}` : "--"}
DEB
{temp(debVal, tempSymbol)}
{isEn ? "Spread" : "分歧"}
{spread !== null ? `${spread.toFixed(1)}${tempSymbol}` : "--"}
{spreadLabel && ` · ${isEn ? spreadLabelEn : spreadLabel}`}
{isEn ? "Updated" : "更新时间"}
{formattedUpdateTime}
)}
);
}