Browse Source

Increase the bottom threshold for chat container. Closes #2342

pull/2407/head
Gabe Kangas 3 years ago
parent
commit
8a14173066
No known key found for this signature in database
GPG Key ID: 4345B2060657F330
  1. 1
      web/components/chat/ChatContainer/ChatContainer.module.scss
  2. 5
      web/components/chat/ChatContainer/ChatContainer.tsx

1
web/components/chat/ChatContainer/ChatContainer.module.scss

@ -16,6 +16,7 @@ @@ -16,6 +16,7 @@
color: var(--text-color-secondary);
& .toBottomWrap {
& .toBottomBtn {
z-index: 9999;
border: none;
background-color: gray;
}

5
web/components/chat/ChatContainer/ChatContainer.tsx

@ -44,12 +44,12 @@ function shouldCollapseMessages(messages: ChatMessage[], index: number): boolean @@ -44,12 +44,12 @@ function shouldCollapseMessages(messages: ChatMessage[], index: number): boolean
return false;
}
if (!lastMessage.timestamp || !message.timestamp) {
if (!lastMessage?.timestamp || !message.timestamp) {
return false;
}
const maxTimestampDelta = 1000 * 60 * 2; // 2 minutes
const lastTimestamp = new Date(lastMessage.timestamp).getTime();
const lastTimestamp = new Date(lastMessage?.timestamp).getTime();
const thisTimestamp = new Date(message.timestamp).getTime();
if (thisTimestamp - lastTimestamp > maxTimestampDelta) {
return false;
@ -185,6 +185,7 @@ export const ChatContainer: FC<ChatContainerProps> = ({ @@ -185,6 +185,7 @@ export const ChatContainer: FC<ChatContainerProps> = ({
itemContent={(index, message) => getViewForMessage(index, message)}
followOutput="auto"
alignToBottom
atBottomThreshold={70}
atBottomStateChange={bottom => setAtBottom(bottom)}
/>
{!atBottom && <ScrollToBotBtn chatContainerRef={chatContainerRef} messages={messages} />}

Loading…
Cancel
Save