flotilla/src/app/components/ThunkStatus.svelte

23 lines
676 B
Svelte
Raw Normal View History

2024-10-16 22:57:18 +00:00
<script lang="ts">
2026-07-28 16:16:26 +00:00
import {BaseThunk} 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 {
2026-07-28 16:16:26 +00:00
thunk: BaseThunk
showToastOnRetry?: boolean
class?: string
2025-02-04 00:37:14 +00:00
}
const {thunk, showToastOnRetry, ...restProps}: Props = $props()
2024-10-16 22:57:18 +00:00
2026-07-28 16:16:26 +00:00
const showFailure = $derived($thunk.isComplete() && $thunk.getFailedUrls().length > 0)
const showPending = $derived(!$thunk.isComplete())
2024-10-16 22:57:18 +00:00
</script>
2025-04-16 21:19:09 +00:00
{#if showFailure}
<ThunkFailure class={restProps.class} {thunk} {showToastOnRetry} />
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}