2024-10-16 22:57:18 +00:00
|
|
|
<script lang="ts">
|
2026-07-28 16:16:26 +00:00
|
|
|
import {BaseThunk} from "@welshman/app"
|
2025-08-19 21:03:04 +00:00
|
|
|
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
|
2026-06-04 21:10:00 +00:00
|
|
|
showToastOnRetry?: boolean
|
2025-02-04 01:21:46 +00:00
|
|
|
class?: string
|
2025-02-04 00:37:14 +00:00
|
|
|
}
|
|
|
|
|
|
2026-06-04 21:10:00 +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}
|
2026-06-04 21:10:00 +00:00
|
|
|
<ThunkFailure class={restProps.class} {thunk} {showToastOnRetry} />
|
2025-04-16 21:19:09 +00:00
|
|
|
{:else if showPending}
|
2025-08-19 21:03:04 +00:00
|
|
|
<ThunkPending class={restProps.class} {thunk} />
|
2025-01-15 01:23:27 +00:00
|
|
|
{/if}
|