2018-07-12 19:24:35 +00:00
|
|
|
<template>
|
|
|
|
<div
|
|
|
|
v-if="!network.isCollapsed || channel.highlight || channel.type === 'lobby' || (activeChannel && channel === activeChannel.channel)"
|
|
|
|
:class="[ channel.type, { active: activeChannel && channel === activeChannel.channel } ]"
|
2018-10-05 09:14:30 +00:00
|
|
|
:aria-label="getAriaLabel()"
|
|
|
|
:title="getAriaLabel()"
|
2018-07-12 19:24:35 +00:00
|
|
|
:data-id="channel.id"
|
|
|
|
:data-target="'#chan-' + channel.id"
|
|
|
|
:aria-controls="'#chan-' + channel.id"
|
|
|
|
:aria-selected="activeChannel && channel === activeChannel.channel"
|
|
|
|
class="chan"
|
2018-07-29 17:57:14 +00:00
|
|
|
role="tab">
|
2018-07-12 19:24:35 +00:00
|
|
|
<slot
|
|
|
|
:network="network"
|
|
|
|
:channel="channel"
|
2018-07-29 17:57:14 +00:00
|
|
|
:activeChannel="activeChannel" />
|
2018-07-12 19:24:35 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
name: "ChannelWrapper",
|
|
|
|
props: {
|
|
|
|
network: Object,
|
|
|
|
channel: Object,
|
|
|
|
activeChannel: Object,
|
|
|
|
},
|
2018-10-05 09:14:30 +00:00
|
|
|
methods: {
|
|
|
|
getAriaLabel() {
|
|
|
|
const extra = [];
|
|
|
|
|
|
|
|
if (this.channel.unread > 0) {
|
|
|
|
extra.push(`${this.channel.unread} unread`);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.channel.highlight > 0) {
|
|
|
|
extra.push(`${this.channel.highlight} mention`);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (extra.length > 0) {
|
|
|
|
return `${this.channel.name} (${extra.join(", ")})`;
|
|
|
|
}
|
|
|
|
|
|
|
|
return this.channel.name;
|
|
|
|
},
|
|
|
|
},
|
2018-07-12 19:24:35 +00:00
|
|
|
};
|
|
|
|
</script>
|