|
|
|
@ -3,10 +3,9 @@ import React from 'react';
|
|
|
|
|
import { SessionScrollButton } from '../SessionScrollButton';
|
|
|
|
|
import { contextMenu } from 'react-contexify';
|
|
|
|
|
|
|
|
|
|
import { connect, useSelector } from 'react-redux';
|
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
|
|
|
|
|
|
import { SessionMessagesList } from './SessionMessagesList';
|
|
|
|
|
import styled from 'styled-components';
|
|
|
|
|
import autoBind from 'auto-bind';
|
|
|
|
|
import { ConversationTypeEnum } from '../../models/conversation';
|
|
|
|
|
import { getConversationController } from '../../session/conversations';
|
|
|
|
@ -19,12 +18,10 @@ import {
|
|
|
|
|
} from '../../state/ducks/conversations';
|
|
|
|
|
import { StateType } from '../../state/reducer';
|
|
|
|
|
import {
|
|
|
|
|
getFirstUnreadMessageId,
|
|
|
|
|
getQuotedMessageToAnimate,
|
|
|
|
|
getSelectedConversation,
|
|
|
|
|
getSelectedConversationKey,
|
|
|
|
|
getSortedMessagesOfSelectedConversation,
|
|
|
|
|
isFirstUnreadMessageIdAbove,
|
|
|
|
|
} from '../../state/selectors/conversations';
|
|
|
|
|
import { TypingBubble } from './TypingBubble';
|
|
|
|
|
|
|
|
|
@ -46,37 +43,12 @@ export const ScrollToLoadedMessageContext = React.createContext(
|
|
|
|
|
(_loadedMessageIdToScrollTo: string, _reason: ScrollToLoadedReasons) => {}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const SessionUnreadAboveIndicator = styled.div`
|
|
|
|
|
position: sticky;
|
|
|
|
|
top: 0;
|
|
|
|
|
margin: 1em;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
background: var(--color-sent-message-background);
|
|
|
|
|
color: var(--color-sent-message-text);
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
const UnreadAboveIndicator = () => {
|
|
|
|
|
const isFirstUnreadAbove = useSelector(isFirstUnreadMessageIdAbove);
|
|
|
|
|
const firstUnreadMessageId = useSelector(getFirstUnreadMessageId) as string;
|
|
|
|
|
|
|
|
|
|
if (!isFirstUnreadAbove) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
return (
|
|
|
|
|
<SessionUnreadAboveIndicator key={`above-unread-indicator-${firstUnreadMessageId}`}>
|
|
|
|
|
{window.i18n('latestUnreadIsAbove')}
|
|
|
|
|
</SessionUnreadAboveIndicator>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
type Props = SessionMessageListProps & {
|
|
|
|
|
conversationKey?: string;
|
|
|
|
|
messagesProps: Array<SortedMessageModelProps>;
|
|
|
|
|
|
|
|
|
|
conversation?: ReduxConversationType;
|
|
|
|
|
animateQuotedMessageId: string | undefined;
|
|
|
|
|
firstUnreadOnOpen: string | undefined;
|
|
|
|
|
scrollToNow: () => Promise<void>;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -136,8 +108,6 @@ class SessionMessagesListContainerInner extends React.Component<Props> {
|
|
|
|
|
ref={this.props.messageContainerRef}
|
|
|
|
|
data-testid="messages-container"
|
|
|
|
|
>
|
|
|
|
|
<UnreadAboveIndicator />
|
|
|
|
|
|
|
|
|
|
<TypingBubble
|
|
|
|
|
pubkey={conversationKey}
|
|
|
|
|
conversationType={conversation.type}
|
|
|
|
@ -321,7 +291,6 @@ const mapStateToProps = (state: StateType) => {
|
|
|
|
|
conversation: getSelectedConversation(state),
|
|
|
|
|
messagesProps: getSortedMessagesOfSelectedConversation(state),
|
|
|
|
|
animateQuotedMessageId: getQuotedMessageToAnimate(state),
|
|
|
|
|
firstUnreadOnOpen: getFirstUnreadMessageId(state),
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|