2025-02-06 17:39:23 +00:00
|
|
|
<script lang="ts">
|
2026-02-04 01:09:30 +00:00
|
|
|
import type {Snippet} from "svelte"
|
2025-02-06 17:39:23 +00:00
|
|
|
import type {TrustedEvent} from "@welshman/util"
|
2026-02-04 01:09:30 +00:00
|
|
|
import {PublishStatus} from "@welshman/net"
|
2026-07-28 16:16:26 +00:00
|
|
|
import {deriveIsDeleted} from "@app/repository"
|
2025-02-06 17:39:23 +00:00
|
|
|
import ThunkStatus from "@app/components/ThunkStatus.svelte"
|
2026-07-28 16:16:26 +00:00
|
|
|
import {thunks} from "@app/core"
|
2025-02-06 17:39:23 +00:00
|
|
|
|
2026-02-04 01:09:30 +00:00
|
|
|
type Props = {
|
|
|
|
|
event: TrustedEvent
|
|
|
|
|
children?: Snippet
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const {event, children}: Props = $props()
|
2025-02-06 17:39:23 +00:00
|
|
|
|
2026-07-28 16:16:26 +00:00
|
|
|
const deleted = deriveIsDeleted(event)
|
|
|
|
|
const history = $thunks.history
|
|
|
|
|
const thunk = $derived($thunks.merge($history.filter(t => t.event.id === event.id)))
|
2025-02-06 17:39:23 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
{#if $deleted}
|
2026-06-24 20:56:53 +00:00
|
|
|
<div class="button button-error button-xs rounded-full">Deleted</div>
|
2026-07-28 16:16:26 +00:00
|
|
|
{:else if thunk.thunks.length > 0 && !thunk.hasStatus(PublishStatus.Success)}
|
2025-02-06 17:39:23 +00:00
|
|
|
<ThunkStatus {thunk} />
|
2026-02-04 01:09:30 +00:00
|
|
|
{:else if children}
|
|
|
|
|
{@render children?.()}
|
2025-02-06 17:39:23 +00:00
|
|
|
{/if}
|