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 { useCallState } from './CallProvider';
|
||||
import { useParams } from 'react-router-dom';
|
||||
import { PersistentCallContainer } from '../call/PersistentCallContainer';
|
||||
|
||||
type ClientLayoutProps = {
|
||||
nav: ReactNode;
|
||||
children: ReactNode;
|
||||
};
|
||||
export function ClientLayout({ nav, children }: ClientLayoutProps) {
|
||||
const { activeCallRoomId } = useCallState();
|
||||
const { roomIdOrAlias: viewedRoomId } = useParams();
|
||||
const isViewingActiveCall = useMemo(
|
||||
() => activeCallRoomId !== null && activeCallRoomId === viewedRoomId,
|
||||
[activeCallRoomId, viewedRoomId]
|
||||
);
|
||||
return (
|
||||
<Box grow="Yes">
|
||||
<Box shrink="No">{nav}</Box>
|
||||
<Box grow="Yes">{children}</Box>
|
||||
<Box grow="Yes" direction="Row" style={{ height: '100vh', width: '100vw', overflow: 'hidden' }}>
|
||||
<Box shrink="No" className="nav-container-styles">
|
||||
{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>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue