import React from 'react'; import { blockAccount } from 'soapbox/actions/accounts'; import { openModal } from 'soapbox/actions/modals'; import { initReport } from 'soapbox/actions/reports'; import List, { ListItem } from 'soapbox/components/list'; import { Avatar, Divider, HStack, Icon, Stack, Text, Toggle } from 'soapbox/components/ui'; import { useChatContext } from 'soapbox/contexts/chat-context'; import { useAppDispatch } from 'soapbox/hooks'; import { useChat } from 'soapbox/queries/chats'; import ChatPaneHeader from './chat-pane-header'; const ChatSettings = () => { const dispatch = useAppDispatch(); const { chat, setEditing, toggleChatPane } = useChatContext(); const { deleteChat } = useChat(chat?.id as string); const closeSettings = () => setEditing(false); const minimizeChatPane = () => { closeSettings(); toggleChatPane(); }; const handleBlockUser = () => { dispatch(openModal('CONFIRM', { heading: `Block @${chat?.account.acct}`, message: 'Blocking will prevent this profile from direct messaging you and viewing your content. You can unblock later.', confirm: 'Block', confirmationTheme: 'primary', onConfirm: () => dispatch(blockAccount(chat?.account.id)), })); }; 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)); }; if (!chat) { return null; } return ( <> Chat Details } /> {chat.account.display_name} @{chat.account.acct} ); }; export default ChatSettings;