@ -7,6 +7,7 @@ import { MessageRenderingProps } from '../../../../models/messageType';
import { toggleSelectedMessageId } from '../../../../state/ducks/conversations' ;
import { toggleSelectedMessageId } from '../../../../state/ducks/conversations' ;
import { updateReactListModal } from '../../../../state/ducks/modalDialog' ;
import { updateReactListModal } from '../../../../state/ducks/modalDialog' ;
import { StateType } from '../../../../state/reducer' ;
import { StateType } from '../../../../state/reducer' ;
import { useHideAvatarInMsgList } from '../../../../state/selectors' ;
import {
import {
getMessageContentWithStatusesSelectorProps ,
getMessageContentWithStatusesSelectorProps ,
isMessageSelectionMode ,
isMessageSelectionMode ,
@ -15,7 +16,6 @@ import { Reactions } from '../../../../util/reactions';
import { Flex } from '../../../basic/Flex' ;
import { Flex } from '../../../basic/Flex' ;
import { ExpirableReadableMessage } from '../message-item/ExpirableReadableMessage' ;
import { ExpirableReadableMessage } from '../message-item/ExpirableReadableMessage' ;
import { MessageAuthorText } from './MessageAuthorText' ;
import { MessageAuthorText } from './MessageAuthorText' ;
import { MessageAvatar } from './MessageAvatar' ;
import { MessageContent } from './MessageContent' ;
import { MessageContent } from './MessageContent' ;
import { MessageContextMenu } from './MessageContextMenu' ;
import { MessageContextMenu } from './MessageContextMenu' ;
import { MessageReactions , StyledMessageReactions } from './MessageReactions' ;
import { MessageReactions , StyledMessageReactions } from './MessageReactions' ;
@ -46,23 +46,19 @@ const StyledMessageContentContainer = styled.div<{ isIncoming: boolean }>`
}
}
` ;
` ;
const StyledMessageWithAuthor = styled . div < { isIncoming : boolean } > `
const StyledMessageWithAuthor = styled . div `
max - width : '100%' ;
max - width : '100%' ;
display : flex ;
display : flex ;
flex - direction : column ;
flex - direction : column ;
min - width : 0 ;
min - width : 0 ;
` ;
` ;
// NOTE aligns group member avatars with the ExpireTimer
const StyledAvatarContainer = styled . div < { hideAvatar : boolean ; isGroup : boolean } > `
margin - inline - start : $ { props = > ( ! props . hideAvatar && props . isGroup ? '-11px' : '' ) } ;
` ;
export const MessageContentWithStatuses = ( props : Props ) = > {
export const MessageContentWithStatuses = ( props : Props ) = > {
const contentProps = useSelector ( ( state : StateType ) = >
const contentProps = useSelector ( ( state : StateType ) = >
getMessageContentWithStatusesSelectorProps ( state , props . messageId )
getMessageContentWithStatusesSelectorProps ( state , props . messageId )
) ;
) ;
const dispatch = useDispatch ( ) ;
const dispatch = useDispatch ( ) ;
const hideAvatar = useHideAvatarInMsgList ( props . messageId ) ;
const multiSelectMode = useSelector ( isMessageSelectionMode ) ;
const multiSelectMode = useSelector ( isMessageSelectionMode ) ;
@ -103,12 +99,9 @@ export const MessageContentWithStatuses = (props: Props) => {
return null ;
return null ;
}
}
const { conversationType, direction, isDeleted , isGroup } = contentProps ;
const { direction, isDeleted } = contentProps ;
const isIncoming = direction === 'incoming' ;
const isIncoming = direction === 'incoming' ;
const isPrivate = conversationType === 'private' ;
const hideAvatar = isPrivate || direction === 'outgoing' ;
const handleMessageReaction = async ( emoji : string ) = > {
const handleMessageReaction = async ( emoji : string ) = > {
await Reactions . sendMessageReaction ( messageId , emoji ) ;
await Reactions . sendMessageReaction ( messageId , emoji ) ;
} ;
} ;
@ -132,12 +125,8 @@ export const MessageContentWithStatuses = (props: Props) => {
onDoubleClickCapture = { onDoubleClickReplyToMessage }
onDoubleClickCapture = { onDoubleClickReplyToMessage }
dataTestId = { dataTestId }
dataTestId = { dataTestId }
>
>
< StyledAvatarContainer hideAvatar = { hideAvatar } isGroup = { isGroup } >
< MessageAvatar messageId = { messageId } hideAvatar = { hideAvatar } isPrivate = { isPrivate } / >
< / StyledAvatarContainer >
< Flex container = { true } flexDirection = "column" flexShrink = { 0 } >
< Flex container = { true } flexDirection = "column" flexShrink = { 0 } >
< StyledMessageWithAuthor isIncoming = { isIncoming } >
< StyledMessageWithAuthor >
< MessageAuthorText messageId = { messageId } / >
< MessageAuthorText messageId = { messageId } / >
< MessageContent messageId = { messageId } isDetailView = { isDetailView } / >
< MessageContent messageId = { messageId } isDetailView = { isDetailView } / >
< / StyledMessageWithAuthor >
< / StyledMessageWithAuthor >