From 7abbf7e39a01d58f6ce8e5fceeaf13b66f3664ab Mon Sep 17 00:00:00 2001 From: MartinBraquet Date: Thu, 30 Jul 2026 02:23:46 +0200 Subject: [PATCH] Implement visual viewport height handling and toggleable emoji/reaction support. --- web/components/chat/chat-message.tsx | 5 ++ web/components/chat/message-reactions.tsx | 3 +- web/components/editor/emoji/emoji-enabled.ts | 5 ++ web/components/editor/sticky-format-menu.tsx | 17 ++-- web/components/widgets/editor.tsx | 7 +- web/hooks/use-visual-viewport-height.ts | 61 ++++++++++++++ web/pages/messages/[channelId].tsx | 87 ++++++++++++-------- web/styles/globals.css | 1 + 8 files changed, 140 insertions(+), 46 deletions(-) create mode 100644 web/components/editor/emoji/emoji-enabled.ts create mode 100644 web/hooks/use-visual-viewport-height.ts diff --git a/web/components/chat/chat-message.tsx b/web/components/chat/chat-message.tsx index bcdb74e5..32e411f0 100644 --- a/web/components/chat/chat-message.tsx +++ b/web/components/chat/chat-message.tsx @@ -15,6 +15,10 @@ import {Avatar} from 'web/components/widgets/avatar' import {Content} from 'web/components/widgets/editor' import {UserAvatarAndBadge} from 'web/components/widgets/user-link' +// Long-press on a message to open the emoji picker — off for now. Reactions can still be added from the +// message's "..." menu, and existing ones still show and toggle. +const LONG_PRESS_REACTIONS_ENABLED = false + export function ChatMessageItem(props: { chats: ChatMessage[] currentUser: DisplayUser | undefined | null @@ -58,6 +62,7 @@ export function ChatMessageItem(props: { : {username: '', avatarUrl: undefined, id: ''} const startLongPress = (messageId: number) => { + if (!LONG_PRESS_REACTIONS_ENABLED) return hasMovedRef.current = false lastPositionRef.current = null if (longPressTimerRef.current) clearTimeout(longPressTimerRef.current) diff --git a/web/components/chat/message-reactions.tsx b/web/components/chat/message-reactions.tsx index 0722bc37..4d90694f 100644 --- a/web/components/chat/message-reactions.tsx +++ b/web/components/chat/message-reactions.tsx @@ -38,7 +38,8 @@ export function MessageReactions({message, className, setMessages}: MessageReact if (reactionGroups.length === 0) return null return ( -
+ // negative top margin: tuck the chips up against the bubble they belong to +
{reactionGroups.map(({emoji, users}) => { const hasReacted = users.includes(user?.id || '') return ( diff --git a/web/components/editor/emoji/emoji-enabled.ts b/web/components/editor/emoji/emoji-enabled.ts new file mode 100644 index 00000000..92352b05 --- /dev/null +++ b/web/components/editor/emoji/emoji-enabled.ts @@ -0,0 +1,5 @@ +/** + * Emoji support in the text editor — the `:shortcode` suggestion popup while typing and the smiley + * button in the format toolbar — is off for now. Flip to `true` to bring both back. + */ +export const EMOJI_ENABLED = false diff --git a/web/components/editor/sticky-format-menu.tsx b/web/components/editor/sticky-format-menu.tsx index 63faa9c6..547b1e32 100644 --- a/web/components/editor/sticky-format-menu.tsx +++ b/web/components/editor/sticky-format-menu.tsx @@ -9,6 +9,7 @@ import {FileUploadButton} from '../buttons/file-upload-button' import {LoadingIndicator} from '../widgets/loading-indicator' import {Tooltip} from '../widgets/tooltip' import {EmbedModal} from './embed-modal' +import {EMOJI_ENABLED} from './emoji/emoji-enabled' import type {UploadMutation} from './upload-extension' /* Toolbar, with buttons for images and embeds */ @@ -39,13 +40,15 @@ export function StickyFormatMenu(props: {