diff --git a/src/modules/chatbot/components/conversation-box.vue b/src/modules/chatbot/components/conversation-box.vue index 6de10db..df39425 100644 --- a/src/modules/chatbot/components/conversation-box.vue +++ b/src/modules/chatbot/components/conversation-box.vue @@ -5,10 +5,34 @@ import { ref } from "vue"; import { useChatApi } from "../composables/chat-api"; import { useChatStore } from "src/stores/message-store"; +// Block to enable editing the width of the drawer +const drawerWidth = ref(370); +let dragging = false +const startDrag = (e: MouseEvent) => { + dragging = true + e.preventDefault() +} + +const onDrag = (e: MouseEvent) => { + if (!dragging) return + // calculate new width + const newWidth = window.innerWidth - e.clientX + drawerWidth.value = Math.max(350, Math.min(1000, newWidth)) // min/max width +} + +const stopDrag = () => { + dragging = false +} + +window.addEventListener('mousemove', onDrag) +window.addEventListener('mouseup', stopDrag) + + + +// Block to handle the incomming and sending of the messages from the user and the ai const text = ref(''); const { messages } = useChatStore(); const { sendMessage } = useChatApi(); - const handleSend = async () => { if (!text.value.trim()) return; const userMessage = text.value; @@ -59,7 +83,8 @@ const handleSend = async () => { side="right" v-model="isChatVisible" class="chat-drawer" - :width="370" + style="box-shadow: -4px 0 12px rgba(0,0,0,0.15);" + :width="drawerWidth" >