|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
import { memo, useCallback, useEffect, useRef, useState, forwardRef } from 'react';
|
|
|
|
|
import { Divider, Button, Input, Layout, DatePicker, Form, List, Spin, Flex, Image } from 'antd';
|
|
|
|
|
import { App, Divider, Button, Input, Layout, DatePicker, Form, List, Spin, Flex, Image } from 'antd';
|
|
|
|
|
import { LoadingOutlined } from '@ant-design/icons';
|
|
|
|
|
import { ChatItem, MessageBox } from 'react-chat-elements';
|
|
|
|
|
import { MESSAGE_PAGE_SIZE, fetchConversationsSearch, fetchMessagesHistory } from '@/actions/ConversationActions';
|
|
|
|
@ -67,6 +67,9 @@ const SearchForm = memo(function ({ initialValues, onSubmit }) {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
function ChatHistory() {
|
|
|
|
|
|
|
|
|
|
const { message: appMessage } = App.useApp()
|
|
|
|
|
|
|
|
|
|
// const [formValues, setFormValues] = useState({});
|
|
|
|
|
const [formValues, setFormValues] = useFormStore(((state) => [state.chatHistoryForm, state.setChatHistoryForm]));
|
|
|
|
|
const [selectedConversation, setSelectedConversation] = useFormStore(((state) => [state.chatHistorySelectChat, state.setChatHistorySelectChat]));
|
|
|
|
@ -227,7 +230,7 @@ function ChatHistory() {
|
|
|
|
|
return prev;
|
|
|
|
|
}, []);
|
|
|
|
|
return (
|
|
|
|
|
<span className={`text-sm leading-5 emoji-text ${className} ${extraClass} `}>
|
|
|
|
|
<span className={`text-sm leading-5 emoji-text ${className} ${extraClass} `} key={'msg-text'}>
|
|
|
|
|
{(objArr || []).map((part, index) => {
|
|
|
|
|
if (part.type === 'link') {
|
|
|
|
|
return (
|
|
|
|
@ -321,7 +324,7 @@ function ChatHistory() {
|
|
|
|
|
</Sider>
|
|
|
|
|
<Content style={{ maxHeight: 'calc(100vh - 279px)', height: 'calc(100vh - 279px)', minWidth: '360px' }}>
|
|
|
|
|
<Flex className='h-full relative'>
|
|
|
|
|
{(selectedConversation.matchMsgList || []).length > 1 && isNotEmpty(formValues.search) && (
|
|
|
|
|
{(selectedConversation.matchMsgList || []).length > 0 && isNotEmpty(formValues.search) && (
|
|
|
|
|
<div className='w-80 overflow-y-auto overflow-x-hidden'>
|
|
|
|
|
<p className='text-center'><mark>{formValues.search}</mark> 的相关记录, 点击定位上下文</p>
|
|
|
|
|
{selectedConversation.matchMsgList.map((item) => (
|
|
|
|
@ -334,7 +337,7 @@ function ChatHistory() {
|
|
|
|
|
letter: (item.sender === 'me' ? selectedConversation.OPI_Name || item.senderName : item.senderName).split(' ')[0],
|
|
|
|
|
}}
|
|
|
|
|
alt={`${item.senderName}`}
|
|
|
|
|
title={item.senderName}
|
|
|
|
|
title={item.sender === 'me' ? selectedConversation.OPI_Name || item.senderName : item.senderName}
|
|
|
|
|
subtitle={item.originText}
|
|
|
|
|
date={item.msgtime}
|
|
|
|
|
// dateString={item.msgtime}
|
|
|
|
@ -387,6 +390,7 @@ function ChatHistory() {
|
|
|
|
|
{
|
|
|
|
|
onClickButton: () => {
|
|
|
|
|
navigator.clipboard.writeText(message.text);
|
|
|
|
|
appMessage.success('复制成功😀');
|
|
|
|
|
},
|
|
|
|
|
Component: () => <div>复制</div>,
|
|
|
|
|
},
|
|
|
|
@ -394,7 +398,7 @@ function ChatHistory() {
|
|
|
|
|
}
|
|
|
|
|
: {})}
|
|
|
|
|
renderAddCmp={
|
|
|
|
|
<div className='border-dashed border-0 border-t border-slate-300 text-slate-600 space-x-2 emoji'>
|
|
|
|
|
<div key={'msg-prefix'} className='border-dashed border-0 border-t border-slate-300 text-slate-600 space-x-2 emoji'>
|
|
|
|
|
<span
|
|
|
|
|
className={`p-1 rounded-b ${message.msg_direction === 'outbound' ? 'text-white' : ''} `}
|
|
|
|
|
style={{ backgroundColor: message.msg_direction === 'outbound' ? stringToColour(message.senderName) : 'unset' }}>
|
|
|
|
|