flotilla/src/app/components/ProfileLatest.svelte

40 lines
944 B
Svelte
Raw Normal View History

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