import React from 'react'; import { defineMessages, useIntl } from 'react-intl'; import { useHistory } from 'react-router-dom'; import { launchChat } from 'soapbox/actions/chats'; import AccountSearch from 'soapbox/components/account_search'; import { Card, CardTitle, Stack } from 'soapbox/components/ui'; import { useChatContext } from 'soapbox/contexts/chat-context'; import { useAppDispatch } from 'soapbox/hooks'; import Chat from './chat'; import ChatList from './chat-list'; import ChatListItem from './chat-list-item'; const messages = defineMessages({ title: { id: 'column.chats', defaultMessage: 'Messages' }, searchPlaceholder: { id: 'chats.search_placeholder', defaultMessage: 'Start a chat with…' }, }); const ChatPage = () => { const intl = useIntl(); const dispatch = useAppDispatch(); const history = useHistory(); const { chat, setChat } = useChatContext(); const handleSuggestion = (accountId: string) => { dispatch(launchChat(accountId, history, true)); }; const handleClickChat = (chat: any) => { // history.push(`/chats/${chat.id}`); setChat(chat); }; return (
{chat && ( { }} />
)}
); }; export default ChatPage;