diff --git a/frontend/components/dashboard/CitySidebar.tsx b/frontend/components/dashboard/CitySidebar.tsx index 4450251e..cfffb03b 100644 --- a/frontend/components/dashboard/CitySidebar.tsx +++ b/frontend/components/dashboard/CitySidebar.tsx @@ -165,6 +165,23 @@ export function CitySidebar() { const summary = store.citySummariesByName[city.name]; const snapshot = detail || summary; const isActive = store.selectedCity === city.name; + const tempSymbol = snapshot?.temp_symbol || "°C"; + const currentTempText = + snapshot?.current?.temp != null + ? t("sidebar.currentTemp", { + temp: `${snapshot.current.temp}${tempSymbol}`, + }) + : t("common.na"); + const peakTempText = + detail?.current?.max_so_far != null && + detail.current.max_temp_time + ? t("sidebar.peakTempAt", { + temp: `${detail.current.max_so_far}${tempSymbol}`, + time: detail.current.max_temp_time, + }) + : detail?.current?.max_temp_time + ? t("sidebar.peakAt", { time: detail.current.max_temp_time }) + : ""; return ( ); diff --git a/frontend/lib/i18n.ts b/frontend/lib/i18n.ts index 0dc97b06..f6b20eff 100644 --- a/frontend/lib/i18n.ts +++ b/frontend/lib/i18n.ts @@ -21,6 +21,8 @@ const MESSAGES: Record> = { "header.langEn": "EN", "sidebar.title": "监控城市", + "sidebar.currentTemp": "当前 {temp}", + "sidebar.peakTempAt": "峰值 {temp} @ {time}", "sidebar.peakAt": "峰值 @ {time}", "sidebar.group.high": "高风险", "sidebar.group.medium": "中风险", @@ -180,6 +182,8 @@ const MESSAGES: Record> = { "header.langEn": "EN", "sidebar.title": "Monitored Cities", + "sidebar.currentTemp": "Current {temp}", + "sidebar.peakTempAt": "Peak {temp} @ {time}", "sidebar.peakAt": "Peak @ {time}", "sidebar.group.high": "High Risk", "sidebar.group.medium": "Medium Risk",