@ -1,70 +1,70 @@
import { useNavigate } from 'react-router-dom'
import { useNavigate } from 'react-router-dom' ;
import { memo , useCallback , useEffect , useRef , useState } from 'react' ;
import { memo , useCallback , useEffect , useRef , useState } from 'react' ;
import { Row , Col , Divider , Table , Card , Button , Input ,
import { Row , Col , Divider , Table , Card , Button , Input , Flex , Layout , Space , Empty , Radio , Select , DatePicker , Form , List , Avatar } from 'antd' ;
Space , Empty , Radio , Select , DatePicker , Form , List , Avatar
import { StarFilled , ZoomInOutlined , StarOutlined , SearchOutlined } from '@ant-design/icons' ;
} from 'antd'
import { ChatList , ChatItem , MessageBox } from 'react-chat-elements' ;
import {
StarFilled , ZoomInOutlined , StarOutlined , SearchOutlined
} from '@ant-design/icons'
const { Search } = Input
const { Sider , Content , Header , Footer } = Layout ;
const { RangePicker } = DatePicker
const { Search } = Input ;
const { RangePicker } = DatePicker ;
const data = [
const data = [
{
{
title : 'Ann' ,
title : 'Ann' ,
avatarUrl : 'https://api.dicebear.com/7.x/miniavs/svg?seed=0' ,
avatarUrl : 'https://api.dicebear.com/7.x/miniavs/svg?seed=0' ,
msgTime : '03-04 13:45:29' ,
msgTime : '03-04 13:45:29' ,
content : 'Hi, this is Ann from China Highlights travel and it is my pleasure to help your Beijing trip. I have sent you an email with the general idea about you trip. Please check it and if any question or new idea just let me know. We are specailized in customizing tour and I would like to work with you to create a tour itinerary that you like. Look forward to your reply.'
content :
'Hi, this is Ann from China Highlights travel and it is my pleasure to help your Beijing trip. I have sent you an email with the general idea about you trip. Please check it and if any question or new idea just let me know. We are specailized in customizing tour and I would like to work with you to create a tour itinerary that you like. Look forward to your reply.' ,
} ,
} ,
{
{
title : 'David Azhari' ,
title : 'David Azhari' ,
avatarUrl : 'https://api.dicebear.com/7.x/miniavs/svg?seed=2' ,
avatarUrl : 'https://api.dicebear.com/7.x/miniavs/svg?seed=2' ,
msgTime : '03-04 16:33:08' ,
msgTime : '03-04 16:33:08' ,
content : 'Hi! I just replied to your email saying that I have a few questions and notes'
content : 'Hi! I just replied to your email saying that I have a few questions and notes' ,
} ,
} ,
{
{
title : 'David Azhari' ,
title : 'David Azhari' ,
avatarUrl : 'https://api.dicebear.com/7.x/miniavs/svg?seed=2' ,
avatarUrl : 'https://api.dicebear.com/7.x/miniavs/svg?seed=2' ,
msgTime : '03-04 16:33:34' ,
msgTime : '03-04 16:33:34' ,
content : 'So first, is it possible for you guys to write a PU Invitation letter for visas or no?'
content : 'So first, is it possible for you guys to write a PU Invitation letter for visas or no?' ,
} ,
} ,
{
{
title : 'Ann' ,
title : 'Ann' ,
avatarUrl : 'https://api.dicebear.com/7.x/miniavs/svg?seed=0' ,
avatarUrl : 'https://api.dicebear.com/7.x/miniavs/svg?seed=0' ,
msgTime : '03-04 16:33:41' ,
msgTime : '03-04 16:33:41' ,
content : 'you prefer we discuss here or go on by mail ?'
content : 'you prefer we discuss here or go on by mail ?' ,
} ,
} ,
{
{
title : 'David Azhari' ,
title : 'David Azhari' ,
avatarUrl : 'https://api.dicebear.com/7.x/miniavs/svg?seed=2' ,
avatarUrl : 'https://api.dicebear.com/7.x/miniavs/svg?seed=2' ,
msgTime : '03-04 16:34:03' ,
msgTime : '03-04 16:34:03' ,
content : 'I prefer by mail if it’ s ok with you'
content : 'I prefer by mail if it’ s ok with you' ,
} ,
} ,
{
{
title : 'Ann' ,
title : 'Ann' ,
avatarUrl : 'https://api.dicebear.com/7.x/miniavs/svg?seed=0' ,
avatarUrl : 'https://api.dicebear.com/7.x/miniavs/svg?seed=0' ,
msgTime : '03-04 16:34:28' ,
msgTime : '03-04 16:34:28' ,
content : 'both is okay ,I am typing mail to you now lol and receive your message here.'
content : 'both is okay ,I am typing mail to you now lol and receive your message here.' ,
} ,
} ,
{
{
title : 'David Azhari' ,
title : 'David Azhari' ,
avatarUrl : 'https://api.dicebear.com/7.x/miniavs/svg?seed=2' ,
avatarUrl : 'https://api.dicebear.com/7.x/miniavs/svg?seed=2' ,
msgTime : '03-05 02:56:37' ,
msgTime : '03-05 02:56:37' ,
content : 'Ok thank you so much'
content : 'Ok thank you so much' ,
} ,
} ,
{
{
title : 'Ann' ,
title : 'Ann' ,
avatarUrl : 'https://api.dicebear.com/7.x/miniavs/svg?seed=0' ,
avatarUrl : 'https://api.dicebear.com/7.x/miniavs/svg?seed=0' ,
msgTime : '03-04 16:44:03' ,
msgTime : '03-04 16:44:03' ,
content : 'you are welcome I have sent the mail to you ,please check.it is my pleasure to assist you with your tour.'
content : 'you are welcome I have sent the mail to you ,please check.it is my pleasure to assist you with your tour.' ,
} ,
} ,
]
] ;
/ / e s l i n t - d i s a b l e - n e x t - l i n e r e a c t / d i s p l a y - n a m e
const SearchForm = memo ( function ( { onSubmit } ) {
const SearchForm = memo ( function ( { onSubmit } ) {
const [ form ] = Form . useForm ( )
const [ form ] = Form . useForm ( ) ;
function handleSubmit ( values ) {
function handleSubmit ( values ) {
onSubmit ? . ( values )
onSubmit ? . ( values ) ;
}
}
return (
return (
< Form
< Form
@ -74,15 +74,13 @@ const SearchForm = memo(function ({ onSubmit }) {
onFinish = { handleSubmit }
onFinish = { handleSubmit }
style = { {
style = { {
maxWidth : 'none' ,
maxWidth : 'none' ,
} }
} } >
>
< Form.Item label = '顾问' name = 'travel' style = { { width : '200px' } } >
< Form.Item label = '顾问' name = 'travel' style = { { width : '200px' } } >
< Select
< Select
showSearch
showSearch
placeholder = '请选择'
placeholder = '请选择'
optionFilterProp = 'children'
optionFilterProp = 'children'
filterOption = { ( input , option ) =>
filterOption = { ( input , option ) => ( option ? . label ? ? '' ) . toLowerCase ( ) . includes ( input . toLowerCase ( ) ) }
( option ? . label ? ? '' ) . toLowerCase ( ) . includes ( input . toLowerCase ( ) ) }
options = { [
options = { [
{
{
value : '杨新玲' ,
value : '杨新玲' ,
@ -120,8 +118,7 @@ const SearchForm = memo(function ({ onSubmit }) {
showSearch
showSearch
placeholder = '请选择'
placeholder = '请选择'
optionFilterProp = 'children'
optionFilterProp = 'children'
filterOption = { ( input , option ) =>
filterOption = { ( input , option ) => ( option ? . label ? ? '' ) . toLowerCase ( ) . includes ( input . toLowerCase ( ) ) }
( option ? . label ? ? '' ) . toLowerCase ( ) . includes ( input . toLowerCase ( ) ) }
options = { [
options = { [
{
{
value : 'Denise' ,
value : 'Denise' ,
@ -173,44 +170,61 @@ const SearchForm = memo(function ({ onSubmit }) {
< RangePicker / >
< RangePicker / >
< / Form.Item >
< / Form.Item >
< Form.Item >
< Form.Item >
< Button type = 'primary' htmlType = 'submit' > 搜索 < / Button >
< Button type = 'primary' htmlType = 'submit' >
搜索
< / Button >
< / Form.Item >
< / Form.Item >
< / Form >
< / Form >
)
) ;
} )
} ) ;
function ChatHistory ( ) {
function ChatHistory ( ) {
const [ formValues , setFormValues ] = useState ( { } ) ;
const [ formValues , setFormValues ] = useState ( { } )
const handleSubmit = useCallback ( ( values ) => {
const handleSubmit = useCallback ( ( values ) => {
setFormValues ( { ... values } )
setFormValues ( { ... values } ) ;
} , [ ] )
} , [ ] ) ;
return (
return (
< >
< >
< SearchForm onSubmit = { handleSubmit } / >
< SearchForm onSubmit = { handleSubmit } / >
< Divider plain orientation = 'left' > < / Divider >
< Divider plain orientation = 'left' > < / Divider >
< div style = { { maxWidth : '800px' } } >
< Layout hasSider className = 'h-screen chathistory-wrapper' style = { { maxHeight : 'calc(100% - 279px)' , height : 'calc(100% - 279px)' } } >
< Sider width = { 240 } theme = { 'light' } className = 'h-full overflow-y-auto' style = { { maxHeight : 'calc(100vh - 279px)' , height : 'calc(100vh - 279px)' } } >
< ChatList
className = { '__active text-primary ' }
dataSource = { [
{
alt : 'Jane' ,
title : 'Jane' ,
date : new Date ( ) ,
letterItem : { id : 'x1' , letter : 'Jane' } ,
} ,
] }
/ >
< / Sider >
< Content style = { { maxHeight : 'calc(100vh - 279px)' , height : 'calc(100vh - 279px)' , minWidth : '360px' } } >
< div className = 'h-full relative' >
< List
< List
loading = { false }
loadMore = { ( ) => {
console . log ( 'load more' ) ;
} }
className = 'h-full overflow-y-auto px-2'
itemLayout = 'vertical'
itemLayout = 'vertical'
dataSource = { data }
dataSource = { data }
renderItem = { ( item , index ) => (
renderItem = { ( item , index ) => (
< List.Item
< List.Item >
>
< List.Item.Meta avatar = { < Avatar src = { item . avatarUrl } / > } title = { item . title } description = { item . msgTime } / >
< List.Item.Meta
avatar = { < Avatar src = { item . avatarUrl } / > }
title = { < a href = 'https://ant.design' > { item . title } < / a > }
description = { item . msgTime }
/ >
< div > { item . content } < / div >
< div > { item . content } < / div >
< / List.Item >
< / List.Item >
) }
) }
/ >
/ >
< / div >
< / div >
< / Content >
< / Layout >
< / >
< / >
)
) ;
}
}
export default ChatHistory
export default ChatHistory ;