fix: resolves SES-583 left alignment of outgoing messages on smaller screens

pull/2757/head
William Grant 2 years ago
parent bc55a2db1b
commit 279642dff3

@ -26,7 +26,7 @@
display: inline-flex; display: inline-flex;
flex-direction: row; flex-direction: row;
align-items: flex-end; align-items: flex-end;
max-width: 95%; max-width: 100%;
@media (min-width: 1200px) { @media (min-width: 1200px) {
max-width: 65%; max-width: 65%;

@ -35,10 +35,10 @@ export type MessageAvatarSelectorProps = Pick<
| 'lastMessageOfSeries' | 'lastMessageOfSeries'
>; >;
type Props = { messageId: string; noAvatar: boolean }; type Props = { messageId: string; hideAvatar: boolean };
export const MessageAvatar = (props: Props) => { export const MessageAvatar = (props: Props) => {
const { messageId, noAvatar } = props; const { messageId, hideAvatar } = 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));
@ -60,10 +60,6 @@ export const MessageAvatar = (props: Props) => {
isPublic, isPublic,
} = avatarProps; } = avatarProps;
if (noAvatar) {
return null;
}
const userName = authorName || authorProfileName || sender; const userName = authorName || authorProfileName || sender;
const onMessageAvatarClick = useCallback(async () => { const onMessageAvatarClick = useCallback(async () => {
@ -128,7 +124,10 @@ export const MessageAvatar = (props: Props) => {
} }
return ( return (
<StyledAvatar key={`msg-avatar-${sender}`}> <StyledAvatar
key={`msg-avatar-${sender}`}
style={{ visibility: hideAvatar ? 'hidden' : undefined }}
>
<Avatar size={AvatarSize.S} onAvatarClick={onMessageAvatarClick} pubkey={sender} /> <Avatar size={AvatarSize.S} onAvatarClick={onMessageAvatarClick} pubkey={sender} />
{isSenderAdmin && <CrownIcon />} {isSenderAdmin && <CrownIcon />}
</StyledAvatar> </StyledAvatar>

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

Loading…
Cancel
Save