fix: messages are now the right way up

I have broken the reverse flexbox
pull/2971/head
William Grant 2 years ago
parent ca7983caac
commit dacac64b11

@ -2,7 +2,6 @@ import React, { useLayoutEffect, useState } from 'react';
import { useSelector } from 'react-redux';
import useKey from 'react-use/lib/useKey';
import styled from 'styled-components';
import {
PropsForDataExtractionNotification,
PropsForMessageRequestResponse,
@ -34,14 +33,6 @@ function isNotTextboxEvent(e: KeyboardEvent) {
return (e?.target as any)?.type === undefined;
}
// isGroup is used to align the ExpireTimer with the member avatars
const StyledMessagesList = styled.div<{ isGroup: boolean }>`
padding: ${props =>
props.isGroup
? '0 var(--margins-lg) 0 calc(var(--margins-lg) + 11px)'
: '0 var(--margins-lg) 0'};
`;
let previousRenderedConvo: string | undefined;
export const SessionMessagesList = (props: {
@ -53,7 +44,6 @@ export const SessionMessagesList = (props: {
onPageDownPressed: () => void;
onHomePressed: () => void;
onEndPressed: () => void;
isGroup: boolean;
}) => {
const messagesProps = useSelector(getSortedMessagesTypesOfSelectedConversation);
const convoKey = useSelectedConversationKey();
@ -106,7 +96,7 @@ export const SessionMessagesList = (props: {
}
return (
<StyledMessagesList isGroup={props.isGroup}>
<>
{messagesProps.map(messageProps => {
const messageId = messageProps.message.props.messageId;
const unreadIndicator = messageProps.showUnreadIndicator ? (
@ -171,6 +161,6 @@ export const SessionMessagesList = (props: {
return [<Message messageId={messageId} key={messageId} />, ...componentToMerge];
})}
</StyledMessagesList>
</>
);
};

@ -51,7 +51,8 @@ type Props = SessionMessageListProps & {
scrollToNow: () => Promise<void>;
};
const StyledMessagesContainer = styled.div`
// isGroup is used to align the ExpireTimer with the member avatars
const StyledMessagesContainer = styled.div<{ isGroup: boolean }>`
display: flex;
flex-grow: 1;
gap: var(--margins-xxs);
@ -60,7 +61,12 @@ const StyledMessagesContainer = styled.div`
overflow-x: hidden;
min-width: 370px;
scrollbar-width: 4px;
padding: var(--margins-sm) 0 var(--margins-lg);
padding-top: var(--margins-sm);
padding-right: var(--margins-lg);
padding-bottom: var(--margins-lg);
padding-left: ${props =>
props.isGroup ? 'calc(var(--margins-lg) + 11px)' : 'var(--margins-lg)'};
.session-icon-button {
display: flex;
@ -121,6 +127,7 @@ class SessionMessagesListContainerInner extends React.Component<Props> {
<StyledMessagesContainer
className="messages-container"
id={messageContainerDomID}
isGroup={!conversation.isMe && !conversation.isPrivate && !conversation.isPublic}
onScroll={this.handleScroll}
ref={this.props.messageContainerRef}
data-testid="messages-container"
@ -144,7 +151,6 @@ class SessionMessagesListContainerInner extends React.Component<Props> {
onPageUpPressed={this.scrollPgUp}
onHomePressed={this.scrollTop}
onEndPressed={this.scrollEnd}
isGroup={!conversation.isMe && !conversation.isPrivate && !conversation.isPublic}
/>
</ScrollToLoadedMessageContext.Provider>

Loading…
Cancel
Save