import { AxiosError } from 'axios'; import clsx from 'clsx'; import React, { MutableRefObject, useEffect, useState } from 'react'; import { defineMessages, useIntl } from 'react-intl'; import { uploadMedia } from 'soapbox/actions/media'; import { Stack } from 'soapbox/components/ui'; import { useAppDispatch } from 'soapbox/hooks'; import { normalizeAttachment } from 'soapbox/normalizers'; import { IChat, useChatActions } from 'soapbox/queries/chats'; import ChatComposer from './chat-composer'; import ChatMessageList from './chat-message-list'; const fileKeyGen = (): number => Math.floor((Math.random() * 0x10000)); const messages = defineMessages({ failedToSend: { id: 'chat.failed_to_send', defaultMessage: 'Message failed to send.' }, }); interface ChatInterface { chat: IChat, inputRef?: MutableRefObject, className?: string, } /** * Clears the value of the input while dispatching the `onChange` function * which allows the