2025-07-07 22:28:36 +00:00
|
|
|
<script lang="ts">
|
|
|
|
|
import type {TrustedEvent, EventContent} from "@welshman/util"
|
2026-07-28 16:16:26 +00:00
|
|
|
import {ZapGoal} from "@welshman/domain"
|
2025-10-06 18:23:19 +00:00
|
|
|
import Link from "@lib/components/Link.svelte"
|
2026-07-28 16:16:26 +00:00
|
|
|
import {reader} from "@app/core"
|
2025-07-07 22:28:36 +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-07-07 22:28:36 +00:00
|
|
|
import ThunkStatusOrDeleted from "@app/components/ThunkStatusOrDeleted.svelte"
|
|
|
|
|
import EventActivity from "@app/components/EventActivity.svelte"
|
|
|
|
|
import EventActions from "@app/components/EventActions.svelte"
|
2025-10-30 22:36:14 +00:00
|
|
|
import RoomName from "@app/components/RoomName.svelte"
|
2026-09-03 20:13:21 +00:00
|
|
|
import {makeSpacePath} from "@app/routes"
|
2025-07-07 22:28:36 +00:00
|
|
|
|
|
|
|
|
interface Props {
|
2025-10-06 18:23:19 +00:00
|
|
|
url: string
|
|
|
|
|
event: TrustedEvent
|
|
|
|
|
showRoom?: boolean
|
2025-07-07 22:28:36 +00:00
|
|
|
showActivity?: boolean
|
2026-08-29 16:19:01 +00:00
|
|
|
context: FeedContext
|
2025-07-07 22:28:36 +00:00
|
|
|
}
|
|
|
|
|
|
2026-08-29 16:19:01 +00:00
|
|
|
const {url, event, showRoom, showActivity, context}: Props = $props()
|
2025-08-19 21:03:04 +00:00
|
|
|
|
2026-07-28 16:16:26 +00:00
|
|
|
const goal = reader(ZapGoal)(event)
|
2025-07-07 22:28:36 +00:00
|
|
|
|
2026-07-28 16:16:26 +00:00
|
|
|
const h = goal.room()
|
2025-07-07 22:28:36 +00:00
|
|
|
|
2026-07-28 16:16:26 +00:00
|
|
|
const deleteReaction = (reaction: TrustedEvent) => retractReaction(reaction, {url})
|
|
|
|
|
|
|
|
|
|
const createReaction = (values: EventContent) => publishReaction(event, values, {url})
|
2025-07-07 22:28:36 +00:00
|
|
|
</script>
|
|
|
|
|
|
2026-09-21 20:25:01 +00:00
|
|
|
<div class="flex min-w-0 grow flex-wrap justify-end gap-2">
|
2025-10-30 22:33:34 +00:00
|
|
|
{#if h && showRoom}
|
2026-06-24 20:56:53 +00:00
|
|
|
<Link href={makeSpacePath(url, h)} class="button button-neutral button-xs rounded-full">
|
2025-10-30 22:36:14 +00:00
|
|
|
Posted in #<RoomName {h} {url} />
|
2025-10-06 18:23:19 +00:00
|
|
|
</Link>
|
|
|
|
|
{/if}
|
2026-08-31 17:03:01 +00:00
|
|
|
<ThunkStatusOrDeleted {event} {context}>
|
2026-08-29 16:19:01 +00:00
|
|
|
<ReactionSummary
|
2026-09-21 20:25:01 +00:00
|
|
|
hideZaps
|
2026-08-29 16:19:01 +00:00
|
|
|
{url}
|
|
|
|
|
{event}
|
|
|
|
|
{context}
|
|
|
|
|
{deleteReaction}
|
|
|
|
|
{createReaction}
|
|
|
|
|
reactionClass="tip-left" />
|
2026-08-21 15:31:53 +00:00
|
|
|
{#if showActivity}
|
2026-09-03 20:13:21 +00:00
|
|
|
<EventActivity {event} {context} />
|
2026-08-21 15:31:53 +00:00
|
|
|
{/if}
|
|
|
|
|
<EventActions {url} {event} hideZap noun="Goal" />
|
|
|
|
|
</ThunkStatusOrDeleted>
|
2025-07-07 22:28:36 +00:00
|
|
|
</div>
|