UNPKG

roomkit-web-vue3

Version:

<h1 align="center"> TUIRoomKit</h1> Conference (TUIRoomKit) is a product suitable for multi-person audio and video conversation scenarios such as business meetings, webinars, and online education. By integrating this product, you can add room management,

74 lines (73 loc) 2.85 kB
import { defineComponent, unref, openBlock, createElementBlock, createVNode, withCtx, createElementVNode, createCommentVNode } from "vue"; import _imports_0 from "../../assets/imgs/icon-chat.png.mjs"; import IconButton from "../common/base/IconButton.vue.mjs"; import ChatIcon from "../common/icons/ChatIcon.vue.mjs"; import { useBasicStore } from "../../stores/basic.mjs"; import { useChatStore } from "../../stores/chat.mjs"; import { storeToRefs } from "pinia"; import { useI18n } from "../../locales/index.mjs"; import TuiBadge from "../common/base/Badge.vue.mjs"; import "../../services/main.mjs"; import { roomService } from "../../services/roomService.mjs"; import "@tencentcloud/tuiroom-engine-js"; import "../../utils/environment.mjs"; import "mitt"; import "../../services/manager/roomActionManager.mjs"; import "@tencentcloud/tui-core"; import { MetricsKey } from "../../services/manager/dataReportManager.mjs"; const _hoisted_1 = { key: 0, class: "chat-control-container" }; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "ChatControl", setup(__props) { const { t } = useI18n(); const chatControlConfig = roomService.getComponentConfig("ChatControl"); const basicStore = useBasicStore(); const chatStore = useChatStore(); const { sidebarName } = storeToRefs(basicStore); async function toggleChatSidebar() { if (basicStore.isSidebarOpen && basicStore.sidebarName === "chat") { basicStore.setSidebarOpenStatus(false); basicStore.setSidebarName(""); return; } basicStore.setSidebarOpenStatus(true); basicStore.setSidebarName("chat"); chatStore.updateUnReadCount(0); roomService.dataReportManager.reportCount(MetricsKey.openChat); roomService.trackingManager.sendMessage("experience-chat"); } return (_ctx, _cache) => { return unref(chatControlConfig).visible ? (openBlock(), createElementBlock("div", _hoisted_1, [ createVNode(TuiBadge, { hidden: unref(chatStore).unReadCount === 0, value: unref(chatStore).unReadCount, max: 10 }, { default: withCtx(() => [ createVNode(IconButton, { title: unref(t)("Chat"), icon: ChatIcon, "is-active": unref(sidebarName) === "chat", onClickIcon: toggleChatSidebar }, { default: withCtx(() => _cache[0] || (_cache[0] = [ createElementVNode("img", { src: _imports_0, style: { "width": "24px", "height": "24px" } }, null, -1) ])), _: 1 }, 8, ["title", "is-active"]) ]), _: 1 }, 8, ["hidden", "value"]) ])) : createCommentVNode("", true); }; } }); export { _sfc_main as default };