flotilla/src/app/components/GoalItem.svelte

44 lines
1.3 KiB
Svelte
Raw Normal View History

2025-07-07 22:28:36 +00:00
<script lang="ts">
import type {TrustedEvent} from "@welshman/util"
import {getTagValue} from "@welshman/util"
import Link from "@lib/components/Link.svelte"
import Content from "@app/components/Content.svelte"
import ProfileLink from "@app/components/ProfileLink.svelte"
import GoalActions from "@app/components/GoalActions.svelte"
import GoalSummary from "@app/components/GoalSummary.svelte"
2025-10-30 22:36:14 +00:00
import RoomLink from "@app/components/RoomLink.svelte"
2026-06-08 21:14:40 +00:00
import {makeGoalPath} from "@app/routes"
2025-07-07 22:28:36 +00:00
type Props = {
url: string
event: TrustedEvent
}
const {url, event}: Props = $props()
const summary = getTagValue("summary", event.tags)
2025-10-30 22:33:34 +00:00
const h = getTagValue("h", event.tags)
2025-07-07 22:28:36 +00:00
</script>
<Link
class="cv flex flex-col gap-2 card card-interactive w-full"
href={makeGoalPath(url, event.id)}>
2025-07-07 22:28:36 +00:00
<p class="text-2xl">{event.content}</p>
<Content
event={{content: summary, tags: event.tags}}
{url}
expandMode="inline"
minLength={50}
maxLength={300} />
<GoalSummary {url} {event} />
<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} />
2025-10-30 22:33:34 +00:00
{#if h}
2025-10-30 22:36:14 +00:00
in <RoomLink {url} {h} />
2025-10-06 18:23:19 +00:00
{/if}
2025-07-07 22:28:36 +00:00
</span>
<GoalActions showActivity {url} {event} />
</div>
</Link>