2025-06-05 03:37:48 +00:00
|
|
|
<script lang="ts">
|
2026-08-29 16:19:01 +00:00
|
|
|
import {onDestroy} from "svelte"
|
2025-06-05 03:37:48 +00:00
|
|
|
import type {Snippet} from "svelte"
|
|
|
|
|
import {NOTE} from "@welshman/util"
|
2026-06-24 20:56:53 +00:00
|
|
|
import Spinner from "@lib/components/Spinner.svelte"
|
2025-06-05 03:37:48 +00:00
|
|
|
import NoteItem from "@app/components/NoteItem.svelte"
|
2026-07-28 16:16:26 +00:00
|
|
|
import {network} from "@app/core"
|
2026-08-29 16:19:01 +00:00
|
|
|
import {makeFeedContext} from "@app/feeds"
|
2025-06-05 03:37:48 +00:00
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
|
url: string
|
|
|
|
|
pubkey: string
|
|
|
|
|
limit?: number
|
|
|
|
|
fallback?: Snippet
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const {url, pubkey, limit = 1, fallback}: Props = $props()
|
|
|
|
|
|
2026-08-29 16:19:01 +00:00
|
|
|
const context = makeFeedContext({relays: [url]})
|
|
|
|
|
|
|
|
|
|
onDestroy(context.cleanup)
|
|
|
|
|
|
2026-07-28 16:16:26 +00:00
|
|
|
const events = $network.load({
|
2025-06-05 03:37:48 +00:00
|
|
|
relays: [url],
|
|
|
|
|
filters: [{authors: [pubkey], kinds: [NOTE], limit}],
|
|
|
|
|
})
|
|
|
|
|
</script>
|
|
|
|
|
|
2026-06-24 20:56:53 +00:00
|
|
|
<div class="flex flex-col gap-4">
|
2025-06-05 03:37:48 +00:00
|
|
|
<div class="flex flex-col gap-2">
|
|
|
|
|
{#await events}
|
2026-06-24 20:56:53 +00:00
|
|
|
<p class="flex justify-center items-center min-h-6">
|
|
|
|
|
<Spinner />
|
2025-06-05 03:37:48 +00:00
|
|
|
</p>
|
|
|
|
|
{:then events}
|
|
|
|
|
{#each events as event (event.id)}
|
2026-08-29 16:19:01 +00:00
|
|
|
<NoteItem {url} {event} {context} />
|
2025-06-05 03:37:48 +00:00
|
|
|
{:else}
|
2025-11-13 21:25:34 +00:00
|
|
|
<div class="min-h-6">
|
|
|
|
|
{@render fallback?.()}
|
|
|
|
|
</div>
|
2025-06-05 03:37:48 +00:00
|
|
|
{/each}
|
|
|
|
|
{/await}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|