|
@@ -5,6 +5,7 @@ import { useSelector,useDispatch } from "react-redux";
|
|
import ArrowBack from "./ArrowBack";
|
|
import ArrowBack from "./ArrowBack";
|
|
import SendMessage from "./SendMessage";
|
|
import SendMessage from "./SendMessage";
|
|
import UnpinBar from "./UnpinBar";
|
|
import UnpinBar from "./UnpinBar";
|
|
|
|
+import MessageLeftDeleted from "./Messages/MessageLeftDeleted";
|
|
import MessageLeftText from './Messages/MessageLeftText'
|
|
import MessageLeftText from './Messages/MessageLeftText'
|
|
import MessageLeftReply from "./Messages/MessageLeftReply";
|
|
import MessageLeftReply from "./Messages/MessageLeftReply";
|
|
import MessageLeftForward from "./Messages/MessageLeftForward";
|
|
import MessageLeftForward from "./Messages/MessageLeftForward";
|
|
@@ -12,6 +13,7 @@ import MessageLeftImage from './Messages/MessageLeftImage'
|
|
import MessageLeftAudio from './Messages/MessageLeftAudio'
|
|
import MessageLeftAudio from './Messages/MessageLeftAudio'
|
|
import MessageLeftVideo from './Messages/MessageLeftVideo'
|
|
import MessageLeftVideo from './Messages/MessageLeftVideo'
|
|
import MessageLeftFile from "./Messages/MessageLeftFile";
|
|
import MessageLeftFile from "./Messages/MessageLeftFile";
|
|
|
|
+import MessageRightDeleted from "./Messages/MessageRightDeleted";
|
|
import MessageRightText from './Messages/MessageRightText'
|
|
import MessageRightText from './Messages/MessageRightText'
|
|
import MessageRightReply from "./Messages/MessageRightReply";
|
|
import MessageRightReply from "./Messages/MessageRightReply";
|
|
import MessageRightForward from "./Messages/MessageRightForward";
|
|
import MessageRightForward from "./Messages/MessageRightForward";
|
|
@@ -179,7 +181,15 @@ const ChatBar = ({chatDivRef,selectedArr,setSelectedArr,isSomeSelected,setIsSome
|
|
dispatch(actionOpenPinned(false))
|
|
dispatch(actionOpenPinned(false))
|
|
dispatch(asyncStartChatById(companionIdForwardToAndFrom))
|
|
dispatch(asyncStartChatById(companionIdForwardToAndFrom))
|
|
setTimeout(() => handleScrollToTheMessage(oldId), 2000)
|
|
setTimeout(() => handleScrollToTheMessage(oldId), 2000)
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ const handleOpenTheChat = (companionIdForwardToAndFrom: string | null) => {
|
|
|
|
+ if (companionIdForwardToAndFrom&&companionId !== companionIdForwardToAndFrom) {
|
|
|
|
+ dispatch(actionRightIsOpen(''))
|
|
|
|
+ dispatch(actionOpenPinned(false))
|
|
|
|
+ dispatch(asyncStartChatById(companionIdForwardToAndFrom))
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
if (scrollChat) {
|
|
if (scrollChat) {
|
|
@@ -230,7 +240,7 @@ const ChatBar = ({chatDivRef,selectedArr,setSelectedArr,isSomeSelected,setIsSome
|
|
<div className={classes.messagesBody}>
|
|
<div className={classes.messagesBody}>
|
|
{messagesMemo.length > 0 ? renderArr.map(({ replyMessage,message, name, lastName,avatarUrl,color,pinned,
|
|
{messagesMemo.length > 0 ? renderArr.map(({ replyMessage,message, name, lastName,avatarUrl,color,pinned,
|
|
createdAt, number, type, fullType, replyName, replyLastName, replyCaption, caption, emoji, emojiCompanion,
|
|
createdAt, number, type, fullType, replyName, replyLastName, replyCaption, caption, emoji, emojiCompanion,
|
|
- _id, oldId, forwardName, forwardLastName, companionIdForwardToAndFrom,forwardMessage,forwardCaption,edited},i) => {
|
|
|
|
|
|
+ _id, oldId, forwardName, forwardLastName, companionIdForwardToAndFrom,forwardMessage,forwardCaption,edited,deleted},i) => {
|
|
const watched = seenCompanion - (i + 1) < 0 ? false : true
|
|
const watched = seenCompanion - (i + 1) < 0 ? false : true
|
|
let isUnread
|
|
let isUnread
|
|
let isTime
|
|
let isTime
|
|
@@ -282,7 +292,7 @@ const ChatBar = ({chatDivRef,selectedArr,setSelectedArr,isSomeSelected,setIsSome
|
|
const urlForward = `${prodAwsS3}/${forwardMessage}`
|
|
const urlForward = `${prodAwsS3}/${forwardMessage}`
|
|
const urlReply = `${prodAwsS3}/${replyMessage}`
|
|
const urlReply = `${prodAwsS3}/${replyMessage}`
|
|
if (number !== userNumber) {
|
|
if (number !== userNumber) {
|
|
- if (type === 'text' && !oldId && !companionIdForwardToAndFrom) return (<div key={createdAt} id={_id} style={{borderRadius: 7}}>
|
|
|
|
|
|
+ if (type === 'text' && !oldId && !companionIdForwardToAndFrom && !deleted) return (<div key={createdAt} id={_id} style={{borderRadius: 7}}>
|
|
{isTime&&<MessageDivider message={timeStampFilter(createdAt)}/>}
|
|
{isTime&&<MessageDivider message={timeStampFilter(createdAt)}/>}
|
|
{isUnread&&<MessageDivider message='Unread Messages'/>}
|
|
{isUnread&&<MessageDivider message='Unread Messages'/>}
|
|
<MessageLeftText
|
|
<MessageLeftText
|
|
@@ -307,6 +317,36 @@ const ChatBar = ({chatDivRef,selectedArr,setSelectedArr,isSomeSelected,setIsSome
|
|
handleReply={handleReply}
|
|
handleReply={handleReply}
|
|
handleForward={handleForward}
|
|
handleForward={handleForward}
|
|
/></div>)
|
|
/></div>)
|
|
|
|
+ if (type === 'text' && deleted) return (<div key={createdAt} id={_id} style={{borderRadius: 7}}>
|
|
|
|
+ {isTime&&<MessageDivider message={timeStampFilter(createdAt)}/>}
|
|
|
|
+ {isUnread&&<MessageDivider message='Unread Messages'/>}
|
|
|
|
+ <MessageLeftDeleted
|
|
|
|
+ tongue={isTongue}
|
|
|
|
+ watched={watched}
|
|
|
|
+ edited={edited}
|
|
|
|
+ companionIdForwardToAndFrom={companionIdForwardToAndFrom}
|
|
|
|
+ avatarUrl={avatarUrl}
|
|
|
|
+ color={color}
|
|
|
|
+ name={name}
|
|
|
|
+ lastName={lastName}
|
|
|
|
+ forwardReplyName={companionIdForwardToAndFrom?forwardName:replyName}
|
|
|
|
+ forwardReplyLastName={companionIdForwardToAndFrom?forwardLastName:replyLastName}
|
|
|
|
+ message={message}
|
|
|
|
+ createdAt={createdAt}
|
|
|
|
+ caption={caption}
|
|
|
|
+ emoji={emoji}
|
|
|
|
+ emojiCompanion={emojiCompanion}
|
|
|
|
+ pinned={pinned}
|
|
|
|
+ isSomeSelected={isSomeSelected}
|
|
|
|
+ isSelected={isSelected}
|
|
|
|
+ handleSelected={handleSelected}
|
|
|
|
+ _id={_id}
|
|
|
|
+ nightMode={nightMode}
|
|
|
|
+ handleReply={handleReply}
|
|
|
|
+ handleForward={handleForward}
|
|
|
|
+ handleEdit={handleEdit}
|
|
|
|
+ handleOpenTheChat={handleOpenTheChat}
|
|
|
|
+ /></div>)
|
|
if (type === 'text' && companionIdForwardToAndFrom) return (<div key={createdAt} id={_id} style={{borderRadius: 7}}>
|
|
if (type === 'text' && companionIdForwardToAndFrom) return (<div key={createdAt} id={_id} style={{borderRadius: 7}}>
|
|
{isTime&&<MessageDivider message={timeStampFilter(createdAt)}/>}
|
|
{isTime&&<MessageDivider message={timeStampFilter(createdAt)}/>}
|
|
{isUnread&&<MessageDivider message='Unread Messages'/>}
|
|
{isUnread&&<MessageDivider message='Unread Messages'/>}
|
|
@@ -479,7 +519,7 @@ const ChatBar = ({chatDivRef,selectedArr,setSelectedArr,isSomeSelected,setIsSome
|
|
handleForward={handleForward}
|
|
handleForward={handleForward}
|
|
/></div>)
|
|
/></div>)
|
|
} else {
|
|
} else {
|
|
- if (type === 'text' && !oldId && !companionIdForwardToAndFrom) return (<div key={createdAt} id={_id} style={{borderRadius: 7}}>
|
|
|
|
|
|
+ if (type === 'text' && !oldId && !companionIdForwardToAndFrom && !deleted) return (<div key={createdAt} id={_id} style={{borderRadius: 7}}>
|
|
{isTime&&<MessageDivider message={timeStampFilter(createdAt)}/>}
|
|
{isTime&&<MessageDivider message={timeStampFilter(createdAt)}/>}
|
|
{isUnread&&<MessageDivider message='Unread Messages'/>}
|
|
{isUnread&&<MessageDivider message='Unread Messages'/>}
|
|
<MessageRightText
|
|
<MessageRightText
|
|
@@ -505,6 +545,36 @@ const ChatBar = ({chatDivRef,selectedArr,setSelectedArr,isSomeSelected,setIsSome
|
|
handleForward={handleForward}
|
|
handleForward={handleForward}
|
|
handleEdit={handleEdit}
|
|
handleEdit={handleEdit}
|
|
/></div>)
|
|
/></div>)
|
|
|
|
+ if (type === 'text' && deleted) return (<div key={createdAt} id={_id} style={{borderRadius: 7}}>
|
|
|
|
+ {isTime&&<MessageDivider message={timeStampFilter(createdAt)}/>}
|
|
|
|
+ {isUnread&&<MessageDivider message='Unread Messages'/>}
|
|
|
|
+ <MessageRightDeleted
|
|
|
|
+ tongue={isTongue}
|
|
|
|
+ watched={watched}
|
|
|
|
+ edited={edited}
|
|
|
|
+ companionIdForwardToAndFrom={companionIdForwardToAndFrom}
|
|
|
|
+ avatarUrl={avatarUrl}
|
|
|
|
+ color={color}
|
|
|
|
+ name={name}
|
|
|
|
+ lastName={lastName}
|
|
|
|
+ forwardReplyName={companionIdForwardToAndFrom?forwardName:replyName}
|
|
|
|
+ forwardReplyLastName={companionIdForwardToAndFrom?forwardLastName:replyLastName}
|
|
|
|
+ message={message}
|
|
|
|
+ createdAt={createdAt}
|
|
|
|
+ caption={caption}
|
|
|
|
+ emoji={emoji}
|
|
|
|
+ emojiCompanion={emojiCompanion}
|
|
|
|
+ pinned={pinned}
|
|
|
|
+ isSomeSelected={isSomeSelected}
|
|
|
|
+ isSelected={isSelected}
|
|
|
|
+ handleSelected={handleSelected}
|
|
|
|
+ _id={_id}
|
|
|
|
+ nightMode={nightMode}
|
|
|
|
+ handleReply={handleReply}
|
|
|
|
+ handleForward={handleForward}
|
|
|
|
+ handleEdit={handleEdit}
|
|
|
|
+ handleOpenTheChat={handleOpenTheChat}
|
|
|
|
+ /></div>)
|
|
if (type === 'text' && companionIdForwardToAndFrom) return (<div key={createdAt} id={_id} style={{borderRadius: 7}}>
|
|
if (type === 'text' && companionIdForwardToAndFrom) return (<div key={createdAt} id={_id} style={{borderRadius: 7}}>
|
|
{isTime&&<MessageDivider message={timeStampFilter(createdAt)}/>}
|
|
{isTime&&<MessageDivider message={timeStampFilter(createdAt)}/>}
|
|
{isUnread&&<MessageDivider message='Unread Messages'/>}
|
|
{isUnread&&<MessageDivider message='Unread Messages'/>}
|