From 2e9344bba7600c22f955951524cfe19a14773705 Mon Sep 17 00:00:00 2001 From: DJ2LS Date: Sat, 27 Jan 2024 17:44:18 +0100 Subject: [PATCH] cleanup and first implementation of server side message sytem --- gui/src/components/chat_conversations.vue | 49 +- gui/src/components/chat_messages.vue | 32 +- gui/src/components/chat_messages_received.vue | 11 +- gui/src/components/chat_navbar.vue | 42 +- gui/src/components/chat_new_message.vue | 10 +- gui/src/components/main_modals.vue | 92 +- gui/src/js/api.js | 19 +- gui/src/js/chatHandler.ts | 1110 ----------------- gui/src/js/deprecated_sock.js | 886 ------------- gui/src/js/eventHandler.js | 15 + gui/src/js/messagesHandler.ts | 66 + gui/src/store/chatStore.js | 16 +- 12 files changed, 237 insertions(+), 2111 deletions(-) delete mode 100644 gui/src/js/chatHandler.ts delete mode 100644 gui/src/js/deprecated_sock.js create mode 100644 gui/src/js/messagesHandler.ts diff --git a/gui/src/components/chat_conversations.vue b/gui/src/components/chat_conversations.vue index 29884103..d6eec968 100644 --- a/gui/src/components/chat_conversations.vue +++ b/gui/src/components/chat_conversations.vue @@ -6,14 +6,9 @@ setActivePinia(pinia); import { useChatStore } from "../store/chatStore.js"; const chat = useChatStore(pinia); -import { - getNewMessagesByDXCallsign, - resetIsNewMessage, -} from "../js/chatHandler"; function chatSelected(callsign) { chat.selectedCallsign = callsign.toUpperCase(); - // scroll message container to bottom var messageBody = document.getElementById("message-container"); if (messageBody != null) { @@ -21,27 +16,6 @@ function chatSelected(callsign) { messageBody.scrollTop = messageBody.scrollHeight - messageBody.clientHeight; } - if (getNewMessagesByDXCallsign(callsign)[1] > 0) { - let messageArray = getNewMessagesByDXCallsign(callsign)[2]; - console.log(messageArray); - - for (const key in messageArray) { - resetIsNewMessage(messageArray[key].uuid, false); - } - } - - try { - chat.beaconLabelArray = Object.values( - chat.sorted_beacon_list[chat.selectedCallsign].timestamp, - ); - chat.beaconDataArray = Object.values( - chat.sorted_beacon_list[chat.selectedCallsign].snr, - ); - } catch (e) { - console.log("beacon data not fetched: " + e); - chat.beaconLabelArray = []; - chat.beaconDataArray = []; - } }