Increase the bottom threshold for chat container. Closes #2342
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
color: var(--text-color-secondary);
|
||||
& .toBottomWrap {
|
||||
& .toBottomBtn {
|
||||
z-index: 9999;
|
||||
border: none;
|
||||
background-color: gray;
|
||||
}
|
||||
|
||||
@@ -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> = ({
|
||||
itemContent={(index, message) => getViewForMessage(index, message)}
|
||||
followOutput="auto"
|
||||
alignToBottom
|
||||
atBottomThreshold={70}
|
||||
atBottomStateChange={bottom => setAtBottom(bottom)}
|
||||
/>
|
||||
{!atBottom && <ScrollToBotBtn chatContainerRef={chatContainerRef} messages={messages} />}
|
||||
|
||||
Reference in New Issue
Block a user