From b89c7e19158db58b3e9aae6be975d0d7578b8750 Mon Sep 17 00:00:00 2001 From: grabowski Date: Tue, 11 Aug 2026 16:56:53 +0700 Subject: [PATCH] feat: flood-verdict banner, violet rain palette, per-station bands, chip contrast, Umami UI/UX review backlog round 2 plus analytics: - at-a-glance verdict banner (role=status, aria-live) above the tiles: ok/watch/danger from P.1 level vs the official 3.70 m stage and the 24 h forecast, with a not-an-official-warning disclaimer + ThaiWater link (also added to the forecast card) - rainfall dots switch to a violet sequential ramp so they can never be confused with flow-status colors; legend gains 'Other markers' rows (grey no-data gauges, + bank-height sensors) - history-chart flood bands now use each station's own /forecast thresholds (P.1 official fallback) instead of hardcoded 3.0/4.5 - chipStyle(): contrast-safe text on all code/risk/stage chips (dark ink on amber/ochre, darkened fills for white ink); risk/stage ramps drop the blue step for a monotonic green-ochre-amber-red escalation - plain-language tooltips on the flow and capacity tiles - Umami: client script tag plus opt-out server-side middleware posting api-request events (fire-and-forget, 3 s timeout, never blocks) --- src/config.py | 12 ++++ src/static/dashboard.html | 120 ++++++++++++++++++++++++++++++-------- src/web_api.py | 53 +++++++++++++++++ 3 files changed, 161 insertions(+), 24 deletions(-) diff --git a/src/config.py b/src/config.py index 076a59e..97c62b4 100644 --- a/src/config.py +++ b/src/config.py @@ -87,6 +87,18 @@ class Config: ) HII_BASIN_CODE = int(os.getenv("HII_BASIN_CODE", "6")) # 6 = Ping Basin + # Umami analytics (self-hosted). The website id is public (it ships in the + # dashboard @@ -177,6 +178,10 @@ .popup-metric span { display: block; color: var(--muted); font-size: .62rem; } .popup-metric strong { display: block; margin-top: 2px; font-size: .86rem; } .popup-time { margin-top: 9px; color: var(--muted); font-size: .64rem; } + /* Verdict banner: light tinted backgrounds with dark ink (contrast-safe) */ + #flood-verdict.ok { background: #e2f3ea; color: #0c5138; border-color: #bfe3d2; } + #flood-verdict.watch { background: #fdf1dc; color: #6b4a05; border-color: #f0d9a8; } + #flood-verdict.danger { background: #fbe3de; color: #7c1d10; border-color: #f2c0b6; } #legend-toggle { display: none; pointer-events: auto; background: rgba(255,255,255,.93); border: 1px solid rgba(207,224,218,.9); border-radius: 11px; padding: 8px 12px; font-size: .72rem; font-weight: 800; color: var(--ink); @@ -224,10 +229,20 @@ + +
Reporting stations
RID gauges with current readings
-
Chiang Mai river flow
P.1 Nawarat Bridge · m³/s
-
Most stressed gauge
Awaiting station data
+
Chiang Mai river flow
P.1 Nawarat Bridge · m³/s
+
Most stressed gauge
Awaiting station data
Last updated
Loading latest readings
@@ -249,11 +264,14 @@
Rainfall · 24 h
-
Light 0.1–10 mm
-
Moderate 10–35
-
Heavy 35–90
-
Very heavy 90–150
-
Extreme > 150
+
Light 0.1–10 mm
+
Moderate 10–35
+
Heavy 35–90
+
Very heavy 90–150
+
Extreme > 150
+
Other markers
+
Gauge · no recent data
+
+ Water-level sensor · colour = % of bank height
@@ -275,7 +293,8 @@