feat: modified how the message is sent. Took out the handleEnter function since it wasnt needed.

This commit is contained in:
Lion Arar 2025-09-26 13:48:14 -04:00
parent 64c7f34f41
commit e83a26d455
3 changed files with 18 additions and 14 deletions

View File

@ -28,3 +28,4 @@ $negative: #e6364b;
$info: #6bb9e7; $info: #6bb9e7;
$warning: #e4a944; $warning: #e4a944;
$white: white; $white: white;

View File

@ -27,14 +27,14 @@ const sendMessage = async () => {
text.value = ''; text.value = '';
} }
const handleEnter = async (e: KeyboardEvent) => { // const handleEnter = async (e: KeyboardEvent) => {
if (e.shiftKey) { // if (e.shiftKey) {
text.value += '\n'; // text.value += '\n';
} else { // } else {
e.preventDefault(); // e.preventDefault();
await sendMessage(); // await sendMessage();
} // }
}; // };
</script> </script>
<template> <template>
@ -44,12 +44,12 @@ const handleEnter = async (e: KeyboardEvent) => {
<div class="chat-body"> <div class="chat-body">
<DialogueContent :messages="messages"></DialogueContent> <DialogueContent :messages="messages"></DialogueContent>
</div> </div>
<q-form @submit="sendMessage" class="row chat-footer"> <q-form class="row chat-footer">
<q-input v-model="text" label="Enter a Message" autogrow class="col" style="margin-right: 5px;" <q-input v-model="text" label="Enter a Message" autogrow class="col" style="margin-right: 5px;"
@keydown.enter="handleEnter" /> @keydown.enter="sendMessage" />
<q-btn type="submit" :ripple="{ center: true }" color="primary" glossy label="Send" <!-- <q-btn type="submit" :ripple="{ center: true }" color="primary" glossy label="Send"
style="align-self: flex-end; width:60px; height:45px; margin-top: 8px; font-size: 14px;" class="col-2"> style="align-self: flex-end; width:60px; height:45px; margin-top: 8px; font-size: 14px;" class="col-2">
</q-btn> </q-btn> -->
</q-form> </q-form>
</div> </div>
</transition> </transition>

View File

@ -1,5 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
defineProps<{ defineProps<{
text: string; text: string;
sent: boolean; sent: boolean;
@ -7,6 +8,8 @@ defineProps<{
</script> </script>
<template> <template>
<q-chat-message :sent="sent" :text="[text]"> <q-chat-message :sent="sent" :text="[text]" :bg-color="!sent ? 'secondary' : 'accent'">
</q-chat-message> </q-chat-message>
</template> </template>
<style></style>