flotilla/src/app/components/NoteCard.svelte

27 lines
783 B
Svelte
Raw Normal View History

2024-09-24 21:12:38 +00:00
<script lang="ts">
2024-10-08 18:39:16 +00:00
import {nip19} from "nostr-tools"
2024-10-01 23:27:25 +00:00
import {ctx} from "@welshman/lib"
2024-10-08 18:39:16 +00:00
import {formatTimestamp} from "@welshman/app"
2024-10-01 23:27:25 +00:00
import Link from "@lib/components/Link.svelte"
2024-09-24 21:12:38 +00:00
import Profile from "@app/components/Profile.svelte"
2024-10-08 18:39:16 +00:00
import {entityLink} from "@app/state"
2024-09-24 21:12:38 +00:00
export let event
2024-10-09 19:45:13 +00:00
export let hideProfile = false
2024-10-01 23:27:25 +00:00
const relays = ctx.app.router.Event(event).getUrls()
const nevent = nip19.neventEncode({id: event.id, relays})
2024-09-24 21:12:38 +00:00
</script>
<div class="flex flex-col gap-2 {$$props.class}">
<div class="flex justify-between gap-2">
2024-10-09 19:45:13 +00:00
{#if !hideProfile}
<Profile pubkey={event.pubkey} />
{/if}
2024-10-01 23:27:25 +00:00
<Link external href={entityLink(nevent)} class="text-sm opacity-75">
{formatTimestamp(event.created_at)}
</Link>
2024-09-24 21:12:38 +00:00
</div>
<slot />
</div>