|
|
|
@ -11,6 +11,8 @@ import useAuthStore from '@/stores/AuthStore';
|
|
|
|
|
import ChannelLogo from './ChannelLogo';
|
|
|
|
|
import { ReadIcon } from '@/components/Icons';
|
|
|
|
|
import useStyleStore from '@/stores/StyleStore';
|
|
|
|
|
import { OrderLabelDefaultOptionsMapped, OrderStatusDefaultOptionsMapped } from '@/stores/OrderStore';
|
|
|
|
|
import { whatsappMsgTypeMapped } from '@/channel/bubbleMsgUtils';
|
|
|
|
|
|
|
|
|
|
const TagColorStyle = (tag) => {
|
|
|
|
|
const color = stringToColour(tag);
|
|
|
|
@ -24,9 +26,8 @@ const TagColorStyle_2 = (tag, outerStyle = false) => {
|
|
|
|
|
|
|
|
|
|
const OrderSignEmoji = ({ item }) => (
|
|
|
|
|
<>
|
|
|
|
|
{item.order_label_id === 240003 ? '❣️' : ''}
|
|
|
|
|
{item.order_label_id === 240002 ? '❗' : ''}
|
|
|
|
|
{item.order_state_id === 5 ? '💰' : ''}
|
|
|
|
|
{OrderLabelDefaultOptionsMapped[String(item.order_label_id)]?.emoji}
|
|
|
|
|
{OrderStatusDefaultOptionsMapped[String(item.order_state_id)]?.emoji}
|
|
|
|
|
{item.intour === 1 ? '👣' : ''}
|
|
|
|
|
</>
|
|
|
|
|
)
|
|
|
|
@ -169,6 +170,14 @@ const ChatListItem = (({item, refreshConversationList,setListUpdateFlag,onSwitch
|
|
|
|
|
return () => {};
|
|
|
|
|
}, [contextMenuOpen])
|
|
|
|
|
|
|
|
|
|
const RenderLastMsg = (msg) => {
|
|
|
|
|
// const _text = isEmpty(msg) ? '' : msg.type === 'text' ? msg.text.body : `[${(msg?.type || '').toUpperCase()}]`;
|
|
|
|
|
const _text = isEmpty(msg) ? '' : (whatsappMsgTypeMapped?.[msg.type]?.renderForReply(msg) || {})?.message
|
|
|
|
|
return (
|
|
|
|
|
<>{_text}</>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<Dropdown
|
|
|
|
@ -272,16 +281,16 @@ const ChatListItem = (({item, refreshConversationList,setListUpdateFlag,onSwitch
|
|
|
|
|
alt={item.whatsapp_name}
|
|
|
|
|
title={(item.top_state === 1 ? '🔝' : '')
|
|
|
|
|
+ (item.conversation_memo || item.whatsapp_name || item.whatsapp_phone_number)}
|
|
|
|
|
// item.conversation_memo ||
|
|
|
|
|
// subtitle={item.coli_id}
|
|
|
|
|
subtitle={
|
|
|
|
|
<div>
|
|
|
|
|
{/* <ReadIcon /> */}
|
|
|
|
|
{/* <DeliverIcon /> */}
|
|
|
|
|
{/* <SentIcon /> */}
|
|
|
|
|
{/* todo: last message ⤴⤵↗️↖️↘✔️ */}
|
|
|
|
|
{/* <span>{item.coli_id}</span> */}
|
|
|
|
|
{/* <span><ReadIcon />最后一条消息</span> */}
|
|
|
|
|
<span>{item?.last_message?.text?.body || ''}</span>
|
|
|
|
|
<span><RenderLastMsg {...item?.last_message } /></span>
|
|
|
|
|
<div className='text-sm'>
|
|
|
|
|
<OrderSignEmoji item={item} />
|
|
|
|
|
{(item?.tags || [])?.map((tag) => (
|
|
|
|
@ -301,9 +310,10 @@ const ChatListItem = (({item, refreshConversationList,setListUpdateFlag,onSwitch
|
|
|
|
|
// ].join(' ')}
|
|
|
|
|
// statusText={<WhatsAppOutlined key={'channel'} className='text-whatsapp' />}
|
|
|
|
|
statusText={<ChannelLogo channel={flush([
|
|
|
|
|
item.channels.phone_number ? 'phone' : null,
|
|
|
|
|
item.channels.email ? 'email' : null,
|
|
|
|
|
item.channels.whatsapp_phone_number ? 'waba' : null,
|
|
|
|
|
item?.channels?.phone_number ? 'phone' : null,
|
|
|
|
|
item?.channels?.email ? 'email' : null,
|
|
|
|
|
item?.channels?.whatsapp_phone_number ? 'waba' : null,
|
|
|
|
|
item?.last_message?.type === 'email' ? 'email' : null,
|
|
|
|
|
])} />}
|
|
|
|
|
statusColor={'#fff'}
|
|
|
|
|
onClick={() => onSwitchConversation(item)}
|
|
|
|
|