thelounge/client/components/Channel.vue

57 lines
1.3 KiB
Vue
Raw Normal View History

<template>
2019-11-26 21:50:40 +01:00
<ChannelWrapper ref="wrapper" v-bind="$props">
<span class="name">{{ channel.name }}</span>
<span
v-if="channel.unread"
:class="{highlight: channel.highlight && !channel.muted}"
class="badge"
>{{ unreadCount }}</span
>
<template v-if="channel.type === 'channel'">
<span
v-if="channel.state === 0"
class="parted-channel-tooltip tooltipped tooltipped-w"
aria-label="Not currently joined"
>
<span class="parted-channel-icon" />
</span>
2019-08-03 21:03:45 +02:00
<span class="close-tooltip tooltipped tooltipped-w" aria-label="Leave">
<button class="close" aria-label="Leave" @click.stop="close" />
</span>
</template>
<template v-else>
2019-08-03 21:03:45 +02:00
<span class="close-tooltip tooltipped tooltipped-w" aria-label="Close">
<button class="close" aria-label="Close" @click.stop="close" />
</span>
</template>
</ChannelWrapper>
</template>
<script>
2019-11-16 18:24:03 +01:00
import roundBadgeNumber from "../js/helpers/roundBadgeNumber";
import ChannelWrapper from "./ChannelWrapper.vue";
2018-07-08 22:08:08 +02:00
export default {
name: "Channel",
components: {
ChannelWrapper,
},
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
},
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
},
},
};
</script>