IO-1551 Refactor messaging.
This commit is contained in:
@@ -1,14 +1,12 @@
|
||||
import { Badge, List, Tag, Tooltip } from "antd";
|
||||
import { AlertFilled } from "@ant-design/icons";
|
||||
import { Badge, List, Tag } from "antd";
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { setSelectedConversation } from "../../redux/messaging/messaging.actions";
|
||||
import { selectSelectedConversation } from "../../redux/messaging/messaging.selectors";
|
||||
import { TimeAgoFormatter } from "../../utils/DateFormatter";
|
||||
import PhoneFormatter from "../../utils/PhoneFormatter";
|
||||
import "./chat-conversation-list.styles.scss";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { TimeAgoFormatter } from "../../utils/DateFormatter";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
selectedConversation: selectSelectedConversation,
|
||||
@@ -24,8 +22,6 @@ export function ChatConversationListComponent({
|
||||
selectedConversation,
|
||||
setSelectedConversation,
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<div className="chat-list-container">
|
||||
<List
|
||||
@@ -33,6 +29,7 @@ export function ChatConversationListComponent({
|
||||
dataSource={conversationList}
|
||||
renderItem={(item) => (
|
||||
<List.Item
|
||||
key={item.id}
|
||||
onClick={() => setSelectedConversation(item.id)}
|
||||
className={`chat-list-item ${
|
||||
item.id === selectedConversation
|
||||
@@ -43,19 +40,9 @@ export function ChatConversationListComponent({
|
||||
{item.job_conversations.length > 0 ? (
|
||||
<div className="chat-name">
|
||||
{item.job_conversations.map((j, idx) => (
|
||||
<div key={idx} style={{ display: "flex" }}>
|
||||
{j.job.owner && !j.job.owner.allow_text_message && (
|
||||
<Tooltip title={t("messaging.labels.noallowtxt")}>
|
||||
<AlertFilled
|
||||
className="production-alert"
|
||||
style={{ marginRight: ".3rem", alignItems: "center" }}
|
||||
/>
|
||||
</Tooltip>
|
||||
)}
|
||||
<div>{`${j.job.ownr_fn || ""} ${j.job.ownr_ln || ""} ${
|
||||
j.job.ownr_co_nm || ""
|
||||
} `}</div>
|
||||
</div>
|
||||
<div key={idx}>{`${j.job.ownr_fn || ""} ${
|
||||
j.job.ownr_ln || ""
|
||||
} ${j.job.ownr_co_nm || ""} `}</div>
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
|
||||
Reference in New Issue
Block a user