2018-07-12 15:24:35 -04:00
|
|
|
<template>
|
|
|
|
<div
|
|
|
|
v-if="!network.isCollapsed || channel.highlight || channel.type === 'lobby' || (activeChannel && channel === activeChannel.channel)"
|
2019-02-07 02:24:53 -05:00
|
|
|
:class="[
|
2019-03-19 09:11:44 -04:00
|
|
|
'chan',
|
2019-02-07 02:24:53 -05:00
|
|
|
channel.type,
|
|
|
|
{ active: activeChannel && channel === activeChannel.channel },
|
2019-02-25 00:21:40 -05:00
|
|
|
{ 'parted-channel': channel.type === 'channel' && channel.state === 0 }
|
2019-02-07 02:24:53 -05:00
|
|
|
]"
|
2018-10-05 05:14:30 -04:00
|
|
|
:aria-label="getAriaLabel()"
|
|
|
|
:title="getAriaLabel()"
|
2018-07-12 15:24:35 -04:00
|
|
|
:data-id="channel.id"
|
|
|
|
:data-target="'#chan-' + channel.id"
|
2019-01-02 07:09:50 -05:00
|
|
|
:data-name="channel.name"
|
2018-07-12 15:24:35 -04:00
|
|
|
:aria-controls="'#chan-' + channel.id"
|
|
|
|
:aria-selected="activeChannel && channel === activeChannel.channel"
|
2019-02-25 00:38:13 -05:00
|
|
|
role="tab"
|
|
|
|
>
|
2018-07-12 15:24:35 -04:00
|
|
|
<slot
|
|
|
|
:network="network"
|
|
|
|
:channel="channel"
|
2019-02-25 00:38:13 -05:00
|
|
|
:activeChannel="activeChannel"
|
|
|
|
/>
|
2018-07-12 15:24:35 -04:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
name: "ChannelWrapper",
|
|
|
|
props: {
|
|
|
|
network: Object,
|
|
|
|
channel: Object,
|
|
|
|
activeChannel: Object,
|
|
|
|
},
|
2018-10-05 05:14:30 -04: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 15:24:35 -04:00
|
|
|
};
|
|
|
|
</script>
|