2018-07-06 20:15:15 +02:00
|
|
|
<template>
|
2019-11-26 21:50:40 +01:00
|
|
|
<ChannelWrapper ref="wrapper" v-bind="$props">
|
2018-10-05 11:14:30 +02:00
|
|
|
<span class="name">{{ channel.name }}</span>
|
2019-07-17 11:33:59 +02:00
|
|
|
<span v-if="channel.unread" :class="{highlight: channel.highlight}" class="badge">{{
|
2019-11-05 11:36:44 +01:00
|
|
|
unreadCount
|
2019-07-17 11:33:59 +02:00
|
|
|
}}</span>
|
2018-07-12 21:24:35 +02:00
|
|
|
<template v-if="channel.type === 'channel'">
|
2019-02-25 06:21:40 +01:00
|
|
|
<span
|
2019-02-26 07:26:45 +01:00
|
|
|
v-if="channel.state === 0"
|
2019-02-25 06:21:40 +01:00
|
|
|
class="parted-channel-tooltip tooltipped tooltipped-w"
|
2019-02-27 08:28:52 +01:00
|
|
|
aria-label="Not currently joined"
|
|
|
|
>
|
2019-02-25 06:21:40 +01:00
|
|
|
<span class="parted-channel-icon" />
|
|
|
|
</span>
|
2019-08-03 21:03:45 +02:00
|
|
|
<span class="close-tooltip tooltipped tooltipped-w" aria-label="Leave">
|
2019-11-11 14:31:24 +01:00
|
|
|
<button class="close" aria-label="Leave" @click.stop="close" />
|
2018-07-06 20:15:15 +02:00
|
|
|
</span>
|
|
|
|
</template>
|
|
|
|
<template v-else>
|
2019-08-03 21:03:45 +02:00
|
|
|
<span class="close-tooltip tooltipped tooltipped-w" aria-label="Close">
|
2019-11-11 14:31:24 +01:00
|
|
|
<button class="close" aria-label="Close" @click.stop="close" />
|
2018-07-12 21:24:35 +02:00
|
|
|
</span>
|
2018-07-06 20:15:15 +02:00
|
|
|
</template>
|
2018-07-12 21:24:35 +02:00
|
|
|
</ChannelWrapper>
|
2018-07-06 20:15:15 +02:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2019-11-16 18:24:03 +01:00
|
|
|
import roundBadgeNumber from "../js/helpers/roundBadgeNumber";
|
2018-07-12 21:24:35 +02:00
|
|
|
import ChannelWrapper from "./ChannelWrapper.vue";
|
2018-07-08 22:08:08 +02:00
|
|
|
|
2018-07-06 20:15:15 +02:00
|
|
|
export default {
|
|
|
|
name: "Channel",
|
2018-07-12 21:24:35 +02:00
|
|
|
components: {
|
|
|
|
ChannelWrapper,
|
|
|
|
},
|
2018-07-06 20:15:15 +02:00
|
|
|
props: {
|
|
|
|
network: Object,
|
|
|
|
channel: Object,
|
2019-11-26 21:50:40 +01:00
|
|
|
active: Boolean,
|
|
|
|
isFiltering: Boolean,
|
2018-07-08 22:08:08 +02:00
|
|
|
},
|
2019-11-05 11:36:44 +01:00
|
|
|
computed: {
|
|
|
|
unreadCount() {
|
|
|
|
return roundBadgeNumber(this.channel.unread);
|
|
|
|
},
|
|
|
|
},
|
2019-03-03 20:43:57 +01:00
|
|
|
methods: {
|
|
|
|
close() {
|
2019-11-23 17:44:23 +01:00
|
|
|
this.$root.closeChannel(this.channel);
|
2019-03-03 20:43:57 +01:00
|
|
|
},
|
|
|
|
},
|
2018-07-06 20:15:15 +02:00
|
|
|
};
|
|
|
|
</script>
|