2026-02-03 19:00:13 +00:00
|
|
|
<script lang="ts">
|
|
|
|
|
import {formatTimestamp} from "@welshman/lib"
|
|
|
|
|
import type {TrustedEvent} from "@welshman/util"
|
2026-07-28 16:16:26 +00:00
|
|
|
import {getAddress} from "@welshman/util"
|
|
|
|
|
import {Classified} from "@welshman/domain"
|
2026-02-03 19:00:13 +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-02-04 01:09:30 +00:00
|
|
|
import CurrencySymbol from "@lib/components/CurrencySymbol.svelte"
|
2026-07-28 16:16:26 +00:00
|
|
|
import {reader} from "@app/core"
|
2026-02-03 22:18:58 +00:00
|
|
|
import ContentLinkBlock from "@app/components/ContentLinkBlock.svelte"
|
2026-02-03 19:00:13 +00:00
|
|
|
import Content from "@app/components/Content.svelte"
|
|
|
|
|
import ProfileLink from "@app/components/ProfileLink.svelte"
|
|
|
|
|
import ClassifiedActions from "@app/components/ClassifiedActions.svelte"
|
2026-08-29 16:19:01 +00:00
|
|
|
import type {FeedContext} from "@app/feeds"
|
2026-02-03 19:00:13 +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 {makeClassifiedPath} from "@app/routes"
|
2026-02-03 19:00:13 +00:00
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
|
url: string
|
|
|
|
|
event: TrustedEvent
|
2026-08-29 16:19:01 +00:00
|
|
|
context: FeedContext
|
2026-02-03 19:00:13 +00:00
|
|
|
}
|
|
|
|
|
|
2026-08-29 16:19:01 +00:00
|
|
|
const {url, event, context}: Props = $props()
|
2026-02-03 19:00:13 +00:00
|
|
|
|
2026-09-03 20:13:21 +00:00
|
|
|
const path = $derived(makeClassifiedPath(url, getAddress(event)))
|
2026-08-22 20:12:11 +00:00
|
|
|
const classified = $derived(reader(Classified)(event))
|
|
|
|
|
const title = $derived(classified.title())
|
|
|
|
|
const h = $derived(classified.room())
|
|
|
|
|
const images = $derived(new Set(classified.images()))
|
|
|
|
|
const price = $derived(classified.price())
|
2026-02-03 19:00:13 +00:00
|
|
|
</script>
|
|
|
|
|
|
2026-09-09 20:53:25 +00:00
|
|
|
<Cv tag={Link} class="relative flex flex-col gap-2 card card-interactive w-full" href={path}>
|
2026-09-03 20:13:21 +00:00
|
|
|
<UnreadDot {path} class="absolute right-3 top-3" />
|
2026-02-03 19:00:13 +00:00
|
|
|
{#if title}
|
|
|
|
|
<div class="flex w-full items-center justify-between gap-2">
|
2026-02-04 01:09:30 +00:00
|
|
|
<p class="text-xl">
|
|
|
|
|
{title} —
|
2026-07-28 16:16:26 +00:00
|
|
|
<CurrencySymbol code={price?.currency ?? "SAT"} />{price?.amount ?? 0}
|
2026-02-04 01:09:30 +00:00
|
|
|
</p>
|
2026-02-03 19:00:13 +00:00
|
|
|
<p class="text-sm opacity-75">
|
|
|
|
|
{formatTimestamp(event.created_at)}
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
{:else}
|
|
|
|
|
<p class="mb-3 h-0 text-xs opacity-75">
|
|
|
|
|
{formatTimestamp(event.created_at)}
|
|
|
|
|
</p>
|
|
|
|
|
{/if}
|
|
|
|
|
<Content {event} {url} expandMode="inline" />
|
2026-02-03 22:18:58 +00:00
|
|
|
<div class="grid grid-cols-3 sm:grid-cols-5">
|
|
|
|
|
{#each images as image (image)}
|
|
|
|
|
<ContentLinkBlock {event} value={{url: image}} />
|
|
|
|
|
{/each}
|
|
|
|
|
</div>
|
2026-02-03 19:00:13 +00:00
|
|
|
<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>
|
2026-08-29 16:19:01 +00:00
|
|
|
<ClassifiedActions showActivity {url} {event} {context} />
|
2026-02-03 19:00:13 +00:00
|
|
|
</div>
|
2026-09-09 20:53:25 +00:00
|
|
|
</Cv>
|