Use publishThunks

This commit is contained in:
Jon Staab
2024-11-12 14:32:36 -08:00
parent e656c5cbb1
commit 48e2fff4f8
16 changed files with 110 additions and 72 deletions
@@ -1,11 +1,11 @@
<script lang="ts">
import {assoc, sortBy, append} from "@welshman/lib"
import {sortBy, append} from "@welshman/lib"
import type {EventContent, TrustedEvent} from "@welshman/util"
import {repository} from "@welshman/app"
import {deriveEvents} from "@welshman/store"
import ChannelMessage from "@app/components/ChannelMessage.svelte"
import ChannelCompose from "@app/components/ChannelCompose.svelte"
import {thunks, tagRoom, COMMENT} from "@app/state"
import {tagRoom, COMMENT} from "@app/state"
import {publishComment} from "@app/commands"
export let url, room, event: TrustedEvent
@@ -14,16 +14,13 @@
filters: [{kinds: [COMMENT], "#E": [event.id]}],
})
const onSubmit = ({content, tags}: EventContent) => {
const thunk = publishComment({
const onSubmit = ({content, tags}: EventContent) =>
publishComment({
event,
content,
tags: append(tagRoom(room, url), tags),
relays: [url],
})
thunks.update(assoc(thunk.event.id, thunk))
}
</script>
<div class="col-2">