import React, { useState } from 'react'; import { defineMessages, useIntl } from 'react-intl'; import { useDispatch } from 'react-redux'; import { useHistory } from 'react-router-dom'; import { launchChat } from 'soapbox/actions/chats'; import AccountSearch from 'soapbox/components/account_search'; import { Card, CardTitle, Stack } from '../../components/ui'; import Chat from './components/chat'; import ChatBox from './components/chat-box'; import ChatList from './components/chat-list'; const messages = defineMessages({ title: { id: 'column.chats', defaultMessage: 'Messages' }, searchPlaceholder: { id: 'chats.search_placeholder', defaultMessage: 'Start a chat with…' }, }); const ChatIndex: React.FC = () => { const intl = useIntl(); const dispatch = useDispatch(); const history = useHistory(); const [chat, setChat] = useState(null); const handleSuggestion = (accountId: string) => { dispatch(launchChat(accountId, history, true)); }; const handleClickChat = (chat: any) => { // history.push(`/chats/${chat.id}`); setChat(chat); }; return (
{chat && ( { }} />
)}
); }; export default ChatIndex;