Rename and clean up

This commit is contained in:
Gigiaj 2025-05-22 20:02:13 -05:00
parent a81492c5b2
commit 023a23d87c
2 changed files with 15 additions and 11 deletions

View file

@ -3,17 +3,16 @@ import { logger } from 'matrix-js-sdk/lib/logger';
import { ClientWidgetApi } from 'matrix-widget-api'; import { ClientWidgetApi } from 'matrix-widget-api';
import { Box } from 'folds'; import { Box } from 'folds';
import { useParams } from 'react-router-dom'; import { useParams } from 'react-router-dom';
import { useCallState } from '../client/CallProvider'; import { useCallState } from './CallProvider';
import { import {
createVirtualWidget, createVirtualWidget,
SmallWidget, SmallWidget,
getWidgetData, getWidgetData,
getWidgetUrl, getWidgetUrl,
} from '../../features/room/SmallWidget'; } from '../../../features/room/SmallWidget';
import { useMatrixClient } from '../../hooks/useMatrixClient'; import { useMatrixClient } from '../../../hooks/useMatrixClient';
import { useSelectedRoom } from '../../hooks/router/useSelectedRoom'; import { useClientConfig } from '../../../hooks/useClientConfig';
import { useClientConfig } from '../../hooks/useClientConfig'; import { ScreenSize, useScreenSizeContext } from '../../../hooks/useScreenSize';
import { ScreenSize, useScreenSizeContext } from '../../hooks/useScreenSize';
interface PersistentCallContainerProps { interface PersistentCallContainerProps {
children: ReactNode; children: ReactNode;
@ -48,16 +47,22 @@ export function PersistentCallContainer({ children }: PersistentCallContainerPro
() => activeCallRoomId !== null && activeCallRoomId === viewedRoomId, () => activeCallRoomId !== null && activeCallRoomId === viewedRoomId,
[activeCallRoomId, viewedRoomId] [activeCallRoomId, viewedRoomId]
); );
/* eslint-disable no-param-reassign */
const setupWidget = useCallback( const setupWidget = useCallback(
(widgetApiRef, smallWidgetRef, iframeRef, skipLobby) => { (
widgetApiRef: { current: ClientWidgetApi },
smallWidgetRef: { current: SmallWidget },
iframeRef: { current: { src: string } },
skipLobby: { toString: () => any }
) => {
if (mx?.getUserId()) { if (mx?.getUserId()) {
if ( if (
(activeCallRoomId !== viewedCallRoomId && isCallActive) || (activeCallRoomId !== viewedCallRoomId && isCallActive) ||
(activeCallRoomId && !isCallActive) || (activeCallRoomId && !isCallActive) ||
(!activeCallRoomId && viewedCallRoomId && !isCallActive) (!activeCallRoomId && viewedCallRoomId && !isCallActive)
) { ) {
const roomIdToSet = skipLobby ? activeCallRoomId : viewedCallRoomId; const roomIdToSet = (skipLobby ? activeCallRoomId : viewedCallRoomId) ?? '';
if ( if (
roomIdToSet && roomIdToSet &&
(roomIdToSet === primarySmallWidgetRef?.current?.roomId || (roomIdToSet === primarySmallWidgetRef?.current?.roomId ||
@ -108,7 +113,6 @@ export function PersistentCallContainer({ children }: PersistentCallContainerPro
roomIdToSet roomIdToSet
); );
// logger.error(`PersistentCallContainer: Creating new SmallWidget/API for ${roomIdToSet}`);
const smallWidget = new SmallWidget(app); const smallWidget = new SmallWidget(app);
smallWidgetRef.current = smallWidget; smallWidgetRef.current = smallWidget;
@ -197,7 +201,7 @@ export function PersistentCallContainer({ children }: PersistentCallContainerPro
height: '100%', height: '100%',
border: 'none', border: 'none',
}} }}
title={`Persistent Element Call`} title="Persistent Element Call"
sandbox="allow-forms allow-scripts allow-same-origin allow-popups allow-modals allow-downloads" sandbox="allow-forms allow-scripts allow-same-origin allow-popups allow-modals allow-downloads"
allow="microphone; camera; display-capture; autoplay; clipboard-write;" allow="microphone; camera; display-capture; autoplay; clipboard-write;"
src="about:blank" src="about:blank"
@ -213,7 +217,7 @@ export function PersistentCallContainer({ children }: PersistentCallContainerPro
border: 'none', border: 'none',
display: !isPrimaryIframe || isViewingActiveCall ? 'flex' : 'none', display: !isPrimaryIframe || isViewingActiveCall ? 'flex' : 'none',
}} }}
title={`Persistent Element Call`} title="Persistent Element Call"
sandbox="allow-forms allow-scripts allow-same-origin allow-popups allow-modals allow-downloads" sandbox="allow-forms allow-scripts allow-same-origin allow-popups allow-modals allow-downloads"
allow="microphone; camera; display-capture; autoplay; clipboard-write;" allow="microphone; camera; display-capture; autoplay; clipboard-write;"
src="about:blank" src="about:blank"