UNPKG

@tencentcloud/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,

69 lines (68 loc) 2.61 kB
import { defineComponent, createElementBlock, createCommentVNode, unref, openBlock, createVNode, withCtx } from "vue"; import IconButton from "../common/base/IconButton.vue.mjs"; import { IconChat } from "@tencentcloud/uikit-base-component-vue3"; 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"), "is-active": unref(sidebarName) === "chat", onClickIcon: toggleChatSidebar }, { default: withCtx(() => [ createVNode(unref(IconChat), { size: "24" }) ]), _: 1 }, 8, ["title", "is-active"]) ]), _: 1 }, 8, ["hidden", "value"]) ])) : createCommentVNode("", true); }; } }); export { _sfc_main as default };