thelounge/client/components/NetworkLobby.vue

85 lines
2.2 KiB
Vue
Raw Normal View History

<template>
2019-11-26 20:50:40 +00:00
<ChannelWrapper v-bind="$props" :channel="channel">
<button
v-if="network.channels.length > 1"
:aria-controls="'network-' + network.uuid"
:aria-label="getExpandLabel(network)"
:aria-expanded="!network.isCollapsed"
class="collapse-network"
@click.stop="onCollapseClick"
2019-07-17 09:33:59 +00:00
>
<span class="collapse-network-icon" />
</button>
<span v-else class="collapse-network" />
<div class="lobby-wrap">
2019-07-17 09:33:59 +00:00
<span :title="channel.name" class="name">{{ channel.name }}</span>
<span
v-if="network.status.connected && !network.status.secure"
class="not-secure-tooltip tooltipped tooltipped-w"
aria-label="Insecure connection"
>
2018-07-29 17:57:14 +00:00
<span class="not-secure-icon" />
</span>
<span
v-if="!network.status.connected"
class="not-connected-tooltip tooltipped tooltipped-w"
aria-label="Disconnected"
>
2018-07-29 17:57:14 +00:00
<span class="not-connected-icon" />
</span>
2019-07-17 09:33:59 +00:00
<span v-if="channel.unread" :class="{highlight: channel.highlight}" class="badge">{{
unreadCount
2019-07-17 09:33:59 +00:00
}}</span>
</div>
<span
:aria-label="joinChannelLabel"
class="add-channel-tooltip tooltipped tooltipped-w tooltipped-no-touch"
>
<button
2019-07-17 09:33:59 +00:00
:class="['add-channel', {opened: isJoinChannelShown}]"
:aria-controls="'join-channel-' + channel.id"
:aria-label="joinChannelLabel"
@click.stop="$emit('toggle-join-channel')"
/>
</span>
</ChannelWrapper>
</template>
<script>
import collapseNetwork from "../js/helpers/collapseNetwork";
2019-11-16 17:24:03 +00:00
import roundBadgeNumber from "../js/helpers/roundBadgeNumber";
import ChannelWrapper from "./ChannelWrapper.vue";
export default {
name: "Channel",
components: {
ChannelWrapper,
},
props: {
network: Object,
isJoinChannelShown: Boolean,
2019-11-26 20:50:40 +00:00
active: Boolean,
isFiltering: Boolean,
},
computed: {
channel() {
return this.network.channels[0];
},
joinChannelLabel() {
return this.isJoinChannelShown ? "Cancel" : "Join a channel…";
},
unreadCount() {
return roundBadgeNumber(this.channel.unread);
},
},
methods: {
onCollapseClick() {
collapseNetwork(this.network, !this.network.isCollapsed);
},
getExpandLabel(network) {
return network.isCollapsed ? "Expand" : "Collapse";
},
},
};
</script>