2025-06-13 17:14:12 +00:00
|
|
|
<script lang="ts">
|
|
|
|
|
import type {TrustedEvent, EventContent} from "@welshman/util"
|
2026-07-28 16:16:26 +00:00
|
|
|
import {tagSpec, tagValue} from "@welshman/util"
|
2025-06-13 17:14:12 +00:00
|
|
|
import ReactionSummary from "@app/components/ReactionSummary.svelte"
|
2026-08-29 16:19:01 +00:00
|
|
|
import type {FeedContext} from "@app/feeds"
|
2026-07-28 16:16:26 +00:00
|
|
|
import {publishReaction, retractReaction} from "@app/reactions"
|
2025-06-13 17:14:12 +00:00
|
|
|
import ThunkStatusOrDeleted from "@app/components/ThunkStatusOrDeleted.svelte"
|
|
|
|
|
import EventActivity from "@app/components/EventActivity.svelte"
|
|
|
|
|
import EventActions from "@app/components/EventActions.svelte"
|
2026-06-08 21:14:40 +00:00
|
|
|
import {makeSpacePath} from "@app/routes"
|
2025-06-13 17:14:12 +00:00
|
|
|
|
2026-07-28 16:16:26 +00:00
|
|
|
type Props = {
|
2026-02-03 19:00:13 +00:00
|
|
|
url: string
|
|
|
|
|
event: TrustedEvent
|
2026-08-17 15:42:14 +00:00
|
|
|
segment?: string
|
2025-06-13 17:14:12 +00:00
|
|
|
showActivity?: boolean
|
2026-08-29 16:19:01 +00:00
|
|
|
context: FeedContext
|
2025-06-13 17:14:12 +00:00
|
|
|
}
|
|
|
|
|
|
2026-08-29 16:19:01 +00:00
|
|
|
const {url, event, segment, showActivity = false, context}: Props = $props()
|
2025-06-13 17:14:12 +00:00
|
|
|
|
2026-07-28 16:16:26 +00:00
|
|
|
const h = tagValue(tagSpec("h"), event.tags)
|
2025-08-19 21:03:04 +00:00
|
|
|
|
2026-08-17 15:42:14 +00:00
|
|
|
const path = segment && makeSpacePath(url, segment, event.id)
|
2025-06-13 17:14:12 +00:00
|
|
|
|
2026-07-28 16:16:26 +00:00
|
|
|
const deleteReaction = (reaction: TrustedEvent) => retractReaction(reaction, {url, h})
|
2025-06-13 17:14:12 +00:00
|
|
|
|
2026-07-28 16:16:26 +00:00
|
|
|
const createReaction = (values: EventContent) => publishReaction(event, values, {url, h})
|
2025-06-13 17:14:12 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<div class="flex flex-wrap items-center justify-between gap-2">
|
2026-04-07 21:53:19 +00:00
|
|
|
<div class="flex grow flex-wrap justify-end gap-2">
|
2026-08-21 15:31:53 +00:00
|
|
|
<ThunkStatusOrDeleted {event}>
|
2026-08-29 16:19:01 +00:00
|
|
|
<ReactionSummary
|
|
|
|
|
{url}
|
|
|
|
|
{event}
|
|
|
|
|
{context}
|
|
|
|
|
{deleteReaction}
|
|
|
|
|
{createReaction}
|
|
|
|
|
reactionClass="tip-left" />
|
2026-08-21 15:31:53 +00:00
|
|
|
{#if showActivity && path}
|
|
|
|
|
<EventActivity {url} {path} {event} />
|
|
|
|
|
{/if}
|
|
|
|
|
<EventActions {url} {event} noun="Comment" />
|
|
|
|
|
</ThunkStatusOrDeleted>
|
2025-06-13 17:14:12 +00:00
|
|
|
</div>
|
|
|
|
|
</div>
|