flotilla/src/app/components/NoteContentClassified.svelte

33 lines
1 KiB
Svelte
Raw Normal View History

2026-02-03 19:00:13 +00:00
<script lang="ts">
import type {ComponentProps} from "svelte"
2026-07-28 16:16:26 +00:00
import {Classified} from "@welshman/domain"
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 19:00:13 +00:00
import Content from "@app/components/Content.svelte"
2026-02-03 22:18:58 +00:00
import ContentLinkBlock from "@app/components/ContentLinkBlock.svelte"
2026-02-03 19:00:13 +00:00
const props: ComponentProps<typeof Content> = $props()
2026-08-22 20:12:11 +00:00
const classified = $derived(reader(Classified)(props.event))
const title = $derived(classified.title())
const images = $derived(classified.images() ?? [])
const price = $derived(classified.price())
2026-02-03 19:00:13 +00:00
</script>
<div class="flex flex-col gap-2">
{#if title}
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
{/if}
{#if props.event.content}
<Content {...props} />
{/if}
2026-03-06 23:01:15 +00:00
<div class="grid grid-cols-3 sm:grid-cols-5 lg:grid-cols-9 gap-2">
{#each images as image, i (i + image)}
2026-02-03 22:18:58 +00:00
<ContentLinkBlock event={props.event} value={{url: image}} />
{/each}
</div>
2026-02-03 19:00:13 +00:00
</div>