flotilla/src/app/components/PollItem.svelte

39 lines
1.3 KiB
Svelte
Raw Normal View History

2026-04-03 17:54:50 +00:00
<script lang="ts">
import type {TrustedEvent} from "@welshman/util"
2026-07-28 16:16:26 +00:00
import {tagSpec, tagValue} from "@welshman/util"
2026-04-03 17:54:50 +00:00
import Link from "@lib/components/Link.svelte"
import Cv from "@lib/components/Cv.svelte"
2026-04-03 17:54:50 +00:00
import NoteContent from "@app/components/NoteContent.svelte"
import PollActions from "@app/components/PollActions.svelte"
import type {FeedContext} from "@app/feeds"
2026-04-03 17:54:50 +00:00
import RoomLink from "@app/components/RoomLink.svelte"
import ProfileLink from "@app/components/ProfileLink.svelte"
import UnreadDot from "@app/components/UnreadDot.svelte"
2026-06-08 21:14:40 +00:00
import {makePollPath} from "@app/routes"
2026-04-03 17:54:50 +00:00
type Props = {
url: string
event: TrustedEvent
context: FeedContext
2026-04-03 17:54:50 +00:00
}
const {url, event, context}: Props = $props()
2026-04-03 17:54:50 +00:00
const path = makePollPath(url, event.id)
2026-07-28 16:16:26 +00:00
const h = tagValue(tagSpec("h"), event.tags)
2026-04-03 17:54:50 +00:00
</script>
<Cv tag={Link} class="relative flex flex-col gap-2 card card-interactive w-full" href={path}>
<UnreadDot {path} class="absolute right-3 top-3" />
2026-04-03 17:54:50 +00:00
<NoteContent {event} {url} />
<div class="flex w-full flex-col items-end justify-between gap-2 sm:flex-row">
<span class="whitespace-nowrap py-1 text-sm opacity-75">
Posted by <ProfileLink pubkey={event.pubkey} {url} />
{#if h}
in <RoomLink {url} {h} />
{/if}
</span>
<PollActions showActivity {url} {event} {context} />
2026-04-03 17:54:50 +00:00
</div>
</Cv>