diff --git a/packages/flat-components/src/components/ChatPanel/index.tsx b/packages/flat-components/src/components/ChatPanel/index.tsx index ead87661f74..4cc19c489b7 100644 --- a/packages/flat-components/src/components/ChatPanel/index.tsx +++ b/packages/flat-components/src/components/ChatPanel/index.tsx @@ -6,7 +6,10 @@ import { useTranslate } from "@netless/flat-i18n"; import { ChatMessages, ChatMessagesProps } from "./ChatMessages"; import { ChatTabTitle, ChatTabTitleProps } from "./ChatTabTitle"; -export type ChatPanelProps = { totalUserCount?: number } & ChatTabTitleProps & +export type ChatPanelProps = { + totalUserCount?: number; + onClickTotalUsersCount?: () => void; +} & ChatTabTitleProps & Omit; export const ChatPanel = /* @__PURE__ */ observer(function ChatPanel(props) { @@ -19,7 +22,7 @@ export const ChatPanel = /* @__PURE__ */ observer(function ChatP {t("messages")} {props.totalUserCount && ( - + {t("total-users-count", { count: props.totalUserCount })} )} diff --git a/packages/flat-pages/src/components/ChatPanel/index.tsx b/packages/flat-pages/src/components/ChatPanel/index.tsx index 19175cbabef..629f62cda5b 100644 --- a/packages/flat-pages/src/components/ChatPanel/index.tsx +++ b/packages/flat-pages/src/components/ChatPanel/index.tsx @@ -23,6 +23,7 @@ export const ChatPanel = observer(function ChatPanel({ classRoom unreadCount={classRoomStore.users.handRaisingJoiners.length || null} userUUID={classRoomStore.userUUID} onBanChange={classRoomStore.onToggleBan} + onClickTotalUsersCount={() => classRoomStore.toggleUsersPanel(true)} onMessageSend={classRoomStore.onMessageSend} /> ); diff --git a/packages/flat-pages/src/components/UsersButton.tsx b/packages/flat-pages/src/components/UsersButton.tsx index 8fce99d8ad2..61ebaf297ed 100644 --- a/packages/flat-pages/src/components/UsersButton.tsx +++ b/packages/flat-pages/src/components/UsersButton.tsx @@ -1,7 +1,7 @@ import "./UsersButton.less"; // TODO: remove this component when multi sub window is done -import React, { useCallback, useEffect, useState } from "react"; +import React, { useCallback, useEffect } from "react"; import { Modal } from "antd"; import { observer } from "mobx-react-lite"; import { useTranslate } from "@netless/flat-i18n"; @@ -14,7 +14,6 @@ interface UsersButtonProps { export const UsersButton = observer(function UsersButton({ classroom }) { const t = useTranslate(); - const [open, setOpen] = useState(false); // not including teacher const users = useComputed(() => { @@ -87,16 +86,16 @@ export const UsersButton = observer(function UsersButton({ cla } title={t("users")} - onClick={() => setOpen(!open)} + onClick={() => classroom.toggleUsersPanel(!classroom.isUsersPanelVisible)} /> setOpen(false)} + onCancel={() => classroom.toggleUsersPanel(false)} > { + this.isUsersPanelVisible = visible; + }; + public onDrop = (file: File): void => { this.toggleCloudStoragePanel(true); const cloudStorage = this.whiteboardStore.cloudStorageStore;