mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-06 23:30:28 +03:00
update client layout to handle active calls
This commit is contained in:
parent
c367c90a96
commit
b88da572a4
1 changed files with 31 additions and 4 deletions
|
|
@ -1,15 +1,42 @@
|
||||||
import React, { ReactNode } from 'react';
|
import React, { ReactNode, useMemo } from 'react';
|
||||||
import { Box } from 'folds';
|
import { Box } from 'folds';
|
||||||
|
import { useCallState } from './CallProvider';
|
||||||
|
import { useParams } from 'react-router-dom';
|
||||||
|
import { PersistentCallContainer } from '../call/PersistentCallContainer';
|
||||||
|
|
||||||
type ClientLayoutProps = {
|
type ClientLayoutProps = {
|
||||||
nav: ReactNode;
|
nav: ReactNode;
|
||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
};
|
};
|
||||||
export function ClientLayout({ nav, children }: ClientLayoutProps) {
|
export function ClientLayout({ nav, children }: ClientLayoutProps) {
|
||||||
|
const { activeCallRoomId } = useCallState();
|
||||||
|
const { roomIdOrAlias: viewedRoomId } = useParams();
|
||||||
|
const isViewingActiveCall = useMemo(
|
||||||
|
() => activeCallRoomId !== null && activeCallRoomId === viewedRoomId,
|
||||||
|
[activeCallRoomId, viewedRoomId]
|
||||||
|
);
|
||||||
return (
|
return (
|
||||||
<Box grow="Yes">
|
<Box grow="Yes" direction="Row" style={{ height: '100vh', width: '100vw', overflow: 'hidden' }}>
|
||||||
<Box shrink="No">{nav}</Box>
|
<Box shrink="No" className="nav-container-styles">
|
||||||
<Box grow="Yes">{children}</Box>
|
{nav}
|
||||||
|
</Box>
|
||||||
|
<Box grow="Yes" direction="Column" style={{ position: 'relative', overflowY: 'auto' }}>
|
||||||
|
<Box grow="Yes" style={{ position: 'relative' }}>
|
||||||
|
<Box
|
||||||
|
grow="Yes"
|
||||||
|
style={{
|
||||||
|
display: isViewingActiveCall ? 'none' : 'flex',
|
||||||
|
flexDirection: 'column',
|
||||||
|
width: '100%',
|
||||||
|
height: '100%',
|
||||||
|
}}
|
||||||
|
className="outlet-wrapper"
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</Box>
|
||||||
|
<PersistentCallContainer isVisible={isViewingActiveCall} />
|
||||||
|
</Box>
|
||||||
|
</Box>{' '}
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue