flotilla/src/app/components/ThreadItem.svelte

33 lines
1 KiB
Svelte
Raw Normal View History

2024-09-23 20:10:15 +00:00
<script lang="ts">
2024-09-23 20:58:01 +00:00
import {displayPubkey} from "@welshman/util"
2024-09-23 20:10:15 +00:00
import {deriveProfile, deriveProfileDisplay, formatTimestamp} from "@welshman/app"
2024-09-23 20:58:01 +00:00
import Avatar from "@lib/components/Avatar.svelte"
2024-09-23 20:10:15 +00:00
export let root
export let replies
const profile = deriveProfile(root.pubkey)
const profileDisplay = deriveProfileDisplay(root.pubkey)
</script>
<div>
<div class="card2 flex flex-col gap-2">
2024-09-23 20:58:01 +00:00
<div class="flex items-center justify-between gap-2">
2024-09-23 20:10:15 +00:00
<div class="flex gap-2">
<div class="py-1">
<Avatar src={$profile?.picture} size={10} />
</div>
<div class="flex flex-col">
<div class="text-bold">{$profileDisplay}</div>
<div class="text-sm opacity-75">{displayPubkey(root.pubkey)}</div>
</div>
</div>
<span class="text-sm opacity-75">{formatTimestamp(root.created_at)}</span>
</div>
<div class="ml-12"></div>
2024-09-23 20:10:15 +00:00
</div>
{#if replies.length > 0}
2024-09-23 20:58:01 +00:00
Show {replies.length} {replies.length === 1 ? "reply" : "replies"}
2024-09-23 20:10:15 +00:00
{/if}
</div>