Make thunks global

This commit is contained in:
Jon Staab
2024-11-12 14:03:21 -08:00
parent bf6e1a854a
commit e656c5cbb1
9 changed files with 33 additions and 33 deletions
@@ -1,19 +1,15 @@
<script lang="ts">
import {writable} from "svelte/store"
import {assoc, sortBy, append} from "@welshman/lib"
import type {EventContent, TrustedEvent} from "@welshman/util"
import {repository} from "@welshman/app"
import type {Thunk} from "@welshman/app"
import {deriveEvents} from "@welshman/store"
import ChannelMessage from "@app/components/ChannelMessage.svelte"
import ChannelCompose from "@app/components/ChannelCompose.svelte"
import {tagRoom, COMMENT} from "@app/state"
import {thunks, tagRoom, COMMENT} from "@app/state"
import {publishComment} from "@app/commands"
export let url, room, event: TrustedEvent
const thunks = writable({} as Record<string, Thunk>)
const replies = deriveEvents(repository, {
filters: [{kinds: [COMMENT], "#E": [event.id]}],
})
@@ -32,9 +28,9 @@
<div class="col-2">
<div class="overflow-auto pt-3">
<ChannelMessage {url} {room} {event} thunk={$thunks[event.id]} showPubkey isHead inert />
<ChannelMessage {url} {room} {event} showPubkey isHead inert />
{#each sortBy(e => e.created_at, $replies) as reply (reply.id)}
<ChannelMessage {url} {room} event={reply} thunk={$thunks[reply.id]} showPubkey inert />
<ChannelMessage {url} {room} event={reply} showPubkey inert />
{/each}
</div>
<div class="bottom-0 left-0 right-0">