From 017cb9138514e3ec953b96bf520b5d17a9b1d163 Mon Sep 17 00:00:00 2001 From: Till-JS <101404291+Till-JS@users.noreply.github.com> Date: Thu, 29 Jan 2026 16:56:10 +0100 Subject: [PATCH] feat(matrix-web): add emoji reactions support - Add MessageReaction type with count, users, and includesMe tracking - Implement getReactionsForEvent helper to collect m.annotation events - Add reactToMessage method using m.reaction event type - Display reactions below message bubbles with toggle support - Add emoji picker dropdown in message actions (6 quick emojis) - Clicking existing reaction toggles it on/off Co-Authored-By: Claude Opus 4.5 --- .../src/lib/components/chat/Message.svelte | 66 ++++++++++++++++++- .../apps/web/src/lib/matrix/store.svelte.ts | 61 ++++++++++++++++- apps/matrix/apps/web/src/lib/matrix/types.ts | 11 ++++ 3 files changed, 134 insertions(+), 4 deletions(-) diff --git a/apps/matrix/apps/web/src/lib/components/chat/Message.svelte b/apps/matrix/apps/web/src/lib/components/chat/Message.svelte index bc78bb1a2..eaf982b83 100644 --- a/apps/matrix/apps/web/src/lib/components/chat/Message.svelte +++ b/apps/matrix/apps/web/src/lib/components/chat/Message.svelte @@ -15,6 +15,7 @@ Image as ImageIcon, Lock, Warning, + Smiley, } from '@manacore/shared-icons'; interface Props { @@ -41,9 +42,18 @@ ); let showActions = $state(false); + let showEmojiPicker = $state(false); let imageLoading = $state(true); let imageError = $state(false); + // Quick reaction emojis + const quickEmojis = ['๐Ÿ‘', 'โค๏ธ', '๐Ÿ˜‚', '๐Ÿ˜ฎ', '๐Ÿ˜ข', '๐ŸŽ‰']; + + async function handleReaction(emoji: string) { + showEmojiPicker = false; + await matrixStore.reactToMessage(message.id, emoji); + } + // Audio player state let audioElement: HTMLAudioElement | null = $state(null); let isPlaying = $state(false); @@ -367,6 +377,25 @@ {/if} + + {#if message.reactions && message.reactions.length > 0} +
+ {#each message.reactions as reaction} + + {/each} +
+ {/if} +
+ +
+ + {#if showEmojiPicker} + + + +
+ {#each quickEmojis as emoji} + + {/each} +
+ {/if} +