mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-11 17:50:29 +03:00
Update Room.tsx to accomodate restructuring of Room, RoomView and CallView
This commit is contained in:
parent
77f8a0409a
commit
fb9ca31a43
1 changed files with 15 additions and 43 deletions
|
|
@ -1,4 +1,3 @@
|
|||
/* eslint-disable no-nested-ternary */
|
||||
import React, { useCallback } from 'react';
|
||||
import { Box, Line } from 'folds';
|
||||
import { useParams } from 'react-router-dom';
|
||||
|
|
@ -15,7 +14,6 @@ import { markAsRead } from '../../../client/action/notifications';
|
|||
import { useMatrixClient } from '../../hooks/useMatrixClient';
|
||||
import { useRoomMembers } from '../../hooks/useRoomMembers';
|
||||
import { CallView } from '../call/CallView';
|
||||
import { useCallState } from '../../pages/client/call/CallProvider';
|
||||
import { RoomViewHeader } from './RoomViewHeader';
|
||||
|
||||
export function Room() {
|
||||
|
|
@ -25,7 +23,6 @@ export function Room() {
|
|||
|
||||
const [isDrawer] = useSetting(settingsAtom, 'isPeopleDrawer');
|
||||
const [hideActivity] = useSetting(settingsAtom, 'hideActivity');
|
||||
const { isChatOpen } = useCallState();
|
||||
const screenSize = useScreenSizeContext();
|
||||
const powerLevels = usePowerLevels(room);
|
||||
const members = useRoomMembers(mx, room?.roomId);
|
||||
|
|
@ -44,49 +41,24 @@ export function Room() {
|
|||
|
||||
return (
|
||||
<PowerLevelsContextProvider value={powerLevels}>
|
||||
<Box
|
||||
grow="Yes"
|
||||
style={{
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
}}
|
||||
>
|
||||
{room.isCallRoom() && <RoomViewHeader />}
|
||||
<Box
|
||||
grow="Yes"
|
||||
style={{
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
display: 'flex',
|
||||
flexDirection: 'row',
|
||||
}}
|
||||
>
|
||||
<Box grow="Yes">
|
||||
<Box grow="Yes" direction="Column">
|
||||
<RoomViewHeader />
|
||||
<Box grow="Yes">
|
||||
<CallView room={room} />
|
||||
{(!room.isCallRoom() || isChatOpen) && (
|
||||
<Box
|
||||
grow="Yes"
|
||||
style={{
|
||||
width: room.isCallRoom() ? (isChatOpen ? '40%' : '0%') : '100%',
|
||||
height: '100%',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
}}
|
||||
>
|
||||
<Box style={{ flex: 1, minHeight: 0, overflowY: 'auto', background: '#fff' }}>
|
||||
{room.isCallRoom() && screenSize === ScreenSize.Desktop && (
|
||||
<Line variant="Background" direction="Vertical" size="300" />
|
||||
)}
|
||||
<RoomView room={room} eventId={eventId} />
|
||||
</Box>
|
||||
</Box>
|
||||
)}
|
||||
{screenSize === ScreenSize.Desktop && !room.isCallRoom() && isDrawer && (
|
||||
{!room.isCallRoom() && screenSize === ScreenSize.Desktop && isDrawer && (
|
||||
<>
|
||||
<Line variant="Background" direction="Vertical" size="300" />
|
||||
<MembersDrawer key={room.roomId} room={room} members={members} />
|
||||
</>
|
||||
)}
|
||||
</Box>
|
||||
</Box>
|
||||
</PowerLevelsContextProvider>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue