diff --git a/src/static/dashboard.html b/src/static/dashboard.html index f547ce4..5de11a8 100644 --- a/src/static/dashboard.html +++ b/src/static/dashboard.html @@ -89,7 +89,10 @@ .side-head { padding: 18px 18px 14px; border-bottom: 1px solid var(--border); } .side-head h2 { margin: 0; font-size: 1rem; } .side-head p { margin: 5px 0 0; color: var(--muted); font-size: .75rem; } - .station-list { overflow-y: auto; padding: 7px; } + .station-list { overflow-y: auto; padding: 7px; min-height: 0; } + /* The RID flow list keeps at least ~5 rows even with the sensor list expanded */ + #river-flow { flex: 1 1 auto; min-height: 280px; } + #thaiwater-sensors { flex: 1 1 auto; } .station-row { width: 100%; display: grid; grid-template-columns: 40px minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 11px; border: 0; border-radius: 12px; box-shadow: none; text-align: left; background: transparent; @@ -238,8 +241,8 @@
-

Additional basin stations

Loading ThaiWater/HII stations…

-
+

Additional basin stations

Loading ThaiWater/HII stations…

+ @@ -619,16 +622,22 @@ }] }); $('history-status').textContent = rows.length ? `${rows.length} measurements${sampled.length !== rows.length ? ` (${sampled.length} daily averages)` : ''}` : 'No measurements in this period'; - $('history-card').scrollIntoView({ behavior: 'smooth', block: 'nearest' }); } catch (error) { $('history-status').textContent = `History unavailable: ${error.message}`; } } + function setSensorsOpen(open) { + state.sensorsOpen = open; + $('thaiwater-sensors').style.display = open ? '' : 'none'; + $('sensors-arrow').textContent = open ? '▾' : '▸'; + } + // Filters both station lists by any text on the row (code, names, river — // Thai included, since it matches against the rendered text). function applyStationSearch() { const query = $('station-search').value.trim().toLowerCase(); + if (query && !state.sensorsOpen) setSensorsOpen(true); // search reaches hidden stations ['river-flow', 'thaiwater-sensors'].forEach((id) => { [...$(id).children].forEach((row) => { row.style.display = !query || row.textContent.toLowerCase().includes(query) ? '' : 'none'; @@ -1174,6 +1183,10 @@ : `Show all ${count} station forecasts ▾`; }); $('station-search').addEventListener('input', applyStationSearch); + $('sensors-head').addEventListener('click', () => setSensorsOpen(!state.sensorsOpen)); + $('sensors-head').addEventListener('keydown', (event) => { + if (event.key === 'Enter' || event.key === ' ') { event.preventDefault(); setSensorsOpen(!state.sensorsOpen); } + }); $('rain-toggle').addEventListener('change', (event) => { if (!state.rainLayer) return; if (event.target.checked) state.rainLayer.addTo(state.map);