2023-09-12 15:52:16 +00:00
|
|
|
<script setup lang="ts">
|
2023-10-03 13:15:17 +00:00
|
|
|
import { saveSettingsToFile } from "../js/settingsHandler";
|
2023-09-12 15:52:16 +00:00
|
|
|
|
2023-10-03 13:15:17 +00:00
|
|
|
import { setActivePinia } from "pinia";
|
|
|
|
import pinia from "../store/index";
|
2023-09-12 15:52:16 +00:00
|
|
|
setActivePinia(pinia);
|
2023-10-03 13:15:17 +00:00
|
|
|
import { deleteChatByCallsign } from "../js/chatHandler";
|
2023-09-12 15:52:16 +00:00
|
|
|
|
2023-10-03 13:15:17 +00:00
|
|
|
import { useSettingsStore } from "../store/settingsStore.js";
|
2023-09-12 15:52:16 +00:00
|
|
|
const settings = useSettingsStore(pinia);
|
|
|
|
|
2023-10-03 13:15:17 +00:00
|
|
|
import { useStateStore } from "../store/stateStore.js";
|
2023-09-12 15:52:16 +00:00
|
|
|
const state = useStateStore(pinia);
|
|
|
|
|
2023-10-03 13:15:17 +00:00
|
|
|
import { useChatStore } from "../store/chatStore.js";
|
2023-09-12 15:52:16 +00:00
|
|
|
const chat = useChatStore(pinia);
|
|
|
|
|
2023-10-03 13:15:17 +00:00
|
|
|
function deleteChat(callsign) {
|
|
|
|
deleteChatByCallsign(callsign);
|
2023-09-14 19:45:07 +00:00
|
|
|
}
|
2023-09-12 15:52:16 +00:00
|
|
|
|
2023-10-03 13:15:17 +00:00
|
|
|
import chat_conversations_entry from "./chat_conversations_entry.vue";
|
2023-09-12 15:52:16 +00:00
|
|
|
|
2023-10-03 13:15:17 +00:00
|
|
|
function chatSelected(callsign) {
|
|
|
|
chat.selectedCallsign = callsign.toUpperCase();
|
2023-09-20 04:46:37 +00:00
|
|
|
|
|
|
|
// scroll message container to bottom
|
|
|
|
var messageBody = document.getElementById("message-container");
|
|
|
|
messageBody.scrollTop = messageBody.scrollHeight - messageBody.clientHeight;
|
|
|
|
|
2023-10-03 13:15:17 +00:00
|
|
|
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 = [];
|
|
|
|
}
|
|
|
|
|
|
|
|
console.log(chat.beaconDataArray);
|
2023-09-20 04:46:37 +00:00
|
|
|
}
|
2023-09-12 15:52:16 +00:00
|
|
|
</script>
|
|
|
|
<template>
|
2023-10-03 13:15:17 +00:00
|
|
|
<div class="list-group m-0 p-0" id="chat-list-tab" role="chat-tablist">
|
|
|
|
<template v-for="(item, key) in chat.callsign_list" :key="item.dxcallsign">
|
|
|
|
<a
|
|
|
|
class="list-group-item list-group-item-action border-0 border-bottom rounded-0"
|
|
|
|
:class="{ active: key == 0 }"
|
|
|
|
:id="`list-chat-list-${item}`"
|
|
|
|
data-bs-toggle="list"
|
|
|
|
:href="`#list-${item}-messages`"
|
|
|
|
role="tab"
|
|
|
|
aria-controls="list-{{item}}-messages"
|
|
|
|
@click="chatSelected(item)"
|
|
|
|
>
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-9">{{ item }}</div>
|
|
|
|
<div class="col-3">
|
|
|
|
<button
|
|
|
|
class="btn btn-sm btn-outline-danger ms-2"
|
|
|
|
@click="deleteChat(item)"
|
|
|
|
>
|
|
|
|
<i class="bi bi-trash"></i>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</a>
|
|
|
|
</template>
|
2023-09-12 15:52:16 +00:00
|
|
|
<!--<chat_conversations_entry/>-->
|
2023-10-03 13:15:17 +00:00
|
|
|
</div>
|
2023-09-12 15:52:16 +00:00
|
|
|
</template>
|