prop/test/microwaveprop_web
Graham McIntire aa8b789d2e
feat(weather/map): persist viewport to URL for reload-stable view
Adds lat/lon/zoom URL params to /weather so reload / share-link
restores the exact map state. The existing ?layer= param keeps
working alongside.

LiveView side:

- mount() reads lat/lon/zoom from query params, clamps to valid
  ranges (lat -90..90, lon -180..180, zoom 4..10), and falls back
  to DFW@z7 when missing or invalid. Initial values flow to the
  hook via three new data attributes.
- handle_event("viewport_changed", ...) accepts {lat, lon, zoom}
  pushed by the hook on debounced moveend, clamps + rounds, and
  push_patches the URL with replace: true so browser history
  doesn't grow an entry per pan tick.
- build_path/2 helper centralises URL construction so select_layer
  and viewport_changed both produce a deterministic param order
  (layer, lat, lon, zoom). Tests assert exact URLs.

JS hook side:

- mounted() reads data-initial-lat/lon/zoom from the el dataset
  with parseFloat/parseInt + Number.isFinite gates, then seeds
  Leaflet's center/zoom from those instead of the previous
  hardcoded (32.897, -97.038, 7).
- moveend handler now also schedules a 400 ms-debounced
  pushEvent("viewport_changed", {lat, lon, zoom}) so the URL
  catches up with whatever the user panned/zoomed to. Separate
  debounce timer from the cells fetch since the URL push and the
  network fetch have different cadence sweet spots.

Tests cover: initial seeding from URL params, clamping of bad
values, viewport_changed event producing the right patched URL,
and the original layer-shareability test (now expecting the full
viewport in the URL).
2026-04-30 09:10:36 -05:00
..
controllers perf(map): /scores/cells binary endpoint, client-side fetch + band/time prefetch 2026-04-29 14:27:20 -05:00
live feat(weather/map): persist viewport to URL for reload-stable view 2026-04-30 09:10:36 -05:00
plugs fix(remote_ip): log IPv6 in canonical hex via :inet.ntoa 2026-04-25 18:05:46 -05:00
analytics_test.exs feat: harden /map analysis breakdown + move Plausible to root layout 2026-04-21 15:56:30 -05:00
live_helpers_test.exs refactor: deduplicate helpers and simplify Scorer 2026-04-28 14:14:34 -05:00
live_table_footer_test.exs Show windowed page list in live_table footer 2026-04-13 10:02:19 -05:00
location_resolver_test.exs refactor: deduplicate helpers and simplify Scorer 2026-04-28 14:14:34 -05:00
metrics_log_suppression_test.exs fix(web): suppress HEAD request logs 2026-04-22 16:50:58 -05:00
metrics_plug_test.exs test: push line coverage from 71.7% → 78.67% 2026-04-23 18:43:18 -05:00
skew_t_property_test.exs test(property): add property tests for terrain + atmospheric math 2026-04-21 13:56:39 -05:00
skew_t_test.exs Fix credo warnings: length/1 on list and nested module aliases 2026-04-16 08:49:25 -05:00
telemetry_test.exs test: fix async-hydration timeout flake + type warning 2026-04-24 09:28:52 -05:00
user_auth_test.exs Beacon power in mW, settings tweaks 2026-04-08 12:45:35 -05:00