2018-07-06 18:15:15 +00:00
|
|
|
<template>
|
2022-06-19 00:25:21 +00:00
|
|
|
<!-- TODO: investigate -->
|
2019-11-26 20:50:40 +00:00
|
|
|
<ChannelWrapper ref="wrapper" v-bind="$props">
|
2018-10-05 09:14:30 +00:00
|
|
|
<span class="name">{{ channel.name }}</span>
|
2022-02-11 01:56:17 +00:00
|
|
|
<span
|
|
|
|
v-if="channel.unread"
|
|
|
|
:class="{highlight: channel.highlight && !channel.muted}"
|
|
|
|
class="badge"
|
|
|
|
>{{ unreadCount }}</span
|
|
|
|
>
|
2018-07-12 19:24:35 +00:00
|
|
|
<template v-if="channel.type === 'channel'">
|
2019-02-25 05:21:40 +00:00
|
|
|
<span
|
2019-02-26 06:26:45 +00:00
|
|
|
v-if="channel.state === 0"
|
2019-02-25 05:21:40 +00:00
|
|
|
class="parted-channel-tooltip tooltipped tooltipped-w"
|
2019-02-27 07:28:52 +00:00
|
|
|
aria-label="Not currently joined"
|
|
|
|
>
|
2019-02-25 05:21:40 +00:00
|
|
|
<span class="parted-channel-icon" />
|
|
|
|
</span>
|
2019-08-03 19:03:45 +00:00
|
|
|
<span class="close-tooltip tooltipped tooltipped-w" aria-label="Leave">
|
2019-11-11 13:31:24 +00:00
|
|
|
<button class="close" aria-label="Leave" @click.stop="close" />
|
2018-07-06 18:15:15 +00:00
|
|
|
</span>
|
|
|
|
</template>
|
|
|
|
<template v-else>
|
2019-08-03 19:03:45 +00:00
|
|
|
<span class="close-tooltip tooltipped tooltipped-w" aria-label="Close">
|
2019-11-11 13:31:24 +00:00
|
|
|
<button class="close" aria-label="Close" @click.stop="close" />
|
2018-07-12 19:24:35 +00:00
|
|
|
</span>
|
2018-07-06 18:15:15 +00:00
|
|
|
</template>
|
2018-07-12 19:24:35 +00:00
|
|
|
</ChannelWrapper>
|
2018-07-06 18:15:15 +00:00
|
|
|
</template>
|
|
|
|
|
2022-06-19 00:25:21 +00:00
|
|
|
<script lang="ts">
|
|
|
|
import {PropType, defineComponent, computed} from "vue";
|
2019-11-16 17:24:03 +00:00
|
|
|
import roundBadgeNumber from "../js/helpers/roundBadgeNumber";
|
2022-06-19 00:25:21 +00:00
|
|
|
import useCloseChannel from "../js/hooks/use-close-channel";
|
|
|
|
import {ClientChan, ClientNetwork} from "../js/types";
|
2018-07-12 19:24:35 +00:00
|
|
|
import ChannelWrapper from "./ChannelWrapper.vue";
|
2018-07-08 20:08:08 +00:00
|
|
|
|
2022-06-19 00:25:21 +00:00
|
|
|
export default defineComponent({
|
2018-07-06 18:15:15 +00:00
|
|
|
name: "Channel",
|
2018-07-12 19:24:35 +00:00
|
|
|
components: {
|
|
|
|
ChannelWrapper,
|
|
|
|
},
|
2018-07-06 18:15:15 +00:00
|
|
|
props: {
|
2022-06-19 00:25:21 +00:00
|
|
|
network: {
|
|
|
|
type: Object as PropType<ClientNetwork>,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
channel: {
|
|
|
|
type: Object as PropType<ClientChan>,
|
|
|
|
required: true,
|
|
|
|
},
|
2019-11-26 20:50:40 +00:00
|
|
|
active: Boolean,
|
|
|
|
isFiltering: Boolean,
|
2018-07-08 20:08:08 +00:00
|
|
|
},
|
2022-06-19 00:25:21 +00:00
|
|
|
setup(props) {
|
|
|
|
const unreadCount = computed(() => roundBadgeNumber(props.channel.unread));
|
|
|
|
const close = useCloseChannel(props.channel);
|
|
|
|
|
|
|
|
return {
|
|
|
|
unreadCount,
|
|
|
|
close,
|
|
|
|
};
|
2019-03-03 19:43:57 +00:00
|
|
|
},
|
2022-06-19 00:25:21 +00:00
|
|
|
});
|
2018-07-06 18:15:15 +00:00
|
|
|
</script>
|