Skip to content

Commit bfbb46f

Browse files
fix: wire chat toggle and ready composer in LiveKit conference window
- Add showChat state to LiveKitConferenceEmbeddedPage and let MediaCallRoomSection toggle it. - Pass onClose to ConferenceChat so the header close button also hides the chat panel. - Open the room in LegacyRoomManager from ConferenceRoom so RoomBody's composer becomes ready. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent 9e881c1 commit bfbb46f

2 files changed

Lines changed: 22 additions & 5 deletions

File tree

apps/meteor/client/views/conference/ConferenceRoom.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ import { LayoutContext, useLayout, useStream, useUserId } from '@rocket.chat/ui-
44
import type { ReactElement } from 'react';
55
import { lazy, Suspense, useEffect, useMemo } from 'react';
66

7+
import { LegacyRoomManager } from '../../../app/ui-utils/client';
78
import { SubscriptionsCachedStore } from '../../cachedStores';
9+
import { Rooms } from '../../stores';
810
import RoomSkeleton from '../room/RoomSkeleton';
911

1012
const RoomProvider = lazy(() => import('../room/providers/RoomProvider'));
@@ -19,6 +21,7 @@ const ConferenceRoom = ({ rid }: ConferenceRoomProps): ReactElement => {
1921
const subscribeToNotifyUser = useStream('notify-user');
2022
const layoutContext = useLayout();
2123
const layoutContextEmbedded = useMemo(() => ({ ...layoutContext, isEmbedded: true }), [layoutContext]);
24+
const room = Rooms.use((state) => state.get(rid));
2225

2326
useEffect(() => {
2427
if (!uid) {
@@ -34,6 +37,14 @@ const ConferenceRoom = ({ rid }: ConferenceRoomProps): ReactElement => {
3437
});
3538
}, [rid, subscribeToNotifyUser, uid]);
3639

40+
useEffect(() => {
41+
if (!room) {
42+
return;
43+
}
44+
45+
LegacyRoomManager.open({ typeName: room.t + room.name, rid: room._id });
46+
}, [room]);
47+
3748
return (
3849
<LayoutContext.Provider value={layoutContextEmbedded}>
3950
<Box display='flex' w='full' h='full'>

apps/meteor/client/views/conference/LiveKitConferenceEmbeddedPage.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Box } from '@rocket.chat/fuselage';
33
import { useUserDisplayName } from '@rocket.chat/ui-client';
44
import { useRouteParameter, useSearchParameter, useSetModal, useUser, useUserAvatarPath } from '@rocket.chat/ui-contexts';
55
import { MediaCallRoomSection, useMediaCallView } from '@rocket.chat/ui-voip';
6-
import { useEffect, useMemo, useRef, useState } from 'react';
6+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
77

88
import ConferenceChat from './ConferenceChat';
99
import ConferenceDisconnectedModal from './ConferenceDisconnectedModal';
@@ -40,6 +40,10 @@ const LiveKitConferenceEmbeddedPage = () => {
4040
const wasConnected = useRef(false);
4141
const hasJoined = useRef(false);
4242

43+
const [showChat, setShowChat] = useState(true);
44+
const toggleChat = useCallback(() => setShowChat((prev) => !prev), []);
45+
const closeChat = useCallback(() => setShowChat(false), []);
46+
4347
useEffect(() => {
4448
if (sessionState.state === 'ongoing') {
4549
wasConnected.current = true;
@@ -107,11 +111,13 @@ const LiveKitConferenceEmbeddedPage = () => {
107111

108112
return (
109113
<Box bg='surface-light' w='full' h='full' display='flex' overflow='hidden'>
110-
<Box display='flex' flexDirection='column' flexShrink={0} width={400} h='full' borderInlineEndWidth={1} borderColor='stroke-light'>
111-
<ConferenceChat rid={room.rid} loading={room.loading} />
112-
</Box>
114+
{showChat && (
115+
<Box display='flex' flexDirection='column' flexShrink={0} width={400} h='full' borderInlineEndWidth={1} borderColor='stroke-light'>
116+
<ConferenceChat rid={room.rid} loading={room.loading} onClose={closeChat} />
117+
</Box>
118+
)}
113119
<Box flexGrow={1} display='flex' flexDirection='column' position='relative' minWidth={0} minHeight={0}>
114-
<MediaCallRoomSection showChat={false} onToggleChat={() => undefined} user={ownUser} hideChatToggle />
120+
<MediaCallRoomSection showChat={showChat} onToggleChat={toggleChat} user={ownUser} />
115121
</Box>
116122
</Box>
117123
);

0 commit comments

Comments
 (0)