Add KMA nearby weather support for Seoul and Busan

This commit is contained in:
2569718930@qq.com
2026-04-09 20:19:07 +08:00
parent 1fa5645c0d
commit fef37f6b0f
5 changed files with 412 additions and 4 deletions
@@ -151,6 +151,7 @@ export function DetailPanel() {
);
const isPro = store.proAccess.subscriptionActive;
const isAuthenticated = store.proAccess.authenticated;
const isProStateLoading = store.proAccess.loading;
const panelRef = useRef<HTMLElement | null>(null);
const [heavyContentReady, setHeavyContentReady] = useState(false);
const isOverlayOpen =
@@ -201,6 +202,9 @@ export function DetailPanel() {
(locale === "en-US" ? "Airport pending" : "机场待确认");
const isBasicSummaryLoading =
!detail && !selectedSummary && store.loadingState.cityDetail;
const shouldShowSyncCard =
!detail &&
(store.loadingState.cityDetail || isProStateLoading || isAuthenticated);
const blurActiveElement = () => {
if (typeof document === "undefined") return;
const active = document.activeElement;
@@ -451,7 +455,7 @@ export function DetailPanel() {
<section className="detail-section">
<div className="detail-card">
<span className="detail-label">
{isPro
{shouldShowSyncCard
? locale === "en-US"
? "Detail sync"
: "详情同步"
@@ -460,7 +464,7 @@ export function DetailPanel() {
: "Pro 功能"}
</span>
<span className="detail-value" style={{ fontSize: "15px" }}>
{isPro
{shouldShowSyncCard
? locale === "en-US"
? "Full city detail is still syncing. The deeper panel will appear automatically."
: "完整城市详情仍在同步中,深度面板会自动补齐。"
+59 -1
View File
@@ -2624,6 +2624,7 @@ export function getCityProfileStats(detail: CityDetail, locale: Locale = "zh-CN"
const risk = detail.risk || {};
const current = detail.current || {};
const nearbyCount = Array.isArray(detail.mgm_nearby) ? detail.mgm_nearby.length : 0;
const nearbySource = String(detail.nearby_source || "").trim().toLowerCase();
const sourceCode = getObservationSourceCode(detail);
const isOfficialSource =
sourceCode === "hko" ||
@@ -2667,7 +2668,7 @@ export function getCityProfileStats(detail: CityDetail, locale: Locale = "zh-CN"
return isEnglish(locale) ? "No profile" : "暂无档案";
})();
return [
const rows = [
{
label: isOfficialSource
? isEnglish(locale)
@@ -2712,6 +2713,63 @@ export function getCityProfileStats(detail: CityDetail, locale: Locale = "zh-CN"
: "暂无周边站",
},
];
if (nearbyCount > 0) {
rows.push({
label: isEnglish(locale) ? "Nearby source" : "周边站来源",
value:
nearbySource === "kma"
? isEnglish(locale)
? "KMA official stations"
: "KMA 官方站"
: nearbySource === "official_cluster"
? isEnglish(locale)
? "Official station cluster"
: "官方站簇"
: nearbySource === "mgm"
? "MGM"
: isEnglish(locale)
? "Airport / METAR network"
: "机场 / METAR 网络",
});
}
if (nearbySource === "kma" && detail.airport_current?.temp != null) {
const airportLabel =
String(
detail.airport_current.station_label ||
detail.airport_current.station_code ||
detail.risk?.airport ||
"",
).trim() ||
(isEnglish(locale) ? "Airport station" : "机场主站");
const airportObsTime =
String(detail.airport_current.obs_time || "").trim() ||
(isEnglish(locale) ? "pending" : "待更新");
const airportHigh =
detail.airport_current.max_so_far != null
? `${detail.airport_current.max_so_far}${detail.temp_symbol || ""}${
detail.airport_current.max_temp_time
? ` @ ${detail.airport_current.max_temp_time}`
: ""
}`
: isEnglish(locale)
? "Unavailable"
: "未提供";
rows.push({
label: isEnglish(locale) ? "Airport reference" : "机场主站参考",
value: `${airportLabel}: ${detail.airport_current.temp}${
detail.temp_symbol || ""
} @ ${airportObsTime}`,
});
rows.push({
label: isEnglish(locale) ? "Airport high" : "机场目前最高温",
value: airportHigh,
});
}
return rows;
}
export function getSettlementRiskNarrative(