feat(mentions): richer inbox — filters, date groups, type badge, relative time, per-row actions, highlighted preview

This commit is contained in:
simoleo89
2026-06-02 14:34:13 +02:00
committed by simoleo89
parent 22e28a31ab
commit 49d3bde50a
14 changed files with 399 additions and 73 deletions
@@ -56,6 +56,21 @@ const isMentionToken = (token: string, ownUsernameLower: string, aliases: Readon
return aliases.has(nick);
};
/**
* Public predicate: does this raw whitespace-delimited token mention the given
* user or a room-broadcast alias? Mirrors the server's detection. Reusable by
* UI that renders mention previews as React nodes (e.g. the mentions box).
*/
export const tokenIsMention = (
token: string,
ownUsername: string,
aliases: ReadonlyArray<string> = MENTION_ROOM_ALIASES
): boolean =>
{
const ownUsernameLower = (ownUsername || '').replace(NON_NICK_CHARS, '').toLowerCase();
return isMentionToken(token, ownUsernameLower, new Set(aliases.map(a => a.toLowerCase())));
};
const HIGHLIGHT_OPEN = '<span class="mention-highlight">';
const HIGHLIGHT_CLOSE = '</span>';