Implement conditional PiP support
This commit is contained in:
parent
68e66e2319
commit
b76feea519
4 changed files with 18 additions and 11 deletions
|
@ -12,7 +12,7 @@ import Button from '../../atoms/button/Button';
|
||||||
|
|
||||||
const TOPIC_JITSI_CALL = 'd38dd491fefa1cfffc27f9c57f2bdb4a'
|
const TOPIC_JITSI_CALL = 'd38dd491fefa1cfffc27f9c57f2bdb4a'
|
||||||
|
|
||||||
function JitsiRoom() {
|
function JitsiRoom({ setIsJitsiRoom }) {
|
||||||
const [jitsiCallId, setJitsiCallId] = useState(null);
|
const [jitsiCallId, setJitsiCallId] = useState(null);
|
||||||
|
|
||||||
const [roomInfo, setRoomInfo] = useState({
|
const [roomInfo, setRoomInfo] = useState({
|
||||||
|
@ -47,6 +47,8 @@ function JitsiRoom() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setIsJitsiRoom(topic === TOPIC_JITSI_CALL)
|
||||||
};
|
};
|
||||||
|
|
||||||
navigation.on(cons.events.navigation.ROOM_SELECTED, handleRoomSelected);
|
navigation.on(cons.events.navigation.ROOM_SELECTED, handleRoomSelected);
|
||||||
|
|
|
@ -13,7 +13,7 @@ import RoomView from './RoomView';
|
||||||
import RoomSettings from './RoomSettings';
|
import RoomSettings from './RoomSettings';
|
||||||
import PeopleDrawer from './PeopleDrawer';
|
import PeopleDrawer from './PeopleDrawer';
|
||||||
|
|
||||||
function Room() {
|
function Room({ isJitsiRoom }) {
|
||||||
const [roomInfo, setRoomInfo] = useState({
|
const [roomInfo, setRoomInfo] = useState({
|
||||||
roomTimeline: null,
|
roomTimeline: null,
|
||||||
eventId: null,
|
eventId: null,
|
||||||
|
@ -60,10 +60,7 @@ function Room() {
|
||||||
return <Welcome />;
|
return <Welcome />;
|
||||||
}
|
}
|
||||||
|
|
||||||
const isJitsiChannel =
|
if (isJitsiRoom) {
|
||||||
roomTimeline.room.currentState.getStateEvents('m.room.topic')[0]?.getContent().topic ===
|
|
||||||
'd38dd491fefa1cfffc27f9c57f2bdb4a';
|
|
||||||
if (isJitsiChannel) {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ function Client() {
|
||||||
const [isLoading, changeLoading] = useState(true);
|
const [isLoading, changeLoading] = useState(true);
|
||||||
const [loadingMsg, setLoadingMsg] = useState('Heating up');
|
const [loadingMsg, setLoadingMsg] = useState('Heating up');
|
||||||
const [dragCounter, setDragCounter] = useState(0);
|
const [dragCounter, setDragCounter] = useState(0);
|
||||||
|
const [isJitsiRoom, setIsJitsiRoom] = useState(false);
|
||||||
const classNameHidden = 'client__item-hidden';
|
const classNameHidden = 'client__item-hidden';
|
||||||
|
|
||||||
const navWrapperRef = useRef(null);
|
const navWrapperRef = useRef(null);
|
||||||
|
@ -161,6 +162,9 @@ function Client() {
|
||||||
initMatrix.roomsInput.emit(cons.events.roomsInput.ATTACHMENT_SET, file);
|
initMatrix.roomsInput.emit(cons.events.roomsInput.ATTACHMENT_SET, file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const JITSI_ROOM_CLASS = 'jitsi_room__wrapper'
|
||||||
|
const ROOM_CLASS = `room__wrapper ${classNameHidden}`
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className="client-container"
|
className="client-container"
|
||||||
|
@ -169,14 +173,14 @@ function Client() {
|
||||||
onDragLeave={handleDragLeave}
|
onDragLeave={handleDragLeave}
|
||||||
onDrop={handleDrop}
|
onDrop={handleDrop}
|
||||||
>
|
>
|
||||||
<div className="jitsi_room__wrapper">
|
|
||||||
<JitsiRoom />
|
|
||||||
</div>
|
|
||||||
<div className="navigation__wrapper" ref={navWrapperRef}>
|
<div className="navigation__wrapper" ref={navWrapperRef}>
|
||||||
<Navigation />
|
<Navigation />
|
||||||
</div>
|
</div>
|
||||||
<div className={`room__wrapper ${classNameHidden}`} ref={roomWrapperRef}>
|
<div className={isJitsiRoom ? ROOM_CLASS : JITSI_ROOM_CLASS}>
|
||||||
<Room />
|
<JitsiRoom setIsJitsiRoom={setIsJitsiRoom} />
|
||||||
|
</div>
|
||||||
|
<div className={isJitsiRoom ? 'hidden' : ROOM_CLASS} ref={roomWrapperRef}>
|
||||||
|
<Room isJitsiRoom={isJitsiRoom} />
|
||||||
</div>
|
</div>
|
||||||
<Windows />
|
<Windows />
|
||||||
<Dialogs />
|
<Dialogs />
|
||||||
|
|
|
@ -51,6 +51,10 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
.loading-display {
|
.loading-display {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
|
Loading…
Reference in a new issue