FreeDATA/gui/src/components/chat_conversations.vue

60 lines
1.7 KiB
Vue
Raw Normal View History

2023-09-12 15:52:16 +00:00
<script setup lang="ts">
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 { 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 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");
2023-10-22 08:12:00 +00:00
if (messageBody != null) {
2023-10-04 21:34:36 +00:00
// needs sensible defaults
messageBody.scrollTop = messageBody.scrollHeight - messageBody.clientHeight;
}
2023-09-20 04:46:37 +00:00
}
2023-09-12 15:52:16 +00:00
</script>
<template>
<div
class="list-group bg-body-tertiary m-0 p-1"
id="chat-list-tab"
role="chat-tablist"
>
<template v-for="(details, callsign, key) in chat.callsign_list" :key="callsign">
2023-10-03 13:15:17 +00:00
<a
2023-10-25 15:20:39 +00:00
class="list-group-item list-group-item-action list-group-item-dark rounded-2 border-0 mb-2"
2023-10-22 08:12:00 +00:00
:class="{ active: key == 0 }"
:id="`list-chat-list-${callsign}`"
2023-10-03 13:15:17 +00:00
data-bs-toggle="list"
:href="`#list-${callsign}-messages`"
2023-10-03 13:15:17 +00:00
role="tab"
aria-controls="list-{{callsign}}-messages"
@click="chatSelected(callsign)"
2023-10-03 13:15:17 +00:00
>
<div class="row">
2023-10-22 08:12:00 +00:00
<div class="col-9">
<strong>{{ callsign }}</strong>
<!--<small> {{details.timestamp}} </small>-->
</div>
2023-10-03 13:15:17 +00:00
<div class="col-3">
<button
2023-10-15 06:25:58 +00:00
class="btn btn-sm btn-outline-secondary ms-2 border-0"
data-bs-target="#deleteChatModal"
data-bs-toggle="modal"
@click="chatSelected(callsign)"
2023-10-03 13:15:17 +00:00
>
2023-10-15 06:25:58 +00:00
<i class="bi bi-three-dots-vertical"></i>
2023-10-03 13:15:17 +00:00
</button>
</div>
</div>
</a>
</template>
</div>
2023-09-12 15:52:16 +00:00
</template>