|
|
|
@ -1,10 +1,10 @@
|
|
|
|
|
import React, { useState } from 'react';
|
|
|
|
|
import { Input, Flex } from 'antd';
|
|
|
|
|
import { Input, Flex, Button } from 'antd';
|
|
|
|
|
// import { Input } from 'react-chat-elements';
|
|
|
|
|
import { useConversationState, useConversationDispatch } from '@/stores/ConversationContext';
|
|
|
|
|
import { useAuthContext } from '@/stores/AuthContext';
|
|
|
|
|
import { sentNewMessage } from '@/actions/ConversationActions';
|
|
|
|
|
import { SendOutlined } from '@ant-design/icons';
|
|
|
|
|
import { SendOutlined, MessageOutlined, SmileOutlined } from '@ant-design/icons';
|
|
|
|
|
import { isEmpty } from '@/utils/utils';
|
|
|
|
|
import { v4 as uuid } from 'uuid';
|
|
|
|
|
import { sentMsgTypeMapped } from '@/lib/msgUtils';
|
|
|
|
@ -13,7 +13,7 @@ import InputTemplate from './InputTemplate';
|
|
|
|
|
const InputBox = () => {
|
|
|
|
|
const { loginUser } = useAuthContext();
|
|
|
|
|
const { userId } = loginUser;
|
|
|
|
|
const { websocket, currentConversation, } = useConversationState();
|
|
|
|
|
const { websocket, currentConversation } = useConversationState();
|
|
|
|
|
const dispatch = useConversationDispatch();
|
|
|
|
|
const [textContent, setTextContent] = useState('');
|
|
|
|
|
|
|
|
|
@ -47,20 +47,30 @@ const InputBox = () => {
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div>
|
|
|
|
|
<Flex gap={8}>
|
|
|
|
|
<InputTemplate disabled={!talkabled} invokeSendMessage={invokeSendMessage} />
|
|
|
|
|
<Input.Search
|
|
|
|
|
disabled={!talkabled}
|
|
|
|
|
placeholder='Type message here'
|
|
|
|
|
// enterButton={'Send'}
|
|
|
|
|
enterButton={<SendOutlined />}
|
|
|
|
|
size='large'
|
|
|
|
|
onSearch={handleSendText}
|
|
|
|
|
value={textContent}
|
|
|
|
|
onChange={(e) => setTextContent(e.target.value)}
|
|
|
|
|
/>
|
|
|
|
|
<Input.TextArea
|
|
|
|
|
size='large'
|
|
|
|
|
placeholder='Enter for Send, Shift+Enter for new line'
|
|
|
|
|
rows={2}
|
|
|
|
|
disabled={!talkabled}
|
|
|
|
|
value={textContent}
|
|
|
|
|
onChange={(e) => setTextContent(e.target.value)}
|
|
|
|
|
className='rounded-b-none'
|
|
|
|
|
onPressEnter={(e) => {
|
|
|
|
|
if (!e.shiftKey) {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
handleSendText();
|
|
|
|
|
}
|
|
|
|
|
}}
|
|
|
|
|
autoSize={{minRows: 2, maxRows: 6}}
|
|
|
|
|
/>
|
|
|
|
|
<Flex justify={'space-between'} className=' bg-gray-200 p-1'>
|
|
|
|
|
<Flex gap={4} className='divide-y-0 divide-x divide-solid divide-gray-500 '>
|
|
|
|
|
<InputTemplate key='templates' disabled={!talkabled} invokeSendMessage={invokeSendMessage} />
|
|
|
|
|
</Flex>
|
|
|
|
|
<Button key={'send-btn'} type='primary' size='middle' icon={<SendOutlined />} disabled={!talkabled}>
|
|
|
|
|
Send
|
|
|
|
|
</Button>
|
|
|
|
|
</Flex>
|
|
|
|
|
<div></div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|