flotilla/src/app/components/ThunkPending.svelte

33 lines
877 B
Svelte
Raw Normal View History

<script lang="ts">
import {stopPropagation} from "svelte/legacy"
import {PublishStatus} from "@welshman/net"
2026-07-28 16:16:26 +00:00
import type {BaseThunk} from "@welshman/app"
2026-07-28 16:16:26 +00:00
type Props = {
thunk: BaseThunk
class?: string
}
const {thunk, ...restProps}: Props = $props()
2026-07-28 16:16:26 +00:00
const abort = () => thunk.abort()
2026-07-28 16:16:26 +00:00
const isSending = $derived($thunk.hasStatus(PublishStatus.Sending))
</script>
<div class="flex w-full justify-end px-1 text-xs {restProps.class}">
<span class="flex items-center gap-1">
<span class="spinner-xs mx-1 h-3 w-3 translate-y-px"></span>
<span class="opacity-50">Sending...</span>
<button
type="button"
class="underline transition-all"
class:link={isSending}
class:opacity-25={!isSending}
class:pointer-events-none={!isSending}
onclick={stopPropagation(abort)}>
Cancel
</button>
</span>
</div>