keanu-weblite/src/components/RoomList.vue

46 lines
1.2 KiB
Vue
Raw Normal View History

2020-11-09 10:26:56 +01:00
<template>
<v-list dense class="room-list">
2020-11-09 10:26:56 +01:00
<v-subheader>ROOMS</v-subheader>
<v-list-item-group v-model="currentRoomId" color="primary">
<v-list-item v-for="room in $matrix.rooms" :key="room.roomId" :value="room.roomId">
<v-list-item-avatar size="40" color="#e0e0e0">
<v-img :src="room.avatar" />
</v-list-item-avatar>
<div class="room-list-notification-count">{{ notificationCount(room) }}</div>
2020-11-09 10:26:56 +01:00
<v-list-item-content>
2020-11-09 15:55:17 +01:00
<v-list-item-title>{{ room.summary.info.title }}</v-list-item-title>
<v-list-item-subtitle>{{ room.topic }}</v-list-item-subtitle>
2020-11-09 10:26:56 +01:00
</v-list-item-content>
</v-list-item>
</v-list-item-group>
</v-list>
</template>
<script>
2021-02-01 16:04:12 +01:00
import util from "../plugins/utils";
2020-11-09 10:26:56 +01:00
export default {
name: "RoomList",
data: () => ({
currentRoomId: null,
2020-11-09 10:26:56 +01:00
}),
methods: {
notificationCount(room) {
return room.getUnreadNotificationCount('total') || 0;
}
},
2020-11-09 10:26:56 +01:00
watch: {
currentRoomId() {
2020-11-19 17:11:11 +01:00
this.$emit("close");
2021-02-01 16:04:12 +01:00
this.$navigation.push({name: 'Chat', params: { roomId: util.sanitizeRoomId(this.currentRoomId) }}, -1);
2020-11-09 10:26:56 +01:00
},
},
};
</script>
<style lang="scss">
@import "@/assets/css/chat.scss";
</style>