about summary refs log tree commit diff stats
path: root/src/App.svelte
diff options
context:
space:
mode:
Diffstat (limited to 'src/App.svelte')
-rw-r--r--src/App.svelte34
1 files changed, 30 insertions, 4 deletions
diff --git a/src/App.svelte b/src/App.svelte
index 27f7f73..0de1e0e 100644
--- a/src/App.svelte
+++ b/src/App.svelte
@@ -1,17 +1,43 @@
 <script>
-  import { level } from "./stores";
+  import { level, paWeather } from "./stores";
+  import ew from "./ew";
+  import { onMount } from "svelte";
+  import { formatUtc } from "./times";
+  import { getMatches } from "./bestiary";
+
+  onMount(async () => {
+    updateWeatherStores();
+  });
+
+  let date = new Date().getTime() * (1440 / 70);
+
+  setInterval(() => {
+    date = new Date().getTime() * (1440 / 70);
+  }, 1000);
+  $: currentEzTime = formatUtc(date);
+
+  function updateWeatherStores() {
+    paWeather.set(ew.forecast(ew.PAGOS_WEATHER));
+  }
+
+  const pagosForecast = ew.forecast(ew.PAGOS_WEATHER);
+  getMatches(pagosForecast, $level);
 
   function levelChanged(evt) {
-    level.set(Number(evt.data));
+    level.set(Number(evt.target.value));
   }
 </script>
 
 <div class="app">
   <h2>
-    Level: <input on:input={levelChanged} type="number" min="1" max="60" />
+    Level: <input on:change={levelChanged} type="number" min="1" max="60" />
   </h2>
 
-  Level is {$level}
+  Level is {$level}<br />
+
+  Time is {currentEzTime}<br />
+
+  Anemos Weather is {pagosForecast[0].weatherName}
 </div>
 
 <style></style>