// Copyright 2022 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only import React, { useCallback, useEffect, useRef, useState } from 'react'; import classNames from 'classnames'; import { usePopper } from 'react-popper'; import type { AttachmentType } from '../types/Attachment'; import type { BodyRangeType, LocalizerType } from '../types/Util'; import type { EmojiPickDataType } from './emoji/EmojiPicker'; import type { InputApi } from './CompositionInput'; import type { PreferredBadgeSelectorType } from '../state/selectors/badges'; import type { RenderEmojiPickerProps } from './conversation/ReactionPicker'; import type { ReplyType, StorySendStateType } from '../types/Stories'; import { Avatar, AvatarSize } from './Avatar'; import { CompositionInput } from './CompositionInput'; import { ContactName } from './conversation/ContactName'; import { EmojiButton } from './emoji/EmojiButton'; import { Emojify } from './conversation/Emojify'; import { Message, TextDirection } from './conversation/Message'; import { MessageTimestamp } from './conversation/MessageTimestamp'; import { Modal } from './Modal'; import { Quote } from './conversation/Quote'; import { ReactionPicker } from './conversation/ReactionPicker'; import { Tabs } from './Tabs'; import { Theme } from '../util/theme'; import { ThemeType } from '../types/Util'; import { WidthBreakpoint } from './_util'; import { getAvatarColor } from '../types/Colors'; import { getStoryReplyText } from '../util/getStoryReplyText'; import { shouldNeverBeCalled } from '../util/shouldNeverBeCalled'; // Menu is disabled so these actions are inaccessible. We also don't support // link previews, tap to view messages, attachments, or gifts. Just regular // text messages and reactions. const MESSAGE_DEFAULT_PROPS = { canDeleteForEveryone: false, canDownload: false, canReact: false, canReply: false, canRetry: false, canRetryDeleteForEveryone: false, checkForAccount: shouldNeverBeCalled, clearSelectedMessage: shouldNeverBeCalled, containerWidthBreakpoint: WidthBreakpoint.Medium, deleteMessage: shouldNeverBeCalled, deleteMessageForEveryone: shouldNeverBeCalled, displayTapToViewMessage: shouldNeverBeCalled, doubleCheckMissingQuoteReference: shouldNeverBeCalled, downloadAttachment: shouldNeverBeCalled, isBlocked: false, isMessageRequestAccepted: true, kickOffAttachmentDownload: shouldNeverBeCalled, markAttachmentAsCorrupted: shouldNeverBeCalled, markViewed: shouldNeverBeCalled, messageExpanded: shouldNeverBeCalled, openConversation: shouldNeverBeCalled, openGiftBadge: shouldNeverBeCalled, openLink: shouldNeverBeCalled, previews: [], reactToMessage: shouldNeverBeCalled, renderAudioAttachment: () =>
, renderEmojiPicker: () => , renderReactionPicker: () => , replyToMessage: shouldNeverBeCalled, retryDeleteForEveryone: shouldNeverBeCalled, retrySend: shouldNeverBeCalled, scrollToQuotedMessage: shouldNeverBeCalled, showContactDetail: shouldNeverBeCalled, showContactModal: shouldNeverBeCalled, showExpiredIncomingTapToViewToast: shouldNeverBeCalled, showExpiredOutgoingTapToViewToast: shouldNeverBeCalled, showForwardMessageModal: shouldNeverBeCalled, showMessageDetail: shouldNeverBeCalled, showVisualAttachment: shouldNeverBeCalled, startConversation: shouldNeverBeCalled, theme: ThemeType.dark, viewStory: shouldNeverBeCalled, }; enum Tab { Replies = 'Replies', Views = 'Views', } export type PropsType = { authorTitle: string; canReply: boolean; getPreferredBadge: PreferredBadgeSelectorType; i18n: LocalizerType; isGroupStory?: boolean; isMyStory?: boolean; onClose: () => unknown; onReact: (emoji: string) => unknown; onReply: ( message: string, mentions: Array)}