Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: channel chat autoscrolls to top of message history #2726

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 27 additions & 32 deletions src/apps/feed/components/feed-chat/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { Media } from '../../../../components/message-input/utils';
import { config } from '../../../../config';
import { ErrorDialogContent } from '../../../../store/chat/types';
import { Panel, PanelBody, PanelHeader, PanelTitle } from '../../../../components/layout/panel';
import { InvertedScroll } from '../../../../components/inverted-scroll';
import { getOtherMembersTypingDisplayJSX } from '../../../../components/messenger/lib/utils';
import { rawChannelSelector } from '../../../../store/channels/saga';
import { IconButton } from '@zero-tech/zui/components/IconButton';
Expand Down Expand Up @@ -163,42 +162,38 @@ export class Container extends React.Component<Properties> {
<Spinner />
</div>
)}
<InvertedScroll className={classNames('channel-view__inverted-scroll', styles.Scroll)} isScrollbarHidden={true}>
<div className={styles.FeedChat}>
<div className={classNames('direct-message-chat', 'direct-message-chat--full-screen')}>
<div className='direct-message-chat__content'>
<div>
{!isLoading && (
<ChatViewContainer
key={this.props.channel.optimisticId || this.props.channel.id} // Render new component for a new chat
channelId={this.props.activeConversationId}
showSenderAvatar={true}
ref={this.chatViewContainerRef}
className='direct-message-chat__channel'
/>
)}

<div className='direct-message-chat__footer-position'>
<div className='direct-message-chat__footer'>
<div className={styles.FeedChatMessageInput}>
{!isLoading && (
<MessageInput
id={this.props.activeConversationId}
onSubmit={this.handleSendMessage}
getUsersForMentions={this.searchMentionableUsers}
reply={this.props.channel?.reply}
onRemoveReply={this.props.onRemoveReply}
/>
)}
{this.renderTypingIndicators()}
</div>
</div>
<div className={styles.FeedChat}>
<div className={classNames('direct-message-chat', 'direct-message-chat--full-screen')}>
<div className='direct-message-chat__content'>
{!isLoading && (
<ChatViewContainer
key={this.props.channel.optimisticId || this.props.channel.id} // Render new component for a new chat
channelId={this.props.activeConversationId}
showSenderAvatar={true}
ref={this.chatViewContainerRef}
className='direct-message-chat__channel'
/>
)}

<div className='direct-message-chat__footer-position'>
<div className='direct-message-chat__footer'>
<div className={styles.FeedChatMessageInput}>
{!isLoading && (
<MessageInput
id={this.props.activeConversationId}
onSubmit={this.handleSendMessage}
getUsersForMentions={this.searchMentionableUsers}
reply={this.props.channel?.reply}
onRemoveReply={this.props.onRemoveReply}
/>
)}
{this.renderTypingIndicators()}
</div>
</div>
</div>
</div>
</div>
</InvertedScroll>
</div>
</PanelBody>
);
};
Expand Down
1 change: 1 addition & 0 deletions src/apps/feed/components/feed-chat/styles.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

.FeedChat {
width: 100%;
height: 100%;

:global(.direct-message-chat) {
margin: 0;
Expand Down