import { Badge, List } from "antd"; import React from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; import { setSelectedConversation } from "../../redux/messaging/messaging.actions"; import { selectSelectedConversation } from "../../redux/messaging/messaging.selectors"; import PhoneFormatter from "../../utils/PhoneFormatter"; import "./chat-conversation-list.styles.scss"; const mapStateToProps = createStructuredSelector({ selectedConversation: selectSelectedConversation, }); const mapDispatchToProps = (dispatch) => ({ setSelectedConversation: (conversationId) => dispatch(setSelectedConversation(conversationId)), }); export function ChatConversationListComponent({ conversationList, selectedConversation, setSelectedConversation, }) { const { t } = useTranslation(); return ( ( setSelectedConversation(item.id)} className={`chat-list-item ${ item.id === selectedConversation ? "chat-list-selected-conversation" : null }`} > {item.phone_num}} description={ item.job_conversations.length > 0 ? (
{item.job_conversations.map( (j) => `${j.job.ownr_fn || ""} ${j.job.ownr_ln || ""} ${ j.job.ownr_co_nm || "" }` )}
) : ( t("messaging.labels.nojobs") ) } />
)} /> ); } export default connect( mapStateToProps, mapDispatchToProps )(ChatConversationListComponent);