Add parsing for StationAlerts, and fetch function for Boards.
This commit is contained in:
@@ -1,12 +1,36 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { fade } from 'svelte/transition';
|
||||
let { message = 'Loading...' } = $props();
|
||||
|
||||
let messageIndex = $state(0);
|
||||
|
||||
onMount(() => {
|
||||
const interval = setInterval(() => {
|
||||
if (messageIndex === 0) {
|
||||
messageIndex = 1;
|
||||
} else {
|
||||
messageIndex = messageIndex === 1 ? 2 : 1;
|
||||
}
|
||||
}, 1500);
|
||||
|
||||
return () => clearInterval(interval);
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="loading-state">
|
||||
<div class="track">
|
||||
<div class="shuttle"></div>
|
||||
</div>
|
||||
<p>{message}</p>
|
||||
<div class="message-container">
|
||||
{#if messageIndex === 0}
|
||||
<p in:fade={{ delay: 300, duration: 250 }} out:fade={{ duration: 250 }}>{message}</p>
|
||||
{:else if messageIndex === 1}
|
||||
<p in:fade={{ delay: 300, duration: 250 }} out:fade={{ duration: 250 }}>Slow connection...</p>
|
||||
{:else}
|
||||
<p in:fade={{ delay: 300, duration: 250 }} out:fade={{ duration: 250 }}>Still trying...</p>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
@@ -38,11 +62,18 @@
|
||||
animation: data-travel 1.6s infinite ease-in-out;
|
||||
}
|
||||
|
||||
.message-container {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
height: 2rem;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
p {
|
||||
grid-area: 1 / 1;
|
||||
font-family: 'URW Gothic', sans-serif;
|
||||
letter-spacing: 0.15em;
|
||||
color: var(--color-title);
|
||||
animation: pulse 2s infinite ease-in-out;
|
||||
}
|
||||
|
||||
@keyframes data-travel {
|
||||
@@ -53,14 +84,4 @@
|
||||
left: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes pulse {
|
||||
0%,
|
||||
100% {
|
||||
opacity: 1;
|
||||
}
|
||||
50% {
|
||||
opacity: 0.4;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user