Chat
{#if messages.length === 0}
No messages yet.
{:else}
{#each messages as msg (msg.id)} {@const author = resolveAuthor(msg.pubkey)} {@const parent = msg.replyToId ? getChatMessage(msg.replyToId) : null} {@const parentAuthor = parent ? resolveAuthor(parent.pubkey) : null}
{#if author.picture} {:else} {author.name[0].toUpperCase()} {/if} {author.name} {formatTime(msg.createdAt)}
{#if msg.replyToId}
{#if parent} {parentAuthor?.name}: {truncate(parent.content)} {:else} Replying to a message {/if}
{/if}

{#if openMenuId === msg.id}
{/if}
{/each}
{/if}
{#if replyTarget} {@const replyAuthor = resolveAuthor(replyTarget.pubkey)}
↳ Reply to {replyAuthor.name}: {truncate(replyTarget.content, 80)}
{/if} {#if sendError}
{sendError}
{/if}