diff --git a/monitoring-web/src/main.rs b/monitoring-web/src/main.rs index b1550a3a..2e97d7c7 100644 --- a/monitoring-web/src/main.rs +++ b/monitoring-web/src/main.rs @@ -17,19 +17,19 @@ use tower_http::services::ServeDir; use tracing_subscriber; // ── city config ── -// (city_key, display_name, icao, airport_en, utc_offset_hours, threshold) -const CITIES: &[(&str, &str, &str, &str, i32, f64)] = &[ - ("seoul", "首尔", "RKSI", "Incheon", 9, 3.0), - ("busan", "釜山", "RKPK", "Gimhae", 9, 2.0), - ("tokyo", "东京", "44166", "Haneda", 9, 2.0), - ("ankara", "安卡拉", "17128", "Esenboğa", 3, 3.0), - ("helsinki", "赫尔辛基", "EFHK", "Vantaa", 3, 2.0), - ("amsterdam","阿姆斯特丹","EHAM","Schiphol",2,2.0), - ("istanbul","伊斯坦布尔","17058","Airport",3,3.0), - ("paris", "巴黎", "LFPB", "Le Bourget", 2, 3.0), - ("hong kong","香港","HKO","Observatory",8,1.5), - ("lau fau shan","流浮山","LFS","Lau Fau Shan",8,1.5), - ("taipei", "台北", "466920", "Songshan", 8, 1.5), +// (city_key, display_name, icao, airport_en, utc_offset_hours, threshold, tz_abbr) +const CITIES: &[(&str, &str, &str, &str, i32, f64, &str)] = &[ + ("seoul", "首尔", "RKSI", "Incheon", 9, 3.0, "KST"), + ("busan", "釜山", "RKPK", "Gimhae", 9, 2.0, "KST"), + ("tokyo", "东京", "44166", "Haneda", 9, 2.0, "JST"), + ("ankara", "安卡拉", "17128", "Esenboğa", 3, 3.0, "TRT"), + ("helsinki", "赫尔辛基", "EFHK", "Vantaa", 3, 2.0, "EEST"), + ("amsterdam","阿姆斯特丹","EHAM","Schiphol",2,2.0,"CEST"), + ("istanbul","伊斯坦布尔","17058","Airport",3,3.0,"TRT"), + ("paris", "巴黎", "LFPB", "Le Bourget", 2, 3.0, "CEST"), + ("hong kong","香港","HKO","Observatory",8,1.5,"HKT"), + ("lau fau shan","流浮山","LFS","Lau Fau Shan",8,1.5,"HKT"), + ("taipei", "台北", "466920", "Songshan", 8, 1.5, "TST"), ]; // ── app state ── @@ -49,10 +49,10 @@ struct MonitorTemplate { // ── data loading ── -fn load_city_snapshot(db_path: &str, (key, display, icao, airport, tz, thresh): &(&str, &str, &str, &str, i32, f64)) -> CitySnapshot { +fn load_city_snapshot(db_path: &str, (key, display, icao, airport, tz, thresh, tz_abbr): &(&str, &str, &str, &str, i32, f64, &str)) -> CitySnapshot { let now_utc = Utc::now(); let local = now_utc + chrono::Duration::hours(*tz as i64); - let local_time = local.format("%H:%M").to_string(); + let local_time = format!("{} {}", local.format("%H:%M"), tz_abbr); // Recent obs for temp + trend let obs = db::get_recent_obs(db_path, icao, 120, 12); @@ -107,6 +107,7 @@ fn load_city_snapshot(db_path: &str, (key, display, icao, airport, tz, thresh): trend_ok: false, in_window: false, obs_age_min, + temp_warm: current_temp.map_or(false, |t| t >= 30.0), } } diff --git a/monitoring-web/src/model.rs b/monitoring-web/src/model.rs index 63c2beeb..adfc5256 100644 --- a/monitoring-web/src/model.rs +++ b/monitoring-web/src/model.rs @@ -20,6 +20,7 @@ pub struct CitySnapshot { pub trend_ok: bool, pub in_window: bool, pub obs_age_min: Option, + pub temp_warm: bool, } #[derive(Debug, Clone, Copy, Serialize)] diff --git a/monitoring-web/static/style.css b/monitoring-web/static/style.css index 1e2fa95d..8c7eda38 100644 --- a/monitoring-web/static/style.css +++ b/monitoring-web/static/style.css @@ -95,6 +95,9 @@ body { background: rgba(124, 58, 237, 0.18); color: #a78bfa; } +.new-high-card { + border-color: rgba(124, 58, 237, 0.25); +} /* ── temp ── */ .card-temp { @@ -113,6 +116,12 @@ body { color: #3a4050; font-size: 28px; } +.temp-value.warm { + color: #f59e0b; +} +.temp-value.new-high-val { + color: #c084fc; +} .temp-unit { font-size: 18px; @@ -130,7 +139,8 @@ body { .meta-row { display: flex; - justify-content: space-between; + align-items: baseline; + gap: 6px; font-size: 13px; } @@ -146,6 +156,9 @@ body { .meta-row .value.na { color: #3a4050; } +.meta-row .trend { + margin-left: auto; +} /* ── trend ── */ .trend { font-size: 15px; font-weight: 600; } diff --git a/monitoring-web/templates/monitor.html b/monitoring-web/templates/monitor.html index 4eadf021..d08aba8c 100644 --- a/monitoring-web/templates/monitor.html +++ b/monitoring-web/templates/monitor.html @@ -21,7 +21,7 @@ {{ generated_at }} {% for c in cities %} -
+
{{ c.display_name }} / {{ c.airport }} @@ -34,7 +34,7 @@
{% match c.current_temp %} {% when Some with (t) %} - {{ "{:.1}"|format(t) }}°C + {{ "{:.1}"|format(t) }}°C {% when None %} -- {% endmatch %} @@ -49,10 +49,7 @@ {% when None %} -- {% endmatch %} -
-
- 趋势 - {{ c.trend.symbol() }} + {{ c.trend.symbol() }}
观测 @@ -64,18 +61,6 @@ {% endmatch %}
- - {% if !c.runway_pairs.is_empty() %} -
-
- {% for (pair, temp) in c.runway_pairs %} -
- {{ pair }} - {{ "{:.1}"|format(temp) }}°C -
- {% endfor %} -
- {% endif %}
{% endfor %}