Update Room.tsx to accomodate restructuring of Room, RoomView and CallView

This commit is contained in:
Gimle Larpes 2025-07-31 20:36:16 +02:00 committed by GitHub
parent 77f8a0409a
commit fb9ca31a43
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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,48 +41,23 @@ 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',
}}
>
<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' }}>
<RoomView room={room} eventId={eventId} />
</Box>
</Box>
)}
{screenSize === ScreenSize.Desktop && !room.isCallRoom() && isDrawer && (
<>
<Box grow="Yes">
<Box grow="Yes" direction="Column">
<RoomViewHeader />
<Box grow="Yes">
<CallView room={room} />
{room.isCallRoom() && screenSize === ScreenSize.Desktop && (
<Line variant="Background" direction="Vertical" size="300" />
<MembersDrawer key={room.roomId} room={room} members={members} />
</>
)}
)}
<RoomView room={room} eventId={eventId} />
</Box>
</Box>
{!room.isCallRoom() && screenSize === ScreenSize.Desktop && isDrawer && (
<>
<Line variant="Background" direction="Vertical" size="300" />
<MembersDrawer key={room.roomId} room={room} members={members} />
</>
)}
</Box>
</PowerLevelsContextProvider>
);