2018-07-06 18:15:15 +00:00
|
|
|
<template>
|
|
|
|
<div
|
2018-07-08 20:08:08 +00:00
|
|
|
v-if="!network.isCollapsed || channel.highlight || channel.type === 'lobby'"
|
|
|
|
:class="[ channel.type, { active: activeChannel && channel === activeChannel.channel } ]"
|
2018-07-06 18:15:15 +00:00
|
|
|
:aria-label="channel.name"
|
|
|
|
:title="channel.name"
|
|
|
|
:data-id="channel.id"
|
|
|
|
:data-target="'#chan-' + channel.id"
|
|
|
|
:aria-controls="'#chan-' + channel.id"
|
2018-07-08 20:08:08 +00:00
|
|
|
:aria-selected="activeChannel && channel === activeChannel.channel"
|
2018-07-06 18:15:15 +00:00
|
|
|
class="chan"
|
|
|
|
role="tab"
|
|
|
|
>
|
|
|
|
<template v-if="channel.type === 'lobby'">
|
|
|
|
<button
|
2018-07-08 08:54:35 +00:00
|
|
|
v-if="network.channels.length > 1"
|
2018-07-06 18:15:15 +00:00
|
|
|
:aria-controls="'network-' + network.uuid"
|
2018-07-08 20:08:08 +00:00
|
|
|
:aria-label="getExpandLabel(network)"
|
|
|
|
:aria-expanded="!network.isCollapsed"
|
2018-07-06 18:15:15 +00:00
|
|
|
class="collapse-network"
|
2018-07-08 20:08:08 +00:00
|
|
|
@click.prevent="onCollapseClick"
|
2018-07-08 08:54:35 +00:00
|
|
|
>
|
2018-07-06 18:15:15 +00:00
|
|
|
<span class="collapse-network-icon"/>
|
|
|
|
</button>
|
2018-07-08 08:54:35 +00:00
|
|
|
<span
|
|
|
|
v-else
|
|
|
|
class="collapse-network"/>
|
2018-07-06 18:15:15 +00:00
|
|
|
<div class="lobby-wrap">
|
|
|
|
<span
|
|
|
|
:title="channel.name"
|
|
|
|
class="name">{{ channel.name }}</span>
|
|
|
|
<span
|
|
|
|
class="not-secure-tooltip tooltipped tooltipped-w"
|
|
|
|
aria-label="Insecure connection">
|
|
|
|
<span class="not-secure-icon"/>
|
|
|
|
</span>
|
|
|
|
<span
|
|
|
|
class="not-connected-tooltip tooltipped tooltipped-w"
|
|
|
|
aria-label="Disconnected">
|
|
|
|
<span class="not-connected-icon"/>
|
|
|
|
</span>
|
|
|
|
<span
|
|
|
|
v-if="channel.unread"
|
|
|
|
:class="{ highlight: channel.highlight }"
|
|
|
|
class="badge">{{ channel.unread | roundBadgeNumber }}</span>
|
|
|
|
</div>
|
|
|
|
<span
|
2018-07-12 19:06:17 +00:00
|
|
|
:aria-label="joinChannelLabel"
|
|
|
|
class="add-channel-tooltip tooltipped tooltipped-w tooltipped-no-touch">
|
2018-07-06 18:15:15 +00:00
|
|
|
<button
|
2018-07-12 19:06:17 +00:00
|
|
|
:class="['add-channel', { opened: isJoinChannelShown }]"
|
2018-07-06 18:15:15 +00:00
|
|
|
:aria-controls="'join-channel-' + channel.id"
|
2018-07-12 19:06:17 +00:00
|
|
|
:aria-label="joinChannelLabel"
|
|
|
|
@click.stop="$emit('toggleJoinChannel')"/>
|
2018-07-06 18:15:15 +00:00
|
|
|
</span>
|
|
|
|
</template>
|
|
|
|
<template v-else>
|
|
|
|
<span
|
|
|
|
:title="channel.name"
|
|
|
|
class="name">{{ channel.name }}</span>
|
|
|
|
<span
|
|
|
|
v-if="channel.unread"
|
|
|
|
:class="{ highlight: channel.highlight }"
|
|
|
|
class="badge">{{ channel.unread | roundBadgeNumber }}</span>
|
|
|
|
<template v-if="channel.type === 'channel'">
|
|
|
|
<span
|
|
|
|
class="close-tooltip tooltipped tooltipped-w"
|
|
|
|
aria-label="Leave">
|
|
|
|
<button
|
|
|
|
class="close"
|
|
|
|
aria-label="Leave"/>
|
|
|
|
</span>
|
|
|
|
</template>
|
|
|
|
<template v-else>
|
|
|
|
<span
|
|
|
|
class="close-tooltip tooltipped tooltipped-w"
|
|
|
|
aria-label="Close">
|
|
|
|
<button
|
|
|
|
class="close"
|
|
|
|
aria-label="Close"/>
|
|
|
|
</span>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2018-07-08 20:08:08 +00:00
|
|
|
const storage = require("../js/localStorage");
|
|
|
|
|
2018-07-06 18:15:15 +00:00
|
|
|
export default {
|
|
|
|
name: "Channel",
|
|
|
|
props: {
|
|
|
|
activeChannel: Object,
|
|
|
|
network: Object,
|
|
|
|
channel: Object,
|
2018-07-12 19:06:17 +00:00
|
|
|
isJoinChannelShown: Boolean,
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
joinChannelLabel() {
|
|
|
|
return this.isJoinChannelShown ? "Cancel" : "Join a channel…";
|
|
|
|
},
|
2018-07-06 18:15:15 +00:00
|
|
|
},
|
2018-07-08 20:08:08 +00:00
|
|
|
methods: {
|
|
|
|
onCollapseClick() {
|
|
|
|
const networks = new Set(JSON.parse(storage.get("thelounge.networks.collapsed")));
|
|
|
|
this.network.isCollapsed = !this.network.isCollapsed;
|
|
|
|
|
|
|
|
if (this.network.isCollapsed) {
|
|
|
|
networks.add(this.network.uuid);
|
|
|
|
} else {
|
|
|
|
networks.delete(this.network.uuid);
|
|
|
|
}
|
|
|
|
|
|
|
|
storage.set("thelounge.networks.collapsed", JSON.stringify([...networks]));
|
|
|
|
},
|
|
|
|
getExpandLabel(network) {
|
|
|
|
return network.isCollapsed ? "Expand" : "Collapse";
|
|
|
|
},
|
|
|
|
},
|
2018-07-06 18:15:15 +00:00
|
|
|
};
|
|
|
|
</script>
|