2024-10-23 23:16:28 +00:00
|
|
|
<script lang="ts">
|
2025-05-12 22:10:24 +00:00
|
|
|
import type {TrustedEvent, EventContent} from "@welshman/util"
|
2024-10-24 16:45:27 +00:00
|
|
|
import ReactionSummary from "@app/components/ReactionSummary.svelte"
|
2025-02-06 17:39:23 +00:00
|
|
|
import ThunkStatusOrDeleted from "@app/components/ThunkStatusOrDeleted.svelte"
|
2025-02-06 17:53:50 +00:00
|
|
|
import EventActivity from "@app/components/EventActivity.svelte"
|
2025-02-06 18:00:25 +00:00
|
|
|
import EventActions from "@app/components/EventActions.svelte"
|
2025-07-30 23:30:03 +00:00
|
|
|
import {publishDelete, publishReaction, canEnforceNip70} from "@app/commands"
|
2025-02-06 17:29:30 +00:00
|
|
|
import {makeThreadPath} from "@app/routes"
|
2024-10-23 23:16:28 +00:00
|
|
|
|
2025-02-04 00:37:14 +00:00
|
|
|
interface Props {
|
|
|
|
|
url: any
|
|
|
|
|
event: any
|
|
|
|
|
showActivity?: boolean
|
|
|
|
|
}
|
|
|
|
|
|
2025-02-04 01:21:46 +00:00
|
|
|
const {url, event, showActivity = false}: Props = $props()
|
2024-10-24 16:45:27 +00:00
|
|
|
|
2025-08-19 21:03:04 +00:00
|
|
|
const shouldProtect = canEnforceNip70(url)
|
|
|
|
|
|
2025-02-06 17:29:30 +00:00
|
|
|
const path = makeThreadPath(url, event.id)
|
2024-10-23 23:16:28 +00:00
|
|
|
|
2025-07-30 23:30:03 +00:00
|
|
|
const deleteReaction = async (event: TrustedEvent) =>
|
2025-08-19 21:03:04 +00:00
|
|
|
publishDelete({relays: [url], event, protect: await shouldProtect})
|
2024-10-23 23:16:28 +00:00
|
|
|
|
2025-07-30 23:30:03 +00:00
|
|
|
const createReaction = async (template: EventContent) =>
|
2025-08-19 21:03:04 +00:00
|
|
|
publishReaction({...template, event, relays: [url], protect: await shouldProtect})
|
2024-10-23 23:16:28 +00:00
|
|
|
</script>
|
|
|
|
|
|
2024-10-24 16:58:43 +00:00
|
|
|
<div class="flex flex-wrap items-center justify-between gap-2">
|
2024-10-31 19:24:40 +00:00
|
|
|
<div class="flex flex-grow flex-wrap justify-end gap-2">
|
2025-05-12 22:10:24 +00:00
|
|
|
<ReactionSummary {url} {event} {deleteReaction} {createReaction} reactionClass="tooltip-left" />
|
2025-02-06 17:39:23 +00:00
|
|
|
<ThunkStatusOrDeleted {event} />
|
2024-10-24 16:45:27 +00:00
|
|
|
{#if showActivity}
|
2025-02-06 17:53:50 +00:00
|
|
|
<EventActivity {url} {path} {event} />
|
2024-10-24 16:45:27 +00:00
|
|
|
{/if}
|
2025-02-06 18:14:29 +00:00
|
|
|
<EventActions {url} {event} noun="Thread" />
|
2024-10-23 23:16:28 +00:00
|
|
|
</div>
|
|
|
|
|
</div>
|