feat: battery-aware itinerary nudge + PWA / offline support

Battery nudge:
- lib/batteryPlan: project SoC through the planned stops using current
  Tesla battery (or 80% default), 85% of rated range, and conservative
  per-stop charge rates (Supercharger 1.5%/min, dest charger 0.4%/min).
- LegRow shows "arrive X%" plus a tone (red/amber/transparent) and a
  TIGHT / WON'T REACH chip if the projected arrival is below 15%/5%.
- Top-of-itinerary banner when any leg is danger or warning, naming the
  current SoC source (live Tesla vs assumed 80%).

PWA / offline:
- vite-plugin-pwa with autoUpdate strategy; ServiceWorker registered in
  main.tsx (prod-only).
- Workbox cache strategies:
    map tiles      CacheFirst, 30 days, 800 entries
    nominatim/OSRM NetworkFirst with cached fallback
    /api/*         NetworkFirst, short TTL, last response stays usable
- App shell precached so the planner renders offline; navigateFallback
  ensures deep links serve index.html without a network round trip.
- manifest.webmanifest + theme-color + favicon.svg (replaces dead
  /tesla-icon.svg reference). Installable to home screen.
- Sonner toasts on offline-ready and update-available.
This commit is contained in:
2026-05-31 23:07:34 +01:00
parent 381eb18cd3
commit a90c8a9354
9 changed files with 4628 additions and 98 deletions
+4
View File
@@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
<rect width="32" height="32" rx="7" fill="#e31937"/>
<path d="M9 21l5.5-10h3L23 21l-2.7-1.5L17 14l-3.5 5.5L9 21z" fill="#fff"/>
</svg>

After

Width:  |  Height:  |  Size: 200 B