Files
singlechat/client/src/components/HistoryView.vue
Torsten Schulz (local) bfe28a25fa
All checks were successful
Deploy SingleChat / deploy (push) Successful in 40s
android app, extension of stats
2026-08-10 14:03:34 +02:00

67 lines
1.3 KiB
Vue
Executable File

<template>
<div class="history-list">
<div class="panel-header" v-html="$t('history_title')"></div>
<div v-if="chatStore.historyResults.length === 0" class="panel-empty">
<p>{{ $t('history_empty') }}</p>
</div>
<div
v-for="item in chatStore.historyResults"
:key="item.userName"
class="history-item"
@click="selectUser(item.userName)"
>
<span class="panel-item-name">{{ item.userName }}</span>
<small v-if="item.lastMessage" class="panel-item-meta">
{{ formatTime(item.lastMessage.timestamp) }}
</small>
</div>
</div>
</template>
<script setup>
import { useChatStore } from '../stores/chat';
const chatStore = useChatStore();
function selectUser(userName) {
chatStore.requestConversation(userName);
}
function formatTime(timestamp) {
const date = new Date(timestamp);
return date.toLocaleString('de-DE');
}
</script>
<style scoped>
.panel-header {
margin-bottom: 16px;
}
.panel-empty {
color: #637067;
}
.history-item {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
border-radius: 10px;
}
.panel-item-name {
font-weight: 600;
color: #18201b;
}
.panel-item-meta {
white-space: nowrap;
font-size: 12px;
font-weight: 500;
color: #637067;
}
</style>