flotilla/src/app/components/ThunkStatus.svelte

23 lines
701 B
Svelte
Raw Normal View History

2024-10-16 22:57:18 +00:00
<script lang="ts">
import type {AbstractThunk} from "@welshman/app"
import {thunkIsComplete, getFailedThunkUrls} from "@welshman/app"
import ThunkFailure from "@app/components/ThunkFailure.svelte"
import ThunkPending from "@app/components/ThunkPending.svelte"
2024-10-16 22:57:18 +00:00
2025-02-04 00:37:14 +00:00
interface Props {
thunk: AbstractThunk
class?: string
2025-02-04 00:37:14 +00:00
}
const {thunk, ...restProps}: Props = $props()
2024-10-16 22:57:18 +00:00
const showFailure = $derived(thunkIsComplete($thunk) && getFailedThunkUrls($thunk).length > 0)
const showPending = $derived(!thunkIsComplete($thunk))
2024-10-16 22:57:18 +00:00
</script>
2025-04-16 21:19:09 +00:00
{#if showFailure}
<ThunkFailure class={restProps.class} {thunk} />
2025-04-16 21:19:09 +00:00
{:else if showPending}
<ThunkPending class={restProps.class} {thunk} />
2025-01-15 01:23:27 +00:00
{/if}