2025-07-07 22:28:36 +00:00
|
|
|
<script lang="ts">
|
2026-09-21 20:25:01 +00:00
|
|
|
import type {Readable} from "svelte/store"
|
2025-07-07 22:28:36 +00:00
|
|
|
import type {TrustedEvent} from "@welshman/util"
|
2026-07-28 16:16:26 +00:00
|
|
|
import {ZapGoal} from "@welshman/domain"
|
2025-07-07 22:28:36 +00:00
|
|
|
import Link from "@lib/components/Link.svelte"
|
2026-09-09 20:53:25 +00:00
|
|
|
import Cv from "@lib/components/Cv.svelte"
|
2026-07-28 16:16:26 +00:00
|
|
|
import {reader} from "@app/core"
|
2025-07-07 22:28:36 +00:00
|
|
|
import Content from "@app/components/Content.svelte"
|
|
|
|
|
import ProfileLink from "@app/components/ProfileLink.svelte"
|
|
|
|
|
import GoalActions from "@app/components/GoalActions.svelte"
|
2026-08-29 16:19:01 +00:00
|
|
|
import type {FeedContext} from "@app/feeds"
|
2026-09-21 20:25:01 +00:00
|
|
|
import type {GoalProgress} from "@app/goals"
|
2025-07-07 22:28:36 +00:00
|
|
|
import GoalSummary from "@app/components/GoalSummary.svelte"
|
2025-10-30 22:36:14 +00:00
|
|
|
import RoomLink from "@app/components/RoomLink.svelte"
|
2026-09-03 20:13:21 +00:00
|
|
|
import UnreadDot from "@app/components/UnreadDot.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
|
2026-08-29 16:19:01 +00:00
|
|
|
context: FeedContext
|
2026-09-21 20:25:01 +00:00
|
|
|
progress?: Readable<GoalProgress>
|
2025-07-07 22:28:36 +00:00
|
|
|
}
|
|
|
|
|
|
2026-09-21 20:25:01 +00:00
|
|
|
const {url, event, context, progress}: Props = $props()
|
2025-07-07 22:28:36 +00:00
|
|
|
|
2026-07-28 16:16:26 +00:00
|
|
|
const goal = reader(ZapGoal)(event)
|
|
|
|
|
|
2026-09-03 20:13:21 +00:00
|
|
|
const path = makeGoalPath(url, event.id)
|
2026-07-28 16:16:26 +00:00
|
|
|
const title = goal.title()
|
|
|
|
|
const summary = goal.summary()
|
2026-09-21 20:25:01 +00:00
|
|
|
const image = goal.image()
|
2026-07-28 16:16:26 +00:00
|
|
|
const h = goal.room()
|
2025-07-07 22:28:36 +00:00
|
|
|
</script>
|
|
|
|
|
|
2026-09-21 20:25:01 +00:00
|
|
|
<Cv tag={Link} class="relative flex flex-col gap-3 card card-interactive w-full" href={path}>
|
2026-09-03 20:13:21 +00:00
|
|
|
<UnreadDot {path} class="absolute right-3 top-3" />
|
2026-09-21 20:25:01 +00:00
|
|
|
{#if image}
|
|
|
|
|
<img src={image} alt="" class="h-40 w-full max-w-full rounded-2xl object-cover" />
|
|
|
|
|
{/if}
|
|
|
|
|
<p class="line-clamp-2 wrap-break-word text-xl font-bold">{title}</p>
|
|
|
|
|
{#if summary}
|
|
|
|
|
<div class="text-sm text-content-muted">
|
|
|
|
|
<Content
|
|
|
|
|
event={{content: summary, tags: event.tags}}
|
|
|
|
|
{url}
|
|
|
|
|
expandMode="inline"
|
|
|
|
|
minLength={50}
|
|
|
|
|
maxLength={180} />
|
|
|
|
|
</div>
|
|
|
|
|
{/if}
|
|
|
|
|
<GoalSummary {url} {event} {progress} />
|
|
|
|
|
<div class="flex w-full min-w-0 flex-wrap items-center justify-between gap-2">
|
|
|
|
|
<span class="min-w-0 py-1 text-sm text-content-muted">
|
|
|
|
|
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>
|
2026-08-29 16:19:01 +00:00
|
|
|
<GoalActions showActivity {url} {event} {context} />
|
2025-07-07 22:28:36 +00:00
|
|
|
</div>
|
2026-09-09 20:53:25 +00:00
|
|
|
</Cv>
|