You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
1.2 KiB
JavaScript
30 lines
1.2 KiB
JavaScript
import { Spin } from 'antd';
|
|
import { ChatItem } from 'react-chat-elements';
|
|
|
|
const ConversationsList = ({ conversationsListLoading, handleChatItemClick, selectedConversation, conversationsList, ...props }) => {
|
|
|
|
return (
|
|
<>
|
|
<Spin spinning={conversationsListLoading}>
|
|
{conversationsList.map((item) => (
|
|
<ChatItem
|
|
{...item}
|
|
key={item.conversationid}
|
|
id={item.conversationid}
|
|
letterItem={{ id: item.whatsapp_name || item.whatsapp_phone_number, letter: (item.whatsapp_name || item.whatsapp_phone_number).split(' ')[0] }}
|
|
alt={`${item.whatsapp_name}`}
|
|
title={item.whatsapp_name || item.whatsapp_phone_number}
|
|
subtitle={`${item.OPI_Name || ''} ${item.coli_id || ''}`}
|
|
date={item.last_received_time || item.last_send_time}
|
|
// dateString={item.last_received_time}
|
|
dateString={item.dateText}
|
|
className={String(item.conversationid) === String(selectedConversation.conversationid) ? '__active text-primary bg-neutral-100' : ''}
|
|
onClick={() => handleChatItemClick(item)}
|
|
/>
|
|
))}
|
|
</Spin>
|
|
</>
|
|
);
|
|
};
|
|
export default ConversationsList;
|