Fix jitsi call close button

This commit is contained in:
CrazyStevenz 2023-03-21 22:37:10 +02:00
parent 83c86dc5f2
commit dba8638109

View file

@ -26,10 +26,17 @@ function JitsiRoom() {
const handleRoomSelected = (rId, pRoomId, eId) => { const handleRoomSelected = (rId, pRoomId, eId) => {
roomInfo.roomTimeline?.removeInternalListeners(); roomInfo.roomTimeline?.removeInternalListeners();
if (mx.getRoom(rId)) { if (mx.getRoom(rId)) {
const roomTimeline = new RoomTimeline(rId);
setRoomInfo({ setRoomInfo({
roomTimeline: new RoomTimeline(rId), roomTimeline,
eventId: eId ?? null, eventId: eId ?? null,
}); });
if (
roomTimeline.room.currentState.getStateEvents('m.room.topic')[0]?.getContent().topic ===
'd38dd491fefa1cfffc27f9c57f2bdb4a'
) {
setActiveCall(true);
}
} else { } else {
// TODO: add ability to join room if roomId is invalid // TODO: add ability to join room if roomId is invalid
setRoomInfo({ setRoomInfo({
@ -51,23 +58,23 @@ function JitsiRoom() {
return null; return null;
} }
if ( if (activeCall) {
roomTimeline.room.currentState.getStateEvents('m.room.topic')[0]?.getContent() if (roomName === '') {
.topic === 'd38dd491fefa1cfffc27f9c57f2bdb4a' || setRoomName(roomTimeline.roomName);
activeCall
) {
if (!activeCall) {
setActiveCall(true);
if (roomName === '') {
setRoomName(roomTimeline.roomName);
}
} }
return ( return (
<div className="call"> <div className="call">
<div className="call_header" id="header" ref={openerRef}> <div className="call_header" id="header" ref={openerRef}>
{roomName} {roomName}
</div> </div>
<Button onclick={() => setActiveCall(false)}>X</Button> <Button
onClick={() => {
setActiveCall(false);
setRoomName('');
}}
>
X
</Button>
<Button>Return</Button> <Button>Return</Button>
<JitsiMeeting <JitsiMeeting
domain="meet.calyx.net" domain="meet.calyx.net"
@ -126,7 +133,7 @@ function JitsiRoom() {
} }
if (!activeCall) { if (!activeCall) {
return (<div className="hiddenJitsiCall" />); return <div className="hiddenJitsiCall" />;
} }
} }