2 Commits

Author SHA1 Message Date
86acc56143 feat(radar): only show lightning strikes within 25 miles
Add haversineKm helper and filterStrikesWithinKm filter in
src/lib/api/lightning.js. PrecipitationRadar now filters strikes by
distance from the current location before projecting them, so only
strikes within 25 miles render. No data-source change; relay-down
behavior is unchanged.

Fixes an incorrect haversine expectation in the test (0.3567 deg of
latitude ~= 39.66 km, not 25.7 km).
2026-09-20 19:47:37 +00:00
ff73e58d31 Add toggleable lightning strike layer to the radar map
- Lightning layer on PrecipitationRadar: toggleable ⚡ button (persisted via
  showLightning setting). When on, fetches recent strikes from the planned CORS
  relay and renders them as markers that pan/zoom with the slippy map.
- New src/lib/api/lightning.js: fetchLightningStrikes() reads
  https://cors.thecookiejar.me/lightning?lat&lon&radiusKm&limit (relay NOT
  deployed yet) with an 8s abort timeout and graceful failure - never blocks or
  crashes the map, shows an unavailable banner instead. Exports pure
  projectStrikeToLayer() for Mercator tile-layer marker projection.
- showLightning setting added to DEFAULT_SETTINGS + app store; toggle persists.
- Tests: fetch URL/parsing/error handling + layer projection. 71 total pass.
2026-08-27 00:30:25 +00:00