This commit is contained in:
Timothy J. Baek 2024-02-15 20:10:48 -08:00
parent 0d39a9fe0e
commit 2c2c2fd889
4 changed files with 8 additions and 9 deletions

View file

@ -29,7 +29,6 @@
$: if (autoScroll && bottomPadding) { $: if (autoScroll && bottomPadding) {
(async () => { (async () => {
await tick(); await tick();
scrollToBottom(); scrollToBottom();
})(); })();
} }
@ -167,7 +166,7 @@
await tick(); await tick();
const element = document.getElementById('messages-container'); const element = document.getElementById('messages-container');
autoScroll = element.scrollHeight - element.scrollTop === element.clientHeight - 40; autoScroll = element.scrollHeight - element.scrollTop <= element.clientHeight + 50;
setTimeout(() => { setTimeout(() => {
scrollToBottom(); scrollToBottom();
@ -216,7 +215,7 @@
await tick(); await tick();
const element = document.getElementById('messages-container'); const element = document.getElementById('messages-container');
autoScroll = element.scrollHeight - element.scrollTop === element.clientHeight - 40; autoScroll = element.scrollHeight - element.scrollTop <= element.clientHeight + 50;
setTimeout(() => { setTimeout(() => {
scrollToBottom(); scrollToBottom();

View file

@ -89,10 +89,14 @@
bind:this={navElement} bind:this={navElement}
class="h-screen {show class="h-screen {show
? '' ? ''
: '-translate-x-[260px] w-[0px]'} w-[260px] bg-black text-gray-200 shadow-2xl text-sm transition z-40 fixed top-0 left-0 lg:relative : '-translate-x-[260px] w-[0px]'} w-[260px] min-w[260px] bg-black text-gray-200 shadow-2xl text-sm transition z-40 fixed top-0 left-0 lg:relative
" "
> >
<div class="py-2.5 my-auto flex flex-col justify-between h-screen {show ? '' : 'invisible'}"> <div
class="py-2.5 my-auto flex flex-col justify-between h-screen w-[260px] {show
? ''
: 'invisible'}"
>
<div class="px-2.5 flex justify-center space-x-2"> <div class="px-2.5 flex justify-center space-x-2">
<button <button
id="sidebar-new-chat-button" id="sidebar-new-chat-button"

View file

@ -794,8 +794,6 @@
class=" pb-2.5 flex flex-col justify-between w-full flex-auto overflow-auto h-80" class=" pb-2.5 flex flex-col justify-between w-full flex-auto overflow-auto h-80"
id="messages-container" id="messages-container"
on:scroll={(e) => { on:scroll={(e) => {
console.log(e.target.scrollHeight, e.target.scrollTop, e.target.clientHeight);
console.log(e.target.scrollHeight - e.target.scrollTop, e.target.clientHeight);
autoScroll = e.target.scrollHeight - e.target.scrollTop <= e.target.clientHeight + 50; autoScroll = e.target.scrollHeight - e.target.scrollTop <= e.target.clientHeight + 50;
}} }}
> >

View file

@ -824,8 +824,6 @@
class=" pb-2.5 flex flex-col justify-between w-full flex-auto overflow-auto h-0" class=" pb-2.5 flex flex-col justify-between w-full flex-auto overflow-auto h-0"
id="messages-container" id="messages-container"
on:scroll={(e) => { on:scroll={(e) => {
console.log(e.target.scrollHeight, e.target.scrollTop, e.target.clientHeight);
console.log(e.target.scrollHeight - e.target.scrollTop, e.target.clientHeight);
autoScroll = e.target.scrollHeight - e.target.scrollTop <= e.target.clientHeight + 50; autoScroll = e.target.scrollHeight - e.target.scrollTop <= e.target.clientHeight + 50;
}} }}
> >