fix: resolved incoming message alignemnt in 1o1 conversations

there is never an avatar so we should never render it
pull/2757/head
William Grant 2 years ago
parent f87995a375
commit 712259ddef

@ -35,10 +35,10 @@ export type MessageAvatarSelectorProps = Pick<
| 'lastMessageOfSeries' | 'lastMessageOfSeries'
>; >;
type Props = { messageId: string; hideAvatar: boolean }; type Props = { messageId: string; hideAvatar: boolean; isPrivate: boolean };
export const MessageAvatar = (props: Props) => { export const MessageAvatar = (props: Props) => {
const { messageId, hideAvatar } = props; const { messageId, hideAvatar, isPrivate } = props;
const dispatch = useDispatch(); const dispatch = useDispatch();
const avatarProps = useSelector(state => getMessageAvatarProps(state as any, messageId)); const avatarProps = useSelector(state => getMessageAvatarProps(state as any, messageId));
@ -126,7 +126,10 @@ export const MessageAvatar = (props: Props) => {
return ( return (
<StyledAvatar <StyledAvatar
key={`msg-avatar-${sender}`} key={`msg-avatar-${sender}`}
style={{ visibility: hideAvatar ? 'hidden' : undefined }} style={{
visibility: hideAvatar ? 'hidden' : undefined,
display: isPrivate && hideAvatar ? 'none' : undefined,
}}
> >
<Avatar size={AvatarSize.S} onAvatarClick={onMessageAvatarClick} pubkey={sender} /> <Avatar size={AvatarSize.S} onAvatarClick={onMessageAvatarClick} pubkey={sender} />
{isSenderAdmin && <CrownIcon />} {isSenderAdmin && <CrownIcon />}

@ -94,7 +94,9 @@ export const MessageContentWithStatuses = (props: Props) => {
} }
const { conversationType, direction, isDeleted } = contentProps; const { conversationType, direction, isDeleted } = contentProps;
const isIncoming = direction === 'incoming'; const isIncoming = direction === 'incoming';
const hideAvatar = conversationType !== 'group' || direction === 'outgoing';
const isPrivate = conversationType === 'private';
const hideAvatar = isPrivate || direction === 'outgoing';
const [popupReaction, setPopupReaction] = useState(''); const [popupReaction, setPopupReaction] = useState('');
@ -120,7 +122,7 @@ export const MessageContentWithStatuses = (props: Props) => {
onDoubleClickCapture={onDoubleClickReplyToMessage} onDoubleClickCapture={onDoubleClickReplyToMessage}
data-testid={dataTestId} data-testid={dataTestId}
> >
<MessageAvatar messageId={messageId} hideAvatar={hideAvatar} /> <MessageAvatar messageId={messageId} hideAvatar={hideAvatar} isPrivate={isPrivate} />
<MessageStatus <MessageStatus
dataTestId="msg-status-incoming" dataTestId="msg-status-incoming"
messageId={messageId} messageId={messageId}

Loading…
Cancel
Save