Chat
{#if messages.length === 0}
No messages yet.
{:else}
{#each messages as msg, i (msg.id)} {@const author = resolveAuthor(msg.pubkey)} {@const parent = msg.replyToId ? getChatMessage(msg.replyToId) : null} {@const parentAuthor = parent ? resolveAuthor(parent.pubkey) : null} {#if isNewDay(msg.createdAt, messages[i - 1]?.createdAt)}
{formatDay(msg.createdAt)}
{/if}
{#if author.picture} {:else} {author.name[0].toUpperCase()} {/if} {author.name}
{#if openMenuId === msg.id && menuPos}
{#if canDeleteMessage(msg)} {@const tooOld = !canModerate && !withinSelfDeleteWindow(msg.createdAt)} {/if}
{/if}
{formatTime(msg.createdAt)}
{#if msg.replyToId}
{#if parent} {parentAuthor?.name}: {truncate(parent.content)} {:else} Replying to a message {/if}
{/if}

{/each}
{/if}
{#if replyTarget} {@const replyAuthor = resolveAuthor(replyTarget.pubkey)}
↳ Reply to {replyAuthor.name}: {truncate(replyTarget.content, 80)}
{/if} {#if sendError}
{sendError}
{/if} {#if !auth.user} {:else if joinToChat} {:else}
{/if}