Increase the bottom threshold for chat container. Closes #2342
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
color: var(--text-color-secondary);
|
color: var(--text-color-secondary);
|
||||||
& .toBottomWrap {
|
& .toBottomWrap {
|
||||||
& .toBottomBtn {
|
& .toBottomBtn {
|
||||||
|
z-index: 9999;
|
||||||
border: none;
|
border: none;
|
||||||
background-color: gray;
|
background-color: gray;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,12 +44,12 @@ function shouldCollapseMessages(messages: ChatMessage[], index: number): boolean
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!lastMessage.timestamp || !message.timestamp) {
|
if (!lastMessage?.timestamp || !message.timestamp) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const maxTimestampDelta = 1000 * 60 * 2; // 2 minutes
|
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();
|
const thisTimestamp = new Date(message.timestamp).getTime();
|
||||||
if (thisTimestamp - lastTimestamp > maxTimestampDelta) {
|
if (thisTimestamp - lastTimestamp > maxTimestampDelta) {
|
||||||
return false;
|
return false;
|
||||||
@@ -185,6 +185,7 @@ export const ChatContainer: FC<ChatContainerProps> = ({
|
|||||||
itemContent={(index, message) => getViewForMessage(index, message)}
|
itemContent={(index, message) => getViewForMessage(index, message)}
|
||||||
followOutput="auto"
|
followOutput="auto"
|
||||||
alignToBottom
|
alignToBottom
|
||||||
|
atBottomThreshold={70}
|
||||||
atBottomStateChange={bottom => setAtBottom(bottom)}
|
atBottomStateChange={bottom => setAtBottom(bottom)}
|
||||||
/>
|
/>
|
||||||
{!atBottom && <ScrollToBotBtn chatContainerRef={chatContainerRef} messages={messages} />}
|
{!atBottom && <ScrollToBotBtn chatContainerRef={chatContainerRef} messages={messages} />}
|
||||||
|
|||||||
Reference in New Issue
Block a user