prep visibility for multi-iframes

This commit is contained in:
Gigiaj 2025-05-02 17:04:11 -05:00
parent 8038c2ac8b
commit 7c6c1f53c0

View file

@ -3,6 +3,7 @@ import { Box } from 'folds';
import { useParams } from 'react-router-dom'; import { useParams } from 'react-router-dom';
import { useCallState } from './CallProvider'; import { useCallState } from './CallProvider';
import { PersistentCallContainer } from '../call/PersistentCallContainer'; import { PersistentCallContainer } from '../call/PersistentCallContainer';
import { useMatrixClient } from '../../hooks/useMatrixClient';
type ClientLayoutProps = { type ClientLayoutProps = {
nav: ReactNode; nav: ReactNode;
@ -11,10 +12,9 @@ type ClientLayoutProps = {
export function ClientLayout({ nav, children }: ClientLayoutProps) { export function ClientLayout({ nav, children }: ClientLayoutProps) {
const { activeCallRoomId } = useCallState(); const { activeCallRoomId } = useCallState();
const { roomIdOrAlias: viewedRoomId } = useParams(); const { roomIdOrAlias: viewedRoomId } = useParams();
const isViewingActiveCall = useMemo( const mx = useMatrixClient();
() => activeCallRoomId !== null && activeCallRoomId === viewedRoomId, const isCall = mx.getRoom(viewedRoomId)?.isCallRoom();
[activeCallRoomId, viewedRoomId]
);
return ( return (
<Box grow="Yes" direction="Row" style={{ height: '100vh', width: '100vw', overflow: 'hidden' }}> <Box grow="Yes" direction="Row" style={{ height: '100vh', width: '100vw', overflow: 'hidden' }}>
<Box shrink="No" className="nav-container-styles"> <Box shrink="No" className="nav-container-styles">
@ -25,7 +25,7 @@ export function ClientLayout({ nav, children }: ClientLayoutProps) {
<Box <Box
grow="Yes" grow="Yes"
style={{ style={{
display: isViewingActiveCall ? 'none' : 'flex', display: isCall ? 'none' : 'flex',
flexDirection: 'column', flexDirection: 'column',
width: '100%', width: '100%',
height: '100%', height: '100%',
@ -34,7 +34,7 @@ export function ClientLayout({ nav, children }: ClientLayoutProps) {
> >
{children} {children}
</Box> </Box>
<PersistentCallContainer isVisible={isViewingActiveCall} /> <PersistentCallContainer isVisible={isCall} viewedRoomId={viewedRoomId} />
</Box> </Box>
</Box>{' '} </Box>{' '}
</Box> </Box>