From e734c93b34910a86d52c3e6ea646c5dad0730a74 Mon Sep 17 00:00:00 2001 From: "2569718930@qq.com" <2569718930@qq.com> Date: Wed, 13 May 2026 20:44:09 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E4=B8=8D=E5=87=86=E7=A1=AE?= =?UTF-8?q?=E7=9A=84=E4=BB=8A=E6=97=A5=E6=9C=80=E9=AB=98=EF=BC=8C=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E6=8C=89=E5=BD=93=E5=89=8D=E6=B8=A9=E5=BA=A6=E4=BB=8E?= =?UTF-8?q?=E9=AB=98=E5=88=B0=E4=BD=8E=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - airport_obs_log 仅保留 2h 数据,max_so_far 不准确 - 去掉卡片 Today High 行,趋势箭头移到 Obs 同行 - 卡片按 current_temp 降序排列,无数据沉底 - 通知文案简化 --- monitoring-web/src/main.rs | 11 +++++++++-- monitoring-web/templates/monitor.html | 19 ++++--------------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/monitoring-web/src/main.rs b/monitoring-web/src/main.rs index 3bd1acfe..b3160308 100644 --- a/monitoring-web/src/main.rs +++ b/monitoring-web/src/main.rs @@ -127,11 +127,18 @@ fn load_city_snapshot(db_path: &str, idx: usize, (key, _zh, en, icao, airport, t } fn load_all_cities(db_path: &str) -> Vec { - CITIES + let mut cities: Vec = CITIES .iter() .enumerate() .map(|(i, c)| load_city_snapshot(db_path, i, c)) - .collect() + .collect(); + // 按当前温度从高到低排序,无数据的排最后 + cities.sort_by(|a, b| { + b.current_temp + .partial_cmp(&a.current_temp) + .unwrap_or(std::cmp::Ordering::Less) + }); + cities } // ── routes ── diff --git a/monitoring-web/templates/monitor.html b/monitoring-web/templates/monitor.html index da18477e..7c2cb5f7 100644 --- a/monitoring-web/templates/monitor.html +++ b/monitoring-web/templates/monitor.html @@ -43,16 +43,6 @@
-
- Today High - {% match c.today_max %} - {% when Some with (m) %} - {{ "{:.1}"|format(m) }}°C - {% when None %} - -- - {% endmatch %} - {{ c.trend.symbol() }} -
Obs {% match c.obs_age_min %} @@ -61,6 +51,7 @@ {% when None %} -- {% endmatch %} + {{ c.trend.symbol() }}
@@ -97,7 +88,7 @@ function updateNotifyIcon() { } } -function fireNotification(city, enName, temp, todayMax) { +function fireNotification(enName, temp) { if (!NOTIFY_ENABLED) return; if (Notification.permission !== 'granted') return; @@ -114,7 +105,7 @@ function fireNotification(city, enName, temp, todayMax) { localStorage.setItem('monitor_notified_highs', JSON.stringify(NOTIFIED_HIGHS)); new Notification('🔴 New High — ' + enName, { - body: temp + '°C (was ' + todayMax + '°C)\n' + enName + ' / ' + city, + body: temp + '°C\nNew daily high.', icon: '/static/favicon.png', tag: key, requireInteraction: true, @@ -146,9 +137,7 @@ updateNotifyIcon(); // Notification for new high if(card.dataset.newHigh === 'true'){ - var maxEl = card.querySelector('.meta-row .value'); - var maxVal = maxEl ? maxEl.textContent.replace('°C','') : ''; - fireNotification(name, name, tv, maxVal); + fireNotification(name, tv); } }); });