blockLoading of near to me card until stores have been read

This commit is contained in:
Fred Boniface 2024-07-12 15:26:51 +01:00
parent e3632986c2
commit 2b8d32f3c9
1 changed files with 20 additions and 14 deletions

View File

@ -15,6 +15,7 @@
let errorMessage: string;
let stations: NearestStationResponse[] = [];
let blockLoading: boolean = true;
let config: CardConfig = {
title: "Near to Me",
@ -58,28 +59,33 @@
getNearestStations();
}
}
blockLoading = false;
});
</script>
<Card {config}>
{#if !$uuid || $uuid === "null"}
<LinkButton text="Register to use this feature" link="/more/reg" />
{:else if $location}
{#if !stations.length}
{#if errorMessage}
<p>{errorMessage}</p>
{#if blockLoading}
<InLineLoading />
{:else}
{#if !$uuid || $uuid === "null"}
<LinkButton text="Register to use this feature" link="/more/reg" />
{:else if $location}
{#if !stations.length}
{#if errorMessage}
<p>{errorMessage}</p>
{:else}
<InLineLoading />
{/if}
{:else}
<InLineLoading />
<div id="buttons">
{#each stations as station}
<LinkButton text={`${station.NLCDESC} - ${station.miles}mi`} link={`/ldb?station=${station["3ALPHA"]}`} />
{/each}
</div>
{/if}
{:else}
<div id="buttons">
{#each stations as station}
<LinkButton text={`${station.NLCDESC} - ${station.miles}mi`} link={`/ldb?station=${station["3ALPHA"]}`} />
{/each}
</div>
<ScriptButton text={"Turn on Location"} fn={turnOnLocation} />
{/if}
{:else}
<ScriptButton text={"Turn on Location"} fn={turnOnLocation} />
{/if}
</Card>