diff --git a/src/app/pages/call/PersistentCallContainer.tsx b/src/app/pages/call/PersistentCallContainer.tsx index 55cddbf1..c958cb12 100644 --- a/src/app/pages/call/PersistentCallContainer.tsx +++ b/src/app/pages/call/PersistentCallContainer.tsx @@ -15,9 +15,11 @@ import { Page, PageRoot } from '../../components/page'; import { RouteSpaceProvider, Space, SpaceRouteRoomProvider } from '../client/space'; import { MobileFriendlyPageNav } from '../MobileFriendly'; import { SPACE_PATH } from '../paths'; -import { PowerLevelsContextProvider } from '../../hooks/usePowerLevels'; +import { PowerLevelsContextProvider, usePowerLevels } from '../../hooks/usePowerLevels'; import { useSelectedRoom } from '../../hooks/router/useSelectedRoom'; import { useClientConfig } from '../../hooks/useClientConfig'; +import { RoomView } from '../../features/room/RoomView'; +import { useParams } from 'react-router-dom'; interface PersistentCallContainerProps { isVisible: boolean; @@ -25,9 +27,12 @@ interface PersistentCallContainerProps { export function PersistentCallContainer({ isVisible }: PersistentCallContainerProps) { const { activeCallRoomId, setActiveCallRoomId, registerActiveTransport } = useCallState(); + const { eventId } = useParams(); const mx = useMatrixClient(); - const room = useSelectedRoom(); + const roomId = useSelectedRoom(); const clientConfig = useClientConfig(); + const room = mx.getRoom(roomId); + const powerLevels = usePowerLevels(room ?? null); logger.info(room); @@ -59,12 +64,12 @@ export function PersistentCallContainer({ isVisible }: PersistentCallContainerPr } widgetApiRef.current = null; smallWidgetRef.current = null; - iframeRef.current.src = 'about:blank'; + if (iframeRef.current) iframeRef.current.src = 'about:blank'; }; if (activeCallRoomId && mx?.getUserId()) { if (cleanupRoomId !== activeCallRoomId) { - const newUrl = getWidgetUrl(mx, room, clientConfig.elementCallUrl ?? ''); + const newUrl = getWidgetUrl(mx, roomId, clientConfig.elementCallUrl ?? ''); if (iframeRef.current && iframeRef.current.src !== newUrl.toString()) { logger.info( @@ -140,7 +145,7 @@ export function PersistentCallContainer({ isVisible }: PersistentCallContainerPr return ( - {activeCallRoomId && room && ( + {activeCallRoomId && roomId && ( - {activeCallRoomId && room && ( + {activeCallRoomId && roomId && ( - + @@ -195,6 +200,17 @@ export function PersistentCallContainer({ isVisible }: PersistentCallContainerPr /> + + {activeCallRoomId && roomId !== null && ( + + + + + + + + )} + );