From 1a6c41a479e288cb72a077955e0bbeb73c5230dd Mon Sep 17 00:00:00 2001 From: DJ2LS Date: Wed, 18 Oct 2023 13:45:57 +0200 Subject: [PATCH] attempt making unread message counter working --- gui_vue/src/components/chat.vue | 2 +- gui_vue/src/components/chat_conversations.vue | 23 +++++++++++++-- gui_vue/src/components/main_modals.vue | 17 ++++++++++- gui_vue/src/js/chatHandler.js | 29 ++++++++++++++++++- gui_vue/src/js/sock.js | 2 +- 5 files changed, 67 insertions(+), 6 deletions(-) diff --git a/gui_vue/src/components/chat.vue b/gui_vue/src/components/chat.vue index c9beef5b..e43dcefe 100644 --- a/gui_vue/src/components/chat.vue +++ b/gui_vue/src/components/chat.vue @@ -31,7 +31,7 @@ updateAllChat();
-
+
diff --git a/gui_vue/src/components/chat_conversations.vue b/gui_vue/src/components/chat_conversations.vue index 603e8ab6..61021b3a 100644 --- a/gui_vue/src/components/chat_conversations.vue +++ b/gui_vue/src/components/chat_conversations.vue @@ -14,6 +14,8 @@ const state = useStateStore(pinia); import { useChatStore } from "../store/chatStore.js"; const chat = useChatStore(pinia); +import {getNewMessagesByDXCallsign, resetIsNewMessage} from '../js/chatHandler' + import chat_conversations_entry from "./chat_conversations_entry.vue"; @@ -21,6 +23,7 @@ import chat_conversations_entry from "./chat_conversations_entry.vue"; function chatSelected(callsign) { chat.selectedCallsign = callsign.toUpperCase(); + // scroll message container to bottom var messageBody = document.getElementById("message-container"); if (messageBody != null ) { @@ -28,6 +31,13 @@ function chatSelected(callsign) { messageBody.scrollTop = messageBody.scrollHeight - messageBody.clientHeight; } + if (getNewMessagesByDXCallsign(callsign)[1] > 0){ + let messageArray = getNewMessagesByDXCallsign(callsign)[2] + for (const key in messageArray){ + resetIsNewMessage(messageArray[key].uuid, false) + } + } + try { chat.beaconLabelArray = Object.values( chat.sorted_beacon_list[chat.selectedCallsign].timestamp, @@ -47,7 +57,7 @@ function chatSelected(callsign) {