flotilla/src/app/components/ThunkStatus.svelte
2026-09-21 20:25:01 +00:00

23 lines
731 B
Svelte

<script lang="ts">
import {BaseThunk} from "@welshman/app"
import ThunkFailure from "@app/components/ThunkFailure.svelte"
import ThunkPending from "@app/components/ThunkPending.svelte"
interface Props {
thunk: BaseThunk
showToastOnRetry?: boolean
inline?: boolean
class?: string
}
const {thunk, showToastOnRetry, inline = false, ...restProps}: Props = $props()
const showFailure = $derived($thunk.isComplete() && $thunk.getFailedUrls().length > 0)
const showPending = $derived(!$thunk.isComplete())
</script>
{#if showFailure}
<ThunkFailure class={restProps.class} {thunk} {showToastOnRetry} {inline} />
{:else if showPending}
<ThunkPending class={restProps.class} {thunk} {inline} />
{/if}