import classNames from 'clsx'; import React from 'react'; import { openModal } from 'soapbox/actions/modals'; import { initReport } from 'soapbox/actions/reports'; import { Avatar, Button, HStack, Icon, Stack, Text } from 'soapbox/components/ui'; import { useChatContext } from 'soapbox/contexts/chat-context'; import { useAppDispatch } from 'soapbox/hooks'; import { useChat } from 'soapbox/queries/chats'; const ChatMessageListIntro = () => { const dispatch = useAppDispatch(); const { chat, needsAcceptance } = useChatContext(); const { acceptChat, deleteChat } = useChat(chat?.id as string); const handleLeaveChat = () => { dispatch(openModal('CONFIRM', { heading: 'Leave Chat', message: 'Are you sure you want to leave this chat? This conversation will be removed from your inbox.', confirm: 'Leave Chat', confirmationTheme: 'primary', onConfirm: () => { deleteChat.mutate(); }, })); }; const handleReportChat = () => { dispatch(initReport(chat?.account)); acceptChat.mutate(); }; if (!chat) { return null; } return ( {needsAcceptance ? ( <> @{chat.account.acct} {' '} wants to start a chat with you ) : ( @{chat.account.acct} )} {needsAcceptance ? ( ) : ( Messages older than 15 days are deleted. )} ); }; export default ChatMessageListIntro;