From f9a4034764f874d20ba32920d307054a9fb4b417 Mon Sep 17 00:00:00 2001 From: marzban-dev Date: Thu, 27 Mar 2025 22:20:52 +0330 Subject: [PATCH] Add login assist state Add debounce effect for scroll to bottom --- .../product/ChatBox/ChatBoxContainer.vue | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/frontend/components/product/ChatBox/ChatBoxContainer.vue b/frontend/components/product/ChatBox/ChatBoxContainer.vue index 677dcb2..3e40912 100644 --- a/frontend/components/product/ChatBox/ChatBoxContainer.vue +++ b/frontend/components/product/ChatBox/ChatBoxContainer.vue @@ -20,6 +20,8 @@ const { isLoggedIn } = useAuth(); const route = useRoute(); const id = route.params.id as string | number; +const scrollToBottomTimer = ref(null); + const chatContainerEl = ref(null); const lastMessageBeforeUpdate = ref(0); @@ -63,7 +65,10 @@ useInfiniteScroll( // methods const scrollToBottom = () => { - chatContainerScrollY.value = chatContainerEl.value?.scrollHeight ?? 0; + if (scrollToBottomTimer.value) clearTimeout(scrollToBottomTimer.value); + scrollToBottomTimer.value = setTimeout(() => { + chatContainerScrollY.value = chatContainerEl.value?.scrollHeight ?? 0; + }, 50); }; // computed @@ -137,8 +142,7 @@ whenever( >
- - Please sign in first + +
+ سلام دوست عزیز! +

+ من میتونم هر سوالی رو درمورد این محصول جواب بدم + اگه میخوای شروع کنیم روی دکمه زیر کلیک کن +

+
+ + +