diff --git a/frontend/components/dashboard/FutureForecastModal.tsx b/frontend/components/dashboard/FutureForecastModal.tsx index c7c651ae..6374cf04 100644 --- a/frontend/components/dashboard/FutureForecastModal.tsx +++ b/frontend/components/dashboard/FutureForecastModal.tsx @@ -24,13 +24,9 @@ import { ProbabilityDistribution, } from "@/components/dashboard/PanelSections"; import { - getClimateDrivers, getFutureModalView, - getSettlementRiskNarrative, - getShortTermNowcastLines, getTemperatureChartData, getWeatherSummary, - parseAiAnalysis, } from "@/lib/dashboard-utils"; function normalizeMarketValue(value?: number | null) { @@ -250,7 +246,7 @@ function DailyTemperatureChart({ dateStr }: { dateStr: string }) { fill: false, label: todayChartData.observationLabel || - (locale === "en-US" ? "METAR Observation" : "METAR 实况"), + (locale === "en-US" ? "Observation" : "观测实况"), order: 0, pointHoverRadius: 7, pointRadius: 5, @@ -448,10 +444,6 @@ export function FutureForecastModal() { const isToday = dateStr === detail.local_date; const view = getFutureModalView(detail, dateStr, locale); - const nowcastRows = getShortTermNowcastLines(detail, dateStr, locale); - const riskLines = getSettlementRiskNarrative(detail, locale); - const climateDrivers = getClimateDrivers(detail, locale); - const ai = parseAiAnalysis(detail.ai_analysis); const scorePosition = `${50 + view.front.score / 2}%`; const barStyle = { "--score-position": scorePosition, @@ -889,47 +881,6 @@ export function FutureForecastModal() { -
-

{t("future.ai")}

-
- {ai.summary ? ( -
{ai.summary}
- ) : ( -
{t("future.noAi")}
- )} - {ai.bullets.length > 0 && ( -
- {ai.bullets.slice(0, 3).map((item) => ( -
{item}
- ))} -
- )} -
- {nowcastRows.slice(0, 4).map(([label, value]) => ( -
- {label}: - {value} -
- ))} -
- {riskLines.length > 0 && ( -
- - {locale === "en-US" ? "Risk" : "风险"}:{" "} - - {riskLines[0]} -
- )} - {climateDrivers.length > 0 && ( -
- - {locale === "en-US" ? "Climate" : "气候"}:{" "} - - {climateDrivers[0].text} -
- )} -
-
diff --git a/frontend/lib/dashboard-utils.ts b/frontend/lib/dashboard-utils.ts index fb9d0d79..64ecd66a 100644 --- a/frontend/lib/dashboard-utils.ts +++ b/frontend/lib/dashboard-utils.ts @@ -31,9 +31,17 @@ function isEnglish(locale: Locale) { } function getObservationSourceCode(detail: CityDetail): string { - return String(detail.current?.settlement_source || "metar") + const source = String(detail.current?.settlement_source || "") .trim() .toLowerCase(); + if (source) return source; + + const city = String(detail.name || detail.display_name || "") + .trim() + .toLowerCase(); + if (city === "hong kong") return "hko"; + if (city === "taipei") return "cwa"; + return "metar"; } function getObservationSourceTag(detail: CityDetail): string { @@ -233,7 +241,11 @@ export function getTemperatureChartData( const settlementSource = observationCode === "hko" || observationCode === "cwa"; const observationSource = settlementSource - ? detail.settlement_today_obs || [] + ? detail.settlement_today_obs?.length + ? detail.settlement_today_obs + : detail.current?.obs_time && detail.current?.temp != null + ? [{ time: detail.current.obs_time, temp: detail.current.temp }] + : [] : detail.metar_today_obs?.length ? detail.metar_today_obs : detail.trend?.recent || [];