Clarify sidebar current and peak temperature labels
This commit is contained in:
@@ -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 (
|
||||
<button
|
||||
@@ -186,9 +203,7 @@ export function CitySidebar() {
|
||||
snapshot?.current?.temp != null && "loaded",
|
||||
)}
|
||||
>
|
||||
{snapshot?.current?.temp != null
|
||||
? `${snapshot.current.temp}${snapshot.temp_symbol || "°C"}`
|
||||
: t("common.na")}
|
||||
{currentTempText}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -196,11 +211,7 @@ export function CitySidebar() {
|
||||
<span className="city-local-time">
|
||||
{snapshot?.local_time ? `🕒 ${snapshot.local_time}` : ""}
|
||||
</span>
|
||||
<span className="city-max-info">
|
||||
{detail?.current?.max_temp_time
|
||||
? t("sidebar.peakAt", { time: detail.current.max_temp_time })
|
||||
: ""}
|
||||
</span>
|
||||
<span className="city-max-info">{peakTempText}</span>
|
||||
</div>
|
||||
</button>
|
||||
);
|
||||
|
||||
@@ -21,6 +21,8 @@ const MESSAGES: Record<Locale, Record<string, string>> = {
|
||||
"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<Locale, Record<string, string>> = {
|
||||
"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",
|
||||
|
||||
Reference in New Issue
Block a user