Compare commits

...

1 Commits

Author SHA1 Message Date
2d9aec8657 feat(frontend): render <@id> as @name mention chips
Markdown renderer turns <@userId> into a Discord-style mention chip
(@displayName, resolved via guild members; short-id fallback). Tokens
inside backticks stay literal; untranslated <@user.name:..> left as-is.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-15 15:52:43 +01:00
3 changed files with 19 additions and 1 deletions

View File

@@ -626,6 +626,17 @@ button {
.md del {
color: var(--text-faint);
}
.mention {
color: #c4b5fd;
background: var(--accent-soft);
border-radius: 4px;
padding: 0 3px;
font-weight: 600;
white-space: nowrap;
}
.mention:hover {
background: rgba(168, 85, 247, 0.28);
}
.meta-badge {
font-family: var(--mono);
font-size: 10px;

Binary file not shown.

View File

@@ -336,6 +336,10 @@ export default function ChatPage() {
const nameById = new Map(members.map((m) => [m.userId, m.name || m.email]))
const authorLabel = (uid?: string) =>
uid ? (uid === session?.user.id ? session?.user.name || 'You' : nameById.get(uid) || uid.slice(0, 8)) : 'unknown'
const mentionName = (id: string) =>
id === session?.user.id
? session?.user.name || session?.user.email || 'you'
: nameById.get(id) || id.slice(0, 8)
const guildById = new Map(members.map((m) => [m.userId, m]))
const channelMembers = channelMemberIds.map(
@@ -471,7 +475,10 @@ export default function ChatPage() {
<span className={`meta-badge ${m.wakeup ? 'on' : ''}`}>wakeup={String(m.wakeup)}</span>
) : null}
</div>
<div className="text md" dangerouslySetInnerHTML={{ __html: renderMarkdown(m.content) }} />
<div
className="text md"
dangerouslySetInnerHTML={{ __html: renderMarkdown(m.content, { resolveMention: mentionName }) }}
/>
{devMode ? (
<pre className="meta-raw">
{JSON.stringify(