diff --git a/src/analytics/features/types.ts b/src/analytics/features/types.ts index 44eebf561e..5c1857990e 100644 --- a/src/analytics/features/types.ts +++ b/src/analytics/features/types.ts @@ -11,6 +11,7 @@ export enum Features { LiveNowBetaDisable = 'live_now_beta:disable', ImageUploadsHighResolution = 'image_uploads:high_resolution', GroupChatsEnable = 'group_chats:enable', + DmsNewMessageComposerEnable = 'dms:new_message_composer:enable', AATest = 'aa-test', } diff --git a/src/screens/Messages/components/MessagesList.tsx b/src/screens/Messages/components/MessagesList.tsx index f318c2130c..27f1c93387 100644 --- a/src/screens/Messages/components/MessagesList.tsx +++ b/src/screens/Messages/components/MessagesList.tsx @@ -37,15 +37,21 @@ import { import {useGetPost} from '#/state/queries/post' import {useAgent} from '#/state/session' import {useShellLayout} from '#/state/shell/shell-layout' +import { + EmojiPicker, + type EmojiPickerState, +} from '#/view/com/composer/text-input/web/EmojiPicker' import {List, type ListMethods} from '#/view/com/util/List' import {ChatDisabled} from '#/screens/Messages/components/ChatDisabled' import {MessageComposer} from '#/screens/Messages/components/MessageComposer' +import {MessageInput} from '#/screens/Messages/components/MessageInput' import {MessageListError} from '#/screens/Messages/components/MessageListError' import {ChatEmptyPill} from '#/components/dms/ChatEmptyPill' import {MessageItem} from '#/components/dms/MessageItem' import {NewMessagesPill} from '#/components/dms/NewMessagesPill' import {Loader} from '#/components/Loader' import {Text} from '#/components/Typography' +import {useAnalytics} from '#/analytics' import {IS_NATIVE, IS_WEB} from '#/env' import {ChatStatusInfo} from './ChatStatusInfo' import {MessageInputEmbed, useMessageEmbed} from './MessageInputEmbed' @@ -97,6 +103,7 @@ export function MessagesList({ footer?: React.ReactNode hasAcceptOverride?: boolean }) { + const ax = useAnalytics() const convoState = useConvoActive() const agent = useAgent() const getPost = useGetPost() @@ -111,6 +118,11 @@ export function MessagesList({ startContentOffset: 0, }) + const [emojiPickerState, setEmojiPickerState] = useState({ + isOpen: false, + pos: {top: 0, left: 0, right: 0, bottom: 0, nextFocusRef: null}, + }) + // We need to keep track of when the scroll offset is at the bottom of the list to know when to scroll as new items // are added to the list. For example, if the user is scrolled up to 1iew older messages, we don't want to scroll to // the bottom. @@ -402,6 +414,10 @@ export function MessagesList({ }) }, [flatListRef]) + const onOpenEmojiPicker = useCallback((pos: any) => { + setEmojiPickerState({isOpen: true, pos}) + }, []) + return ( <> {/* Custom scroll provider so that we can use the `onScroll` event in our custom List implementation */} @@ -443,16 +459,34 @@ export function MessagesList({ - - - + {ax.features.enabled(ax.features.DmsNewMessageComposerEnable) ? ( + + + + ) : ( + + + + )} )} + {IS_WEB && ( + setEmojiPickerState(prev => ({...prev, isOpen: false}))} + /> + )} + {newMessagesPill.show && } )