flotilla/src/app/components/ThunkStatusOrDeleted.svelte

18 lines
574 B
Svelte
Raw Normal View History

2025-02-06 17:39:23 +00:00
<script lang="ts">
import type {TrustedEvent} from "@welshman/util"
import {deriveIsDeleted} from "@welshman/store"
import {thunks, mergeThunks, repository} from "@welshman/app"
2025-02-06 17:39:23 +00:00
import ThunkStatus from "@app/components/ThunkStatus.svelte"
const {event}: {event: TrustedEvent} = $props()
const deleted = deriveIsDeleted(repository, event)
const thunk = $derived(mergeThunks($thunks.filter(t => t.event.id === event.id)))
2025-02-06 17:39:23 +00:00
</script>
{#if $deleted}
<div class="btn btn-error btn-xs rounded-full">Deleted</div>
{:else if thunk}
<ThunkStatus {thunk} />
{/if}