Skip to content

Commit

Permalink
Add loading spinner to log page
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmorley15 committed Apr 11, 2024
1 parent cc7e950 commit ea0477d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/routes/log/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script lang="ts">
export let data;
let adventures: Adventure[] = [];
let isLoading = true;
import AdventureCard from "$lib/components/AdventureCard.svelte";
import type { Adventure } from "$lib/utils/types";
Expand Down Expand Up @@ -36,6 +37,7 @@
onMount(async () => {
console.log(data);
adventures = data.result.adventures;
isLoading = false;
});
let count = 0;
Expand Down Expand Up @@ -243,6 +245,12 @@
</div>
{/if}

{#if isLoading}
<div class="flex justify-center items-center w-full mt-16">
<span class="loading loading-spinner w-24 h-24"></span>
</div>
{/if}

{#if isShowingToast}
<SucessToast action={toastAction} />
{/if}
Expand Down Expand Up @@ -274,14 +282,14 @@
{/each}
</div>

{#if adventures.length == 0}
{#if adventures.length == 0 && !isLoading}
<div class="flex flex-col items-center justify-center mt-16">
<article class="prose mb-4"><h2>Add some adventures!</h2></article>
<img src={mapDrawing} width="25%" alt="Logo" />
</div>
{/if}

{#if adventures.length != 0}
{#if adventures.length != 0 && !isLoading}
<div class="flex justify-center items-center w-full mt-4">
<article class="prose">
<h2 class="text-center">Actions</h2>
Expand Down

0 comments on commit ea0477d

Please sign in to comment.