2026-07-02 21:39:21 +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"
|
2026-07-02 21:39:21 +00:00
|
|
|
import Link from "@lib/components/Link.svelte"
|
|
|
|
|
import RoomName from "@app/components/RoomName.svelte"
|
2026-07-28 16:16:26 +00:00
|
|
|
import {publishReaction, retractReaction} from "@app/reactions"
|
2026-07-02 21:39:21 +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-02 21:39:21 +00:00
|
|
|
import ThunkStatusOrDeleted from "@app/components/ThunkStatusOrDeleted.svelte"
|
|
|
|
|
import EventActivity from "@app/components/EventActivity.svelte"
|
|
|
|
|
import EventActions from "@app/components/EventActions.svelte"
|
|
|
|
|
import {makePollPath, makeSpacePath} from "@app/routes"
|
|
|
|
|
|
2026-07-27 22:38:23 +00:00
|
|
|
type Props = {
|
2026-07-02 21:39:21 +00:00
|
|
|
url: string
|
|
|
|
|
event: TrustedEvent
|
|
|
|
|
showRoom?: boolean
|
|
|
|
|
showActivity?: boolean
|
2026-08-29 16:19:01 +00:00
|
|
|
context: FeedContext
|
2026-07-02 21:39:21 +00:00
|
|
|
}
|
|
|
|
|
|
2026-08-29 16:19:01 +00:00
|
|
|
const {url, event, showRoom, showActivity, context}: Props = $props()
|
2026-07-02 21:39:21 +00:00
|
|
|
|
2026-07-28 16:16:26 +00:00
|
|
|
const h = tagValue(tagSpec("h"), event.tags)
|
2026-07-02 21:39:21 +00:00
|
|
|
const path = makePollPath(url, event.id)
|
|
|
|
|
|
2026-07-28 16:16:26 +00:00
|
|
|
const deleteReaction = (reaction: TrustedEvent) => retractReaction(reaction, {url, h})
|
2026-07-02 21:39:21 +00:00
|
|
|
|
2026-07-28 16:16:26 +00:00
|
|
|
const createReaction = (values: EventContent) => publishReaction(event, values, {url, h})
|
2026-07-02 21:39:21 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<div class="flex grow flex-wrap justify-end gap-2">
|
|
|
|
|
{#if h && showRoom}
|
|
|
|
|
<Link href={makeSpacePath(url, h)} class="button button-neutral button-xs rounded-full">
|
|
|
|
|
Posted in #<RoomName {h} {url} />
|
|
|
|
|
</Link>
|
|
|
|
|
{/if}
|
2026-08-31 17:03:01 +00:00
|
|
|
<ThunkStatusOrDeleted {event} {context}>
|
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}
|
2026-08-29 16:48:04 +00:00
|
|
|
<EventActivity {path} {event} {context} />
|
2026-08-21 15:31:53 +00:00
|
|
|
{/if}
|
|
|
|
|
<EventActions {url} {event} noun="Poll" />
|
|
|
|
|
</ThunkStatusOrDeleted>
|
2026-07-02 21:39:21 +00:00
|
|
|
</div>
|