mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-15 11:40:29 +03:00
re-add mobile chat handling
This commit is contained in:
parent
1cdc0680e8
commit
9ae7c318ab
1 changed files with 7 additions and 3 deletions
|
|
@ -5,6 +5,7 @@ import { Box } from 'folds';
|
||||||
import { RoomViewHeader } from './RoomViewHeader';
|
import { RoomViewHeader } from './RoomViewHeader';
|
||||||
import { useCallState } from '../../pages/client/CallProvider';
|
import { useCallState } from '../../pages/client/CallProvider';
|
||||||
import { RefContext } from '../../pages/call/PersistentCallContainer';
|
import { RefContext } from '../../pages/call/PersistentCallContainer';
|
||||||
|
import { ScreenSize, useScreenSizeContext } from '../../hooks/useScreenSize';
|
||||||
|
|
||||||
function debounce<F extends (...args: any[]) => any>(func: F, waitFor: number) {
|
function debounce<F extends (...args: any[]) => any>(func: F, waitFor: number) {
|
||||||
let timeoutId: ReturnType<typeof setTimeout> | null = null;
|
let timeoutId: ReturnType<typeof setTimeout> | null = null;
|
||||||
|
|
@ -39,12 +40,15 @@ export function CallView({ room, eventId }: { room: Room; eventId?: string }) {
|
||||||
const iframeHostRef = useRef<HTMLDivElement>(null);
|
const iframeHostRef = useRef<HTMLDivElement>(null);
|
||||||
|
|
||||||
const originalIframeStylesRef = useRef<OriginalStyles | null>(null);
|
const originalIframeStylesRef = useRef<OriginalStyles | null>(null);
|
||||||
const { activeCallRoomId, isPrimaryIframe } = useCallState();
|
const { activeCallRoomId, isPrimaryIframe, isChatOpen } = useCallState();
|
||||||
const isViewingActiveCall = useMemo(
|
const isViewingActiveCall = useMemo(
|
||||||
() => activeCallRoomId !== null && activeCallRoomId === room.roomId,
|
() => activeCallRoomId !== null && activeCallRoomId === room.roomId,
|
||||||
[activeCallRoomId]
|
[activeCallRoomId]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const screenSize = useScreenSizeContext();
|
||||||
|
const isMobile = screenSize === ScreenSize.Mobile;
|
||||||
|
|
||||||
const activeIframeDisplayRef =
|
const activeIframeDisplayRef =
|
||||||
!isPrimaryIframe || isViewingActiveCall ? iframeRef : backupIframeRef;
|
!isPrimaryIframe || isViewingActiveCall ? iframeRef : backupIframeRef;
|
||||||
|
|
||||||
|
|
@ -127,8 +131,8 @@ export function CallView({ room, eventId }: { room: Room; eventId?: string }) {
|
||||||
<Box
|
<Box
|
||||||
direction="Column"
|
direction="Column"
|
||||||
style={{
|
style={{
|
||||||
width: '60%',
|
width: isChatOpen ? (isMobile ? '50%' : '100%') : '100%',
|
||||||
display: isCallViewVisible ? 'flex' : 'none',
|
display: isCallViewVisible ? (isMobile && isChatOpen ? 'none' : 'flex') : 'none',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<RoomViewHeader />
|
<RoomViewHeader />
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue