diff --git a/frontend/src/lib/components/Chat.svelte b/frontend/src/lib/components/Chat.svelte index 5e82a7c..53996da 100644 --- a/frontend/src/lib/components/Chat.svelte +++ b/frontend/src/lib/components/Chat.svelte @@ -14,6 +14,14 @@ const isOwn = (msg: any) => msg.authorId === chatStore.actorId; + // Colour comes from the sender's user record (loaded with the family on + // page load) — no per-message snapshot, no live colour tracking. Falls back + // to the stored authorColor for any message sent before this change. + function colorOf(msg: any): string { + if (msg.authorId === chatStore.actorId) return chatStore.actorColor || '#6366f1'; + return msg.authorColor || '#6366f1'; + } + function scrollToBottom(instant = false) { if (!container) return; container.scrollTo({ @@ -107,15 +115,18 @@ {#each chatStore.messages as msg (msg.id)}
{#if !isOwn(msg)} - + {msg.authorName?.charAt(0).toUpperCase()} {/if}
{#if !isOwn(msg)} - {msg.authorName} + {msg.authorName} {/if} -
+
{#each renderContent(msg.content) as seg (msg.id + ':' + seg.text)} {#if seg.mention}