22/* eslint-disable react-hooks/exhaustive-deps */
33import "./MainRoomMenu.less" ;
44
5- import React , { FC , useContext , useMemo } from "react" ;
5+ import React , { FC , useContext } from "react" ;
66import { Col , Row } from "antd" ;
77import { Region } from "flat-components" ;
8- import { AILanguage , AIRole , AIScene , RoomType } from "@netless/flat-server-api" ;
8+ import { RoomType } from "@netless/flat-server-api" ;
99import { GlobalStoreContext , RoomStoreContext } from "../../components/StoreProvider" ;
1010import { RouteNameType , usePushHistory } from "../../utils/routes" ;
1111import { CreateRoomBox } from "./CreateRoomBox" ;
1212import { JoinRoomBox } from "./JoinRoomBox" ;
1313import { ScheduleRoomBox } from "./ScheduleRoomBox" ;
1414import { joinRoomHandler } from "../../utils/join-room-handler" ;
1515import { errorTips } from "flat-components" ;
16- import CreateAIRoomBox from "./CreateAIRoomBox" ;
16+ // import CreateAIRoomBox from "./CreateAIRoomBox";
1717export const MainRoomMenu : FC = ( ) => {
1818 const roomStore = useContext ( RoomStoreContext ) ;
1919 const globalStore = useContext ( GlobalStoreContext ) ;
@@ -27,27 +27,27 @@ export const MainRoomMenu: FC = () => {
2727 }
2828 } ;
2929
30- const AIRoomBox = useMemo ( ( ) => {
31- const isCnWeb = window . location . host . includes ( ".apprtc.cn" ) ;
32- if ( ! isCnWeb ) {
33- return < CreateAIRoomBox onCreateRoom = { createAIRoom } /> ;
34- }
35- return null ;
36- } , [ window . location . host ] ) ;
30+ // const AIRoomBox = useMemo(() => {
31+ // const isCnWeb = window.location.host.includes(".apprtc.cn");
32+ // if (!isCnWeb) {
33+ // return <CreateAIRoomBox onCreateRoom={createAIRoom} />;
34+ // }
35+ // return null;
36+ // }, [window.location.host]);
3737
3838 return (
3939 < div className = "main-room-menu-container" >
4040 < Row gutter = { 24 } >
41- < Col span = { 6 } >
41+ < Col span = { 8 } >
4242 < JoinRoomBox onJoinRoom = { onJoinRoom } />
4343 </ Col >
44- < Col span = { 6 } >
44+ < Col span = { 8 } >
4545 < CreateRoomBox onCreateRoom = { createOrdinaryRoom } />
4646 </ Col >
47- < Col span = { 6 } >
47+ < Col span = { 8 } >
4848 < ScheduleRoomBox />
4949 </ Col >
50- < Col span = { 6 } > { AIRoomBox } </ Col >
50+ { /* <Col span={6}>{AIRoomBox}</Col> */ }
5151 </ Row >
5252 </ div >
5353 ) ;
@@ -67,32 +67,6 @@ export const MainRoomMenu: FC = () => {
6767 pmi : ! ! pmi ,
6868 } ) ;
6969
70- await onJoinRoom ( roomUUID ) ;
71- } catch ( e ) {
72- errorTips ( e ) ;
73- }
74- }
75- async function createAIRoom (
76- title : string ,
77- type : RoomType ,
78- region : Region ,
79- role : AIRole ,
80- scene : AIScene ,
81- language : AILanguage ,
82- ) : Promise < void > {
83- try {
84- const roomUUID = await roomStore . createAIRoom ( {
85- title,
86- type,
87- beginTime : Date . now ( ) ,
88- region,
89- pmi : false ,
90- isAI : true ,
91- role,
92- scene,
93- language,
94- } ) ;
95-
9670 await onJoinRoom ( roomUUID ) ;
9771 } catch ( e ) {
9872 errorTips ( e ) ;
0 commit comments