fix: alignment for group messages with no avatar

this happens with multiple incoming messages
pull/2971/head
William Grant 2 years ago
parent b1d604236e
commit 0cbdd5631b

@ -36,10 +36,10 @@ export type MessageAvatarSelectorProps = Pick<
'sender' | 'isSenderAdmin' | 'lastMessageOfSeries' 'sender' | 'isSenderAdmin' | 'lastMessageOfSeries'
>; >;
type Props = { messageId: string; hideAvatar: boolean; isPrivate: boolean; isGroup: boolean }; type Props = { messageId: string; hideAvatar: boolean; isPrivate: boolean };
export const MessageAvatar = (props: Props) => { export const MessageAvatar = (props: Props) => {
const { messageId, hideAvatar, isPrivate, isGroup } = props; const { messageId, hideAvatar, isPrivate } = props;
const dispatch = useDispatch(); const dispatch = useDispatch();
const selectedConvoKey = useSelectedConversationKey(); const selectedConvoKey = useSelectedConversationKey();
@ -137,8 +137,6 @@ export const MessageAvatar = (props: Props) => {
<StyledAvatar <StyledAvatar
key={`msg-avatar-${sender}`} key={`msg-avatar-${sender}`}
style={{ style={{
// isGroup is used to align the ExpireTimer with the member avatars
marginInlineStart: isGroup ? '-11px' : undefined,
visibility: hideAvatar ? 'hidden' : undefined, visibility: hideAvatar ? 'hidden' : undefined,
}} }}
> >

@ -52,6 +52,11 @@ const StyledMessageWithAuthor = styled.div<{ isIncoming: boolean }>`
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)
@ -126,12 +131,9 @@ export const MessageContentWithStatuses = (props: Props) => {
onDoubleClickCapture={onDoubleClickReplyToMessage} onDoubleClickCapture={onDoubleClickReplyToMessage}
dataTestId={dataTestId} dataTestId={dataTestId}
> >
<MessageAvatar <StyledAvatarContainer hideAvatar={hideAvatar} isGroup={isGroup}>
messageId={messageId} <MessageAvatar messageId={messageId} hideAvatar={hideAvatar} isPrivate={isPrivate} />
hideAvatar={hideAvatar} </StyledAvatarContainer>
isPrivate={isPrivate}
isGroup={isGroup}
/>
<MessageStatus <MessageStatus
dataTestId="msg-status-incoming" dataTestId="msg-status-incoming"
messageId={messageId} messageId={messageId}

Loading…
Cancel
Save