改进METAR当日状态判断与展示
This commit is contained in:
@@ -366,6 +366,14 @@ export function HeroSummary() {
|
||||
current.max_so_far != null &&
|
||||
current.temp != null &&
|
||||
current.max_so_far <= current.temp;
|
||||
const currentObsText =
|
||||
current.temp != null
|
||||
? `${current.temp}${data.temp_symbol} @${current.obs_time || "--"}`
|
||||
: data.metar_status?.stale_for_today
|
||||
? locale === "en-US"
|
||||
? "No same-day METAR"
|
||||
: "今日暂无 METAR"
|
||||
: "--";
|
||||
|
||||
return (
|
||||
<section className="hero-section">
|
||||
@@ -393,9 +401,7 @@ export function HeroSummary() {
|
||||
{locale === "en-US" ? "Current Obs" : "当前实测"}
|
||||
</span>
|
||||
<span className="value">
|
||||
{current.temp != null
|
||||
? `${current.temp}${data.temp_symbol} @${current.obs_time || "--"}`
|
||||
: "--"}
|
||||
{currentObsText}
|
||||
</span>
|
||||
</div>
|
||||
<div className="hero-item">
|
||||
|
||||
@@ -64,6 +64,7 @@ export interface CurrentConditions {
|
||||
station_name?: string | null;
|
||||
obs_time: string | null;
|
||||
obs_age_min: number | null;
|
||||
observation_status?: "live" | "missing" | "stale" | string | null;
|
||||
wind_speed_kt: number | null;
|
||||
wind_dir: number | null;
|
||||
humidity: number | null;
|
||||
@@ -100,6 +101,9 @@ export interface AirportCurrentConditions {
|
||||
is_airport_station?: boolean;
|
||||
is_official?: boolean;
|
||||
is_settlement_anchor?: boolean;
|
||||
stale_for_today?: boolean;
|
||||
last_observation_local_date?: string | null;
|
||||
current_local_date?: string | null;
|
||||
}
|
||||
|
||||
export interface NearbyStation {
|
||||
@@ -466,6 +470,14 @@ export interface CityDetail {
|
||||
time?: string;
|
||||
temp?: number | null;
|
||||
}>;
|
||||
metar_status?: {
|
||||
available_for_today?: boolean;
|
||||
stale_for_today?: boolean;
|
||||
last_observation_time?: string | null;
|
||||
last_observation_local_date?: string | null;
|
||||
current_local_date?: string | null;
|
||||
last_temp?: number | null;
|
||||
};
|
||||
settlement_today_obs?: Array<{
|
||||
time?: string;
|
||||
temp?: number | null;
|
||||
|
||||
@@ -1060,6 +1060,18 @@ export function getTemperatureChartData(
|
||||
: `${metarFallbackTag}: ${airportRecentText}`,
|
||||
);
|
||||
}
|
||||
if (detail.metar_status?.stale_for_today) {
|
||||
const dateText = detail.metar_status.last_observation_local_date || "";
|
||||
const tempText =
|
||||
detail.metar_status.last_temp != null
|
||||
? `${detail.metar_status.last_temp}${detail.temp_symbol}`
|
||||
: "";
|
||||
legendParts.push(
|
||||
isEnglish(locale)
|
||||
? `No same-day ${metarFallbackTag} report yet; latest report${dateText ? ` was ${dateText}` : ""}${tempText ? ` at ${tempText}` : ""}.`
|
||||
: `今日暂无同日 ${metarFallbackTag} 报文;最近一报${dateText ? `为 ${dateText}` : ""}${tempText ? `,${tempText}` : ""}。`,
|
||||
);
|
||||
}
|
||||
if (shouldUseMetarFallback) {
|
||||
legendParts.push(
|
||||
isEnglish(locale)
|
||||
|
||||
Reference in New Issue
Block a user