8 Commits

Author SHA1 Message Date
f09fc5b1a3 Drop lightning layer: remove Blitzortung CORS-relay feature entirely
All checks were successful
Test, Build & Deploy / test-and-build (push) Successful in 52s
Test, Build & Deploy / deploy (push) Successful in 25s
Blitzortung exposes no browser-readable JSON endpoint, so a pure Caddy
cors proxy (browser-to-cross-origin) was never going to work without an
upstream that already sends permissive CORS + reshaped strikes. Rather than
add that relay, delete the whole branch:

- src/components/PrecipitationRadar.svelte: remove lightning import, $state
  (strikes/error/loading/timer), loadLightning/timers, and its location effect
  (704 -> 650 lines)
- src/lib/api/lightning.js + tests/lib/api/lightning.test.js removed (15 test cases; suite 114 -> 99, all green)
- db.js / app.svelte.js: drop dead showLightning settings key (unreferenced)

Build re-bundled to dist/index.html; no lightning references remain in source or bundle.
2026-09-25 23:45:43 +00:00
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
882fd69a18 Add official NWS advisories as notifications, deduping forecast alerts
All checks were successful
Test, Build & Deploy / test-and-build (push) Successful in 25s
Test, Build & Deploy / deploy (push) Successful in 20s
- nws.js: new fetchActiveAdvisories() hits the official NWS alerts feed
  (api.weather.gov /alerts/active?point=lat,lon) and normalizes each advisory
  into the app's alert shape, tagged source:'nws'. Adds classifyAdvisoryEvent
  (maps NWS events -> app buckets: heat/wind/cold/storm/precip, else advisory),
  nwsSeverity (Extreme/Severe->danger etc.), advisoryId (stable short id from
  the URN), advisoryIcon, and local effectiveDate/expiresDate for dedup.

- notifications store: cached _nwsAdvisories + refreshAdvisories() (best
  effort, cached 5 min, non-US/no-alerts safe). analyze() now merges
  advisories via new pure mergeAdvisories(): an advisory that is officially
  in force on a date supersedes the derived forecast alert of the same type
  on that date, so the official NWS warning replaces the forecast guess. Both
  are dismissible independently (nws-* vs forecast-* ids).

- New per-type toggle "advisory" (defaults on) across app/default settings and
  SettingsDialog, so official advisories are configurable like every other
  alert and the bell shows them with their own severity/icon.

- Wired: App.svelte calls refreshAdvisories() alongside analyze() on forecast
  load and changes.

- Tests: 12 advisory tests (classifier, severity, id, normalize, dedup incl.
  disable toggle) + 3 store integration tests (overlap dedup, non-overlap kept,
  toggle-off). 107 total pass.

- Verified end-to-end in headless Chromium against the live NWS feed for
  Rogers County, OK: the current Heat Advisory appears in the bell, and the
  derived heat alerts for the days it covers are suppressed while a
  non-overlapping day's forecast heat alert remains.
2026-09-08 02:33:37 +00:00
97b676093a Add moon phase card to Weather Details
All checks were successful
Test, Build & Deploy / test-and-build (push) Successful in 23s
Test, Build & Deploy / deploy (push) Successful in 21s
- New src/lib/api/moon.js: fetches daily moon_phase from Open-Meteo
  (independent of the NWS/Open-Meteo weather source, since NWS has no moon
  data), plus pure helpers: moonName (8 phases), illumination fraction, and
  nextMoonPhase, which unwraps the ~29.5-day cycle and interpolates the next
  quarter boundary (new/first quarter/full/last quarter), returning its name,
  date, and days until it.
- New MoonPhaseCard.svelte: renders an SVG moon (two-circle terminator that
  correctly shows crescent/quarter/gibbous shapes), the current phase name,
  percent illuminated, and the next phase with date. Caches per-location via
  an effect; degrades gracefully when unavailable.
- Wired into WeatherDetail between Sun and UV and Temperature Range.
- 11 unit tests for moonName/illumination/interpolation/nextMoonPhase.
- Verified in headless Chromium: card renders, moon shape correct, no errors.
2026-09-08 02:25:01 +00:00
7e06c17bfa Use light-drizzle icon for WMO 61 (light rain) and 80 (light showers)
Both codes now render 🌦️ instead of 🌧️ in the CODE_MAP. Updated the
weather-codes tests accordingly.
2026-08-27 00:35:29 +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
0b8e012569 Show light drizzle icon on 7-day forecast when rain/storm chance is low 2026-08-18 17:44:42 +00:00
4ffb44e107 First pass 2026-07-24 01:53:36 +00:00