2026-02-03 19:00:13 +00:00
|
|
|
<script lang="ts">
|
2026-08-29 16:19:01 +00:00
|
|
|
import {onDestroy} from "svelte"
|
2026-07-28 16:16:26 +00:00
|
|
|
import {derived} from "svelte/store"
|
2026-02-03 19:00:13 +00:00
|
|
|
import {sleep} from "@welshman/lib"
|
2026-07-28 16:16:26 +00:00
|
|
|
import {Classified} from "@welshman/domain"
|
2026-02-03 19:00:13 +00:00
|
|
|
import PageContent from "@lib/components/PageContent.svelte"
|
|
|
|
|
import Spinner from "@lib/components/Spinner.svelte"
|
2026-03-12 23:41:07 +00:00
|
|
|
import SpaceBar from "@app/components/SpaceBar.svelte"
|
2026-02-03 22:18:58 +00:00
|
|
|
import NoteContent from "@app/components/NoteContent.svelte"
|
2026-02-03 19:00:13 +00:00
|
|
|
import NoteCard from "@app/components/NoteCard.svelte"
|
|
|
|
|
import ClassifiedActions from "@app/components/ClassifiedActions.svelte"
|
2026-09-10 18:21:49 +00:00
|
|
|
import EventComments from "@app/components/EventComments.svelte"
|
|
|
|
|
import {reader} from "@app/core"
|
|
|
|
|
import {deriveEvent} from "@app/repository"
|
2026-08-29 16:19:01 +00:00
|
|
|
import {makeFeedContext} from "@app/feeds"
|
2026-06-08 22:33:38 +00:00
|
|
|
import {decodeRelay} from "@app/relays"
|
2026-09-16 17:14:43 +00:00
|
|
|
import type {PageProps} from "./$types"
|
2026-02-03 19:00:13 +00:00
|
|
|
|
2026-09-16 17:14:43 +00:00
|
|
|
const {params}: PageProps = $props()
|
|
|
|
|
|
|
|
|
|
const {relay, address} = params
|
2026-02-03 19:00:13 +00:00
|
|
|
const url = decodeRelay(relay)
|
2026-08-29 16:19:01 +00:00
|
|
|
const context = makeFeedContext({relays: [url]})
|
2026-02-04 00:19:14 +00:00
|
|
|
const event = deriveEvent(address, [url])
|
2026-07-28 16:16:26 +00:00
|
|
|
const classified = derived(event, $event => ($event ? reader(Classified)($event) : undefined))
|
2026-02-03 19:00:13 +00:00
|
|
|
|
|
|
|
|
const back = () => history.back()
|
|
|
|
|
|
2026-08-29 16:19:01 +00:00
|
|
|
onDestroy(context.cleanup)
|
2026-02-03 19:00:13 +00:00
|
|
|
</script>
|
|
|
|
|
|
2026-03-12 23:41:07 +00:00
|
|
|
<SpaceBar {back}>
|
2026-02-03 19:00:13 +00:00
|
|
|
{#snippet title()}
|
2026-07-28 16:16:26 +00:00
|
|
|
<h1 class="text-xl">{$classified?.title() ?? ""}</h1>
|
2026-02-03 19:00:13 +00:00
|
|
|
{/snippet}
|
2026-03-12 23:41:07 +00:00
|
|
|
</SpaceBar>
|
2026-02-03 19:00:13 +00:00
|
|
|
|
2026-06-22 20:36:57 +00:00
|
|
|
<PageContent class="flex flex-col gap-2 p-2 sm:gap-4 sm:p-4">
|
2026-02-03 19:00:13 +00:00
|
|
|
{#if $event}
|
2026-09-10 18:21:49 +00:00
|
|
|
<NoteCard event={$event} {url} class="card z-feature w-full">
|
|
|
|
|
<div class="flex flex-col gap-3 ml-12">
|
|
|
|
|
<NoteContent showEntire event={$event} {url} />
|
|
|
|
|
<ClassifiedActions showRoom event={$event} {url} {context} />
|
2026-02-03 19:00:13 +00:00
|
|
|
</div>
|
2026-09-10 18:21:49 +00:00
|
|
|
</NoteCard>
|
|
|
|
|
<EventComments event={$event} {url} {context} />
|
2026-02-03 19:00:13 +00:00
|
|
|
{:else}
|
2026-06-04 21:31:07 +00:00
|
|
|
<div class="flex justify-center py-20">
|
2026-02-04 00:19:14 +00:00
|
|
|
{#await sleep(5000)}
|
|
|
|
|
<Spinner loading>Loading listing...</Spinner>
|
|
|
|
|
{:then}
|
|
|
|
|
<p>Failed to load classified listing.</p>
|
|
|
|
|
{/await}
|
|
|
|
|
</div>
|
2026-02-03 19:00:13 +00:00
|
|
|
{/if}
|
|
|
|
|
</PageContent>
|