feat: add loading state to view
Some checks failed
TrafficCue CI / check (push) Failing after 57s
TrafficCue CI / build (push) Successful in 1m38s
TrafficCue CI / build-android (push) Successful in 15m1s

This commit is contained in:
2025-09-16 18:22:48 +02:00
parent 222216f172
commit 28796ee267
7 changed files with 105 additions and 14 deletions

View File

@ -24,6 +24,7 @@
import LoadingSidebar from "./sidebar/LoadingSidebar.svelte";
import { Tween } from "svelte/motion";
import { quintOut } from "svelte/easing";
import Progressbar from "../Progressbar.svelte";
const views: Record<string, string> = {
main: "MainSidebar",
@ -134,10 +135,6 @@
return () => value;
}
// TODO: implement loading state
// eslint-disable-next-line @typescript-eslint/no-unused-vars
let loading = $state(false);
let searchText = $derived.by(debounce(() => searchbar.text, 300));
let searchResults: Feature[] = $state([]);
let mobileView = $derived(window.innerWidth < 768 || routing.currentTrip);
@ -149,10 +146,10 @@
return;
}
if (searchText.length > 0) {
loading = true;
view.loading = true;
search(searchText, 0, 0).then((results) => {
searchResults = results;
loading = false;
view.loading = false;
view.switch("search", {
results: searchResults,
query: searchText,
@ -211,6 +208,10 @@
</div>
{/if}
{#if view.loading}
<Progressbar />
{/if}
{#if routing.currentTrip}
<InRouteSidebar />
{:else}