From ddce5c15b3736dd3acc8f2b52cbffb3dbd507a0a Mon Sep 17 00:00:00 2001 From: Timothy Farrell Date: Fri, 24 Jul 2026 02:30:02 +0000 Subject: [PATCH] Add radar tab --- src/App.svelte | 13 +- src/components/PrecipitationRadar.svelte | 655 +++++++++++++++++++++++ 2 files changed, 667 insertions(+), 1 deletion(-) create mode 100644 src/components/PrecipitationRadar.svelte diff --git a/src/App.svelte b/src/App.svelte index 4bf2e60..598b66f 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -6,11 +6,12 @@ import HourlyForecast from './components/HourlyForecast.svelte' import DailyForecast from './components/DailyForecast.svelte' import WeatherDetail from './components/WeatherDetail.svelte' + import PrecipitationRadar from './components/PrecipitationRadar.svelte' import NotificationBell from './components/NotificationBell.svelte' import SettingsDialog from './components/SettingsDialog.svelte' import AddLocationDialog from './components/AddLocationDialog.svelte' - let viewMode = $state('current') // 'current' | 'hourly' | 'daily' | 'detail' + let viewMode = $state('current') // 'current' | 'hourly' | 'daily' | 'detail' | 'radar' let initDone = $state(false) let geoError = $state('') @@ -206,6 +207,11 @@ class:active={viewMode === 'detail'} onclick={() => viewMode = 'detail'} >More + @@ -214,6 +220,7 @@ + @@ -234,6 +241,10 @@
+ {:else if viewMode === 'radar'} +
+ +
{/if} {/if} diff --git a/src/components/PrecipitationRadar.svelte b/src/components/PrecipitationRadar.svelte new file mode 100644 index 0000000..84dd69c --- /dev/null +++ b/src/components/PrecipitationRadar.svelte @@ -0,0 +1,655 @@ + + +
+

Precipitation Radar

+ + {#if error && !loc} +
+ ⚠️ {error} + +
+ {:else} + + + + {#if frame} +
+
+ + + +
+ +
+ { + playing = false + if (animRef) { clearTimeout(animRef); animRef = null } + currentIdx = Number(e.target.value) + }} + aria-label="Radar timeline" + /> +
+ +
+ {fmtTime(frame.time)} + {fmtDate(frame.time)} + {frameLabel} + {currentIdx + 1}/{totalFrames} +
+
+ {:else if !loading} +
+

No radar data available.

+ +
+ {/if} + {/if} +
+ +