Merge remote-tracking branch 'origin/dev-gui-autoscroll' into dev-gui-autoscroll

This commit is contained in:
DJ2LS 2024-03-07 15:14:49 +01:00
commit 11e51afe07
4 changed files with 15 additions and 28 deletions

View File

@ -2,7 +2,6 @@
// @ts-nocheck
// disable typescript check beacuse of error with beacon histogram options
import chat_conversations from "./chat_conversations.vue";
import chat_messages from "./chat_messages.vue";
import chat_new_message from "./chat_new_message.vue";
@ -14,8 +13,6 @@ setActivePinia(pinia);
import { useChatStore } from "../store/chatStore.js";
const chat = useChatStore(pinia);
import {
Chart as ChartJS,
CategoryScale,
@ -106,16 +103,18 @@ const beaconHistogramData = computed(() => ({
}));
const messagesContainer = ref(null);
watch(() => chat.scrollTrigger, (newVal, oldVal) => {
//console.log("Trigger changed from", oldVal, "to", newVal); // Debugging line
nextTick(() => {
if (messagesContainer.value) {
messagesContainer.value.scrollTop = messagesContainer.value.scrollHeight;
}
});
});
watch(
() => chat.scrollTrigger,
(newVal, oldVal) => {
//console.log("Trigger changed from", oldVal, "to", newVal); // Debugging line
nextTick(() => {
if (messagesContainer.value) {
messagesContainer.value.scrollTop =
messagesContainer.value.scrollHeight;
}
});
},
);
</script>
<template>
@ -158,7 +157,7 @@ watch(() => chat.scrollTrigger, (newVal, oldVal) => {
</nav>
<!-- Chat Messages Area -->
<div class="flex-grow-1 overflow-auto" ref="messagesContainer">
<div class="flex-grow-1 overflow-auto" ref="messagesContainer">
<chat_messages />
</div>

View File

@ -1,6 +1,4 @@
<script setup lang="ts">
import { setActivePinia } from "pinia";
import pinia from "../store/index";
setActivePinia(pinia);
@ -26,10 +24,7 @@ function getDateTime(timestampRaw) {
</script>
<template>
<div class="tab-content p-3" id="nav-tabContent-chat-messages"
>
<div class="tab-content p-3" id="nav-tabContent-chat-messages">
<template
v-for="(details, callsign, key) in chat.callsign_list"
:key="callsign"

View File

@ -84,9 +84,6 @@ function createSortedMessagesList(data: {
export function newMessage(dxcall, body, attachments) {
sendFreedataMessage(dxcall, body, attachments);
chatStore.triggerScrollToBottom();
}
/* ------ TEMPORARY DUMMY FUNCTIONS --- */

View File

@ -2,23 +2,19 @@ import { defineStore } from "pinia";
import { ref } from "vue";
export const useChatStore = defineStore("chatStore", () => {
var callsign_list = ref();
var sorted_chat_list = ref();
var newChatCallsign = ref();
var newChatMessage = ref();
/* ------------------------------------------------ */
// Scroll to bottom functions
// Scroll to bottom functions
const scrollTrigger = ref(0);
function triggerScrollToBottom() {
scrollTrigger.value++;
}
/* ------------------------------------------------ */
var chat_filter = ref([