2019-06-25 02:06:02 +08:00
|
|
|
import React, { PureComponent } from 'react';
|
2018-10-02 21:48:12 +08:00
|
|
|
import { defineMessages, injectIntl } from 'react-intl';
|
2019-06-07 21:49:50 +08:00
|
|
|
import { Session } from 'meteor/session';
|
2019-08-22 01:38:04 +08:00
|
|
|
import logger from '/imports/startup/client/logger';
|
2021-10-29 01:26:15 +08:00
|
|
|
import Styled from './styles';
|
2021-04-09 04:16:36 +08:00
|
|
|
import Service from './service';
|
2023-02-23 19:49:44 +08:00
|
|
|
import MeetingRemainingTime from '../notifications-bar/meeting-remaining-time/container';
|
2022-01-27 04:02:38 +08:00
|
|
|
import MessageFormContainer from './message-form/container';
|
2020-07-10 03:49:42 +08:00
|
|
|
import VideoService from '/imports/ui/components/video-provider/service';
|
2021-05-18 04:25:07 +08:00
|
|
|
import { PANELS, ACTIONS } from '../layout/enums';
|
2021-03-12 09:31:46 +08:00
|
|
|
import { screenshareHasEnded } from '/imports/ui/components/screenshare/service';
|
2021-03-07 09:09:43 +08:00
|
|
|
import AudioManager from '/imports/ui/services/audio-manager';
|
2021-10-29 01:26:15 +08:00
|
|
|
import Settings from '/imports/ui/services/settings';
|
2022-03-01 21:13:23 +08:00
|
|
|
import BreakoutDropdown from '/imports/ui/components/breakout-room/breakout-dropdown/component';
|
2022-02-09 21:09:27 +08:00
|
|
|
import Users from '/imports/api/users';
|
|
|
|
import Auth from '/imports/ui/services/auth';
|
2022-05-20 01:28:58 +08:00
|
|
|
import Header from '/imports/ui/components/common/control-header/component';
|
2018-10-02 21:48:12 +08:00
|
|
|
|
|
|
|
const intlMessages = defineMessages({
|
|
|
|
breakoutTitle: {
|
|
|
|
id: 'app.createBreakoutRoom.title',
|
|
|
|
description: 'breakout title',
|
|
|
|
},
|
2019-01-28 21:33:50 +08:00
|
|
|
breakoutAriaTitle: {
|
|
|
|
id: 'app.createBreakoutRoom.ariaTitle',
|
|
|
|
description: 'breakout aria title',
|
|
|
|
},
|
2018-10-02 21:48:12 +08:00
|
|
|
breakoutDuration: {
|
|
|
|
id: 'app.createBreakoutRoom.duration',
|
|
|
|
description: 'breakout duration time',
|
|
|
|
},
|
|
|
|
breakoutRoom: {
|
|
|
|
id: 'app.createBreakoutRoom.room',
|
2019-09-19 02:55:06 +08:00
|
|
|
description: 'breakout room',
|
2018-10-02 21:48:12 +08:00
|
|
|
},
|
|
|
|
breakoutJoin: {
|
|
|
|
id: 'app.createBreakoutRoom.join',
|
2019-09-19 02:55:06 +08:00
|
|
|
description: 'label for join breakout room',
|
2018-10-02 21:48:12 +08:00
|
|
|
},
|
2018-10-24 01:18:09 +08:00
|
|
|
breakoutJoinAudio: {
|
|
|
|
id: 'app.createBreakoutRoom.joinAudio',
|
2019-09-19 02:55:06 +08:00
|
|
|
description: 'label for option to transfer audio',
|
2018-10-24 01:18:09 +08:00
|
|
|
},
|
|
|
|
breakoutReturnAudio: {
|
|
|
|
id: 'app.createBreakoutRoom.returnAudio',
|
2019-09-19 02:55:06 +08:00
|
|
|
description: 'label for option to return audio',
|
2018-10-24 01:18:09 +08:00
|
|
|
},
|
2021-10-07 21:01:11 +08:00
|
|
|
askToJoin: {
|
|
|
|
id: 'app.createBreakoutRoom.askToJoin',
|
2021-09-03 19:52:42 +08:00
|
|
|
description: 'label for generate breakout room url',
|
|
|
|
},
|
2018-10-24 01:18:09 +08:00
|
|
|
generatingURL: {
|
|
|
|
id: 'app.createBreakoutRoom.generatingURL',
|
2019-09-19 02:55:06 +08:00
|
|
|
description: 'label for generating breakout room url',
|
2018-10-24 01:18:09 +08:00
|
|
|
},
|
2018-10-24 03:29:19 +08:00
|
|
|
endAllBreakouts: {
|
|
|
|
id: 'app.createBreakoutRoom.endAllBreakouts',
|
2019-09-19 02:55:06 +08:00
|
|
|
description: 'Button label to end all breakout rooms',
|
|
|
|
},
|
2022-01-27 04:02:38 +08:00
|
|
|
chatTitleMsgAllRooms: {
|
|
|
|
id: 'app.createBreakoutRoom.chatTitleMsgAllRooms',
|
|
|
|
description: 'chat title for send message to all rooms',
|
|
|
|
},
|
2019-09-19 02:55:06 +08:00
|
|
|
alreadyConnected: {
|
|
|
|
id: 'app.createBreakoutRoom.alreadyConnected',
|
|
|
|
description: 'label for the user that is already connected to breakout room',
|
2018-10-24 03:29:19 +08:00
|
|
|
},
|
2022-02-21 19:14:34 +08:00
|
|
|
setTimeInMinutes: {
|
|
|
|
id: 'app.createBreakoutRoom.setTimeInMinutes',
|
|
|
|
description: 'Label for input to set time (minutes)',
|
2021-06-03 02:29:40 +08:00
|
|
|
},
|
2022-02-21 19:14:34 +08:00
|
|
|
setTimeLabel: {
|
|
|
|
id: 'app.createBreakoutRoom.setTimeLabel',
|
|
|
|
description: 'Button label to set breakout rooms time',
|
2021-06-03 02:29:40 +08:00
|
|
|
},
|
2022-02-21 19:14:34 +08:00
|
|
|
setTimeCancel: {
|
|
|
|
id: 'app.createBreakoutRoom.setTimeCancel',
|
|
|
|
description: 'Button label to cancel set breakout rooms time',
|
2021-06-03 02:29:40 +08:00
|
|
|
},
|
2022-02-21 19:14:34 +08:00
|
|
|
setTimeHigherThanMeetingTimeError: {
|
|
|
|
id: 'app.createBreakoutRoom.setTimeHigherThanMeetingTimeError',
|
|
|
|
description: 'Label for error when new breakout rooms time would be higher than remaining time in parent meeting',
|
2021-06-08 01:19:20 +08:00
|
|
|
},
|
2018-10-02 21:48:12 +08:00
|
|
|
});
|
|
|
|
|
2021-12-14 01:37:09 +08:00
|
|
|
let prevBreakoutData = {};
|
|
|
|
|
2019-06-25 02:06:02 +08:00
|
|
|
class BreakoutRoom extends PureComponent {
|
2019-09-18 03:36:39 +08:00
|
|
|
static sortById(a, b) {
|
2019-09-18 20:32:00 +08:00
|
|
|
if (a.userId > b.userId) {
|
2019-09-18 03:36:39 +08:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2019-09-18 20:32:00 +08:00
|
|
|
if (a.userId < b.userId) {
|
2019-09-18 03:36:39 +08:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-10-02 21:48:12 +08:00
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
2018-10-24 01:18:09 +08:00
|
|
|
this.renderBreakoutRooms = this.renderBreakoutRooms.bind(this);
|
|
|
|
this.getBreakoutURL = this.getBreakoutURL.bind(this);
|
2022-01-20 21:03:18 +08:00
|
|
|
this.hasBreakoutUrl = this.hasBreakoutUrl.bind(this);
|
2021-09-03 19:52:42 +08:00
|
|
|
this.getBreakoutLabel = this.getBreakoutLabel.bind(this);
|
2018-10-24 01:18:09 +08:00
|
|
|
this.renderDuration = this.renderDuration.bind(this);
|
|
|
|
this.transferUserToBreakoutRoom = this.transferUserToBreakoutRoom.bind(this);
|
2022-02-21 19:14:34 +08:00
|
|
|
this.changeSetTime = this.changeSetTime.bind(this);
|
|
|
|
this.showSetTimeForm = this.showSetTimeForm.bind(this);
|
|
|
|
this.resetSetTimeForm = this.resetSetTimeForm.bind(this);
|
2018-10-24 01:18:09 +08:00
|
|
|
this.renderUserActions = this.renderUserActions.bind(this);
|
|
|
|
this.returnBackToMeeeting = this.returnBackToMeeeting.bind(this);
|
2021-07-16 22:42:31 +08:00
|
|
|
this.closePanel = this.closePanel.bind(this);
|
2022-03-01 21:13:23 +08:00
|
|
|
this.handleClickOutsideDurationContainer = this.handleClickOutsideDurationContainer.bind(this);
|
2018-10-24 01:18:09 +08:00
|
|
|
this.state = {
|
|
|
|
requestedBreakoutId: '',
|
|
|
|
waiting: false,
|
2021-08-12 21:21:49 +08:00
|
|
|
generated: false,
|
2018-10-24 01:18:09 +08:00
|
|
|
joinedAudioOnly: false,
|
|
|
|
breakoutId: '',
|
2022-02-21 19:14:34 +08:00
|
|
|
visibleSetTimeForm: false,
|
|
|
|
visibleSetTimeHigherThanMeetingTimeError: false,
|
|
|
|
newTime: 15,
|
2018-10-24 01:18:09 +08:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2021-09-08 19:30:20 +08:00
|
|
|
componentDidMount() {
|
|
|
|
if (this.panel) this.panel.firstChild.focus();
|
|
|
|
}
|
|
|
|
|
2018-10-24 01:18:09 +08:00
|
|
|
componentDidUpdate() {
|
2019-01-24 03:03:48 +08:00
|
|
|
const {
|
2021-10-01 21:44:01 +08:00
|
|
|
getBreakoutRoomUrl,
|
2021-03-07 09:09:43 +08:00
|
|
|
setBreakoutAudioTransferStatus,
|
2021-03-05 11:06:19 +08:00
|
|
|
isMicrophoneUser,
|
|
|
|
isReconnecting,
|
2021-07-16 22:42:31 +08:00
|
|
|
breakoutRooms,
|
2019-01-24 03:03:48 +08:00
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
const {
|
|
|
|
waiting,
|
|
|
|
requestedBreakoutId,
|
2021-03-05 11:06:19 +08:00
|
|
|
joinedAudioOnly,
|
2021-08-12 21:21:49 +08:00
|
|
|
generated,
|
2019-01-24 03:03:48 +08:00
|
|
|
} = this.state;
|
|
|
|
|
2021-07-16 22:42:31 +08:00
|
|
|
if (breakoutRooms.length === 0) {
|
|
|
|
return this.closePanel();
|
|
|
|
}
|
|
|
|
|
2021-08-12 21:21:49 +08:00
|
|
|
if (waiting && !generated) {
|
2021-10-01 21:44:01 +08:00
|
|
|
const breakoutUrlData = getBreakoutRoomUrl(requestedBreakoutId);
|
2019-01-24 03:03:48 +08:00
|
|
|
|
2021-10-01 21:44:01 +08:00
|
|
|
if (!breakoutUrlData) return false;
|
2021-12-14 01:37:09 +08:00
|
|
|
if (breakoutUrlData.redirectToHtml5JoinURL !== ''
|
|
|
|
&& breakoutUrlData.redirectToHtml5JoinURL !== prevBreakoutData.redirectToHtml5JoinURL) {
|
|
|
|
prevBreakoutData = breakoutUrlData;
|
2022-04-12 20:50:19 +08:00
|
|
|
|
|
|
|
Session.set('lastBreakoutIdOpened', requestedBreakoutId);
|
2021-10-07 22:25:33 +08:00
|
|
|
window.open(breakoutUrlData.redirectToHtml5JoinURL, '_blank');
|
2023-02-24 01:38:48 +08:00
|
|
|
setTimeout(() => {
|
|
|
|
this.setState({ generated: true, waiting: false });
|
|
|
|
}, 1000);
|
2018-10-24 01:18:09 +08:00
|
|
|
}
|
|
|
|
}
|
2021-03-05 11:06:19 +08:00
|
|
|
|
|
|
|
if (joinedAudioOnly && (!isMicrophoneUser || isReconnecting)) {
|
|
|
|
this.clearJoinedAudioOnly();
|
2021-03-08 02:01:12 +08:00
|
|
|
setBreakoutAudioTransferStatus({
|
|
|
|
breakoutMeetingId: '',
|
|
|
|
status: AudioManager.BREAKOUT_AUDIO_TRANSFER_STATES.DISCONNECTED,
|
|
|
|
});
|
2021-03-05 11:06:19 +08:00
|
|
|
}
|
2021-08-09 22:24:02 +08:00
|
|
|
return true;
|
2018-10-24 01:18:09 +08:00
|
|
|
}
|
2019-01-24 03:03:48 +08:00
|
|
|
|
2018-10-24 01:18:09 +08:00
|
|
|
getBreakoutURL(breakoutId) {
|
2021-10-01 21:44:01 +08:00
|
|
|
const { requestJoinURL, getBreakoutRoomUrl } = this.props;
|
2019-01-24 03:03:48 +08:00
|
|
|
const { waiting } = this.state;
|
2021-10-01 21:44:01 +08:00
|
|
|
const breakoutRoomUrlData = getBreakoutRoomUrl(breakoutId);
|
|
|
|
if (!breakoutRoomUrlData && !waiting) {
|
2018-10-24 03:29:19 +08:00
|
|
|
this.setState(
|
2019-03-07 21:21:08 +08:00
|
|
|
{
|
|
|
|
waiting: true,
|
2021-09-23 01:07:05 +08:00
|
|
|
generated: false,
|
2019-03-07 21:21:08 +08:00
|
|
|
requestedBreakoutId: breakoutId,
|
|
|
|
},
|
2018-10-24 03:29:19 +08:00
|
|
|
() => requestJoinURL(breakoutId),
|
|
|
|
);
|
2018-10-24 01:18:09 +08:00
|
|
|
}
|
|
|
|
|
2021-10-01 21:44:01 +08:00
|
|
|
if (breakoutRoomUrlData) {
|
2022-04-12 20:50:19 +08:00
|
|
|
|
|
|
|
Session.set('lastBreakoutIdOpened', breakoutId);
|
2021-10-01 21:44:01 +08:00
|
|
|
window.open(breakoutRoomUrlData.redirectToHtml5JoinURL, '_blank');
|
2021-08-12 21:21:49 +08:00
|
|
|
this.setState({ waiting: false, generated: false });
|
2018-10-24 01:18:09 +08:00
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2022-01-20 21:03:18 +08:00
|
|
|
hasBreakoutUrl(breakoutId) {
|
|
|
|
const { getBreakoutRoomUrl } = this.props;
|
2021-09-03 19:52:42 +08:00
|
|
|
const { requestedBreakoutId, generated } = this.state;
|
|
|
|
|
2021-10-01 21:44:01 +08:00
|
|
|
const breakoutRoomUrlData = getBreakoutRoomUrl(breakoutId);
|
2021-09-03 19:52:42 +08:00
|
|
|
|
2022-01-20 21:03:18 +08:00
|
|
|
if ((generated && requestedBreakoutId === breakoutId) || breakoutRoomUrlData) {
|
|
|
|
return true;
|
2021-09-03 19:52:42 +08:00
|
|
|
}
|
|
|
|
|
2022-01-20 21:03:18 +08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
getBreakoutLabel(breakoutId) {
|
|
|
|
const { intl } = this.props;
|
|
|
|
const hasBreakoutUrl = this.hasBreakoutUrl(breakoutId)
|
|
|
|
|
|
|
|
if (hasBreakoutUrl) {
|
2021-09-03 19:52:42 +08:00
|
|
|
return intl.formatMessage(intlMessages.breakoutJoin);
|
|
|
|
}
|
|
|
|
|
2021-10-07 21:01:11 +08:00
|
|
|
return intl.formatMessage(intlMessages.askToJoin);
|
2021-09-03 19:52:42 +08:00
|
|
|
}
|
|
|
|
|
2021-03-05 11:06:19 +08:00
|
|
|
clearJoinedAudioOnly() {
|
|
|
|
this.setState({ joinedAudioOnly: false });
|
|
|
|
}
|
|
|
|
|
2022-02-21 19:14:34 +08:00
|
|
|
changeSetTime(event) {
|
|
|
|
const newSetTime = Number.parseInt(event.target.value, 10) || 0;
|
|
|
|
this.setState({ newTime: newSetTime >= 0 ? newSetTime : 0 });
|
2021-06-03 02:29:40 +08:00
|
|
|
}
|
|
|
|
|
2022-03-01 21:13:23 +08:00
|
|
|
handleClickOutsideDurationContainer(e) {
|
|
|
|
if (this.durationContainerRef) {
|
|
|
|
const { x, right, y, bottom } = this.durationContainerRef.getBoundingClientRect();
|
|
|
|
|
|
|
|
if (e.clientX < x || e.clientX > right || e.clientY < y || e.clientY > bottom) {
|
|
|
|
this.resetSetTimeForm();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-02-21 19:14:34 +08:00
|
|
|
showSetTimeForm() {
|
|
|
|
this.setState({ visibleSetTimeForm: true });
|
2022-03-01 21:13:23 +08:00
|
|
|
window.addEventListener('click', this.handleClickOutsideDurationContainer);
|
2021-06-03 02:29:40 +08:00
|
|
|
}
|
|
|
|
|
2022-02-21 19:14:34 +08:00
|
|
|
showSetTimeHigherThanMeetingTimeError(show) {
|
|
|
|
this.setState({ visibleSetTimeHigherThanMeetingTimeError: show });
|
2021-06-08 01:19:20 +08:00
|
|
|
}
|
|
|
|
|
2022-02-21 19:14:34 +08:00
|
|
|
resetSetTimeForm() {
|
|
|
|
this.setState({ visibleSetTimeForm: false, newTime: 5 });
|
2022-03-01 21:13:23 +08:00
|
|
|
window.removeEventListener('click', this.handleClickOutsideDurationContainer);
|
2021-06-03 02:29:40 +08:00
|
|
|
}
|
|
|
|
|
2018-10-24 01:18:09 +08:00
|
|
|
transferUserToBreakoutRoom(breakoutId) {
|
2018-11-05 20:27:56 +08:00
|
|
|
const { transferToBreakout } = this.props;
|
|
|
|
transferToBreakout(breakoutId);
|
2018-10-24 01:18:09 +08:00
|
|
|
this.setState({ joinedAudioOnly: true, breakoutId });
|
|
|
|
}
|
2019-01-24 03:03:48 +08:00
|
|
|
|
2018-10-24 01:18:09 +08:00
|
|
|
returnBackToMeeeting(breakoutId) {
|
|
|
|
const { transferUserToMeeting, meetingId } = this.props;
|
|
|
|
transferUserToMeeting(breakoutId, meetingId);
|
|
|
|
this.setState({ joinedAudioOnly: false, breakoutId });
|
|
|
|
}
|
|
|
|
|
2021-07-16 22:42:31 +08:00
|
|
|
closePanel() {
|
2021-08-05 19:03:24 +08:00
|
|
|
const { layoutContextDispatch } = this.props;
|
2021-07-16 22:42:31 +08:00
|
|
|
|
2021-08-05 19:03:24 +08:00
|
|
|
layoutContextDispatch({
|
2021-07-16 22:42:31 +08:00
|
|
|
type: ACTIONS.SET_SIDEBAR_CONTENT_IS_OPEN,
|
|
|
|
value: false,
|
|
|
|
});
|
2021-08-05 19:03:24 +08:00
|
|
|
layoutContextDispatch({
|
2021-07-16 22:42:31 +08:00
|
|
|
type: ACTIONS.SET_SIDEBAR_CONTENT_PANEL,
|
|
|
|
value: PANELS.NONE,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2022-02-25 01:40:20 +08:00
|
|
|
renderUserActions(breakoutId, joinedUsers, shortName) {
|
2018-10-24 01:18:09 +08:00
|
|
|
const {
|
|
|
|
isMicrophoneUser,
|
2019-09-07 04:28:02 +08:00
|
|
|
amIModerator,
|
2021-11-24 00:41:37 +08:00
|
|
|
amIPresenter,
|
2018-10-24 01:18:09 +08:00
|
|
|
intl,
|
2019-09-19 02:55:06 +08:00
|
|
|
isUserInBreakoutRoom,
|
2022-02-09 22:43:54 +08:00
|
|
|
forceExitAudio,
|
2022-02-12 00:27:34 +08:00
|
|
|
rejoinAudio,
|
2021-03-07 09:09:43 +08:00
|
|
|
setBreakoutAudioTransferStatus,
|
|
|
|
getBreakoutAudioTransferStatus,
|
2018-10-24 01:18:09 +08:00
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
const {
|
|
|
|
joinedAudioOnly,
|
2021-03-07 09:09:43 +08:00
|
|
|
breakoutId: _stateBreakoutId,
|
2018-10-24 01:18:09 +08:00
|
|
|
requestedBreakoutId,
|
|
|
|
waiting,
|
|
|
|
} = this.state;
|
|
|
|
|
2021-03-07 09:09:43 +08:00
|
|
|
const {
|
|
|
|
breakoutMeetingId: currentAudioTransferBreakoutId,
|
|
|
|
status,
|
|
|
|
} = getBreakoutAudioTransferStatus();
|
|
|
|
|
|
|
|
const isInBreakoutAudioTransfer = status
|
|
|
|
=== AudioManager.BREAKOUT_AUDIO_TRANSFER_STATES.CONNECTED;
|
|
|
|
|
|
|
|
const stateBreakoutId = _stateBreakoutId || currentAudioTransferBreakoutId;
|
2019-09-07 04:28:02 +08:00
|
|
|
const moderatorJoinedAudio = isMicrophoneUser && amIModerator;
|
2018-10-24 01:18:09 +08:00
|
|
|
const disable = waiting && requestedBreakoutId !== breakoutId;
|
2022-01-20 21:03:18 +08:00
|
|
|
const hasBreakoutUrl = this.hasBreakoutUrl(breakoutId);
|
2022-02-25 01:40:20 +08:00
|
|
|
const dataTest = `${hasBreakoutUrl ? 'join' : 'askToJoin'}${shortName.replace(' ', '')}`;
|
2022-01-20 21:03:18 +08:00
|
|
|
|
2021-03-07 09:09:43 +08:00
|
|
|
const audioAction = joinedAudioOnly || isInBreakoutAudioTransfer
|
2019-08-22 01:38:04 +08:00
|
|
|
? () => {
|
2021-03-08 02:01:12 +08:00
|
|
|
setBreakoutAudioTransferStatus({
|
|
|
|
breakoutMeetingId: breakoutId,
|
|
|
|
status: AudioManager.BREAKOUT_AUDIO_TRANSFER_STATES.RETURNING,
|
|
|
|
});
|
2019-08-22 01:38:04 +08:00
|
|
|
this.returnBackToMeeeting(breakoutId);
|
2022-01-25 01:02:16 +08:00
|
|
|
return logger.info({
|
2019-08-22 01:38:04 +08:00
|
|
|
logCode: 'breakoutroom_return_main_audio',
|
2019-08-29 04:42:55 +08:00
|
|
|
extraInfo: { logType: 'user_action' },
|
2019-08-22 01:38:04 +08:00
|
|
|
}, 'Returning to main audio (breakout room audio closed)');
|
|
|
|
}
|
|
|
|
: () => {
|
2021-03-08 02:01:12 +08:00
|
|
|
setBreakoutAudioTransferStatus({
|
|
|
|
breakoutMeetingId: breakoutId,
|
|
|
|
status: AudioManager.BREAKOUT_AUDIO_TRANSFER_STATES.CONNECTED,
|
|
|
|
});
|
2019-08-22 01:38:04 +08:00
|
|
|
this.transferUserToBreakoutRoom(breakoutId);
|
2022-01-25 01:02:16 +08:00
|
|
|
return logger.info({
|
2019-08-29 04:42:55 +08:00
|
|
|
logCode: 'breakoutroom_join_audio_from_main_room',
|
|
|
|
extraInfo: { logType: 'user_action' },
|
2019-08-22 01:38:04 +08:00
|
|
|
}, 'joining breakout room audio (main room audio closed)');
|
|
|
|
};
|
2018-10-24 01:18:09 +08:00
|
|
|
return (
|
2021-10-29 01:26:15 +08:00
|
|
|
<Styled.BreakoutActions>
|
2021-08-09 22:24:02 +08:00
|
|
|
{
|
|
|
|
isUserInBreakoutRoom(joinedUsers)
|
|
|
|
? (
|
2022-02-09 23:52:42 +08:00
|
|
|
<Styled.AlreadyConnected data-test="alreadyConnected">
|
2021-08-09 22:24:02 +08:00
|
|
|
{intl.formatMessage(intlMessages.alreadyConnected)}
|
2021-10-29 01:26:15 +08:00
|
|
|
</Styled.AlreadyConnected>
|
2021-08-09 22:24:02 +08:00
|
|
|
)
|
|
|
|
: (
|
2021-10-29 01:26:15 +08:00
|
|
|
<Styled.JoinButton
|
2021-09-03 19:52:42 +08:00
|
|
|
label={this.getBreakoutLabel(breakoutId)}
|
2022-01-20 21:03:18 +08:00
|
|
|
data-test={dataTest}
|
2022-02-25 01:40:20 +08:00
|
|
|
aria-label={`${this.getBreakoutLabel(breakoutId)} ${shortName}`}
|
2021-08-09 22:24:02 +08:00
|
|
|
onClick={() => {
|
|
|
|
this.getBreakoutURL(breakoutId);
|
|
|
|
// leave main room's audio,
|
|
|
|
// and stops video and screenshare when joining a breakout room
|
2022-02-09 22:43:54 +08:00
|
|
|
forceExitAudio();
|
2022-01-25 01:02:16 +08:00
|
|
|
logger.info({
|
2021-08-09 22:24:02 +08:00
|
|
|
logCode: 'breakoutroom_join',
|
|
|
|
extraInfo: { logType: 'user_action' },
|
|
|
|
}, 'joining breakout room closed audio in the main room');
|
|
|
|
VideoService.storeDeviceIds();
|
|
|
|
VideoService.exitVideo();
|
2021-11-24 00:41:37 +08:00
|
|
|
if (amIPresenter) screenshareHasEnded();
|
2022-02-09 21:09:27 +08:00
|
|
|
|
|
|
|
Tracker.autorun((c) => {
|
|
|
|
const selector = {
|
|
|
|
meetingId: breakoutId,
|
|
|
|
};
|
|
|
|
|
|
|
|
const query = Users.find(selector, {
|
|
|
|
fields: {
|
|
|
|
loggedOut: 1,
|
|
|
|
extId: 1,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2022-02-12 00:45:55 +08:00
|
|
|
const observeLogOut = (user) => {
|
|
|
|
if (user?.loggedOut && user?.extId?.startsWith(Auth.userID)) {
|
|
|
|
rejoinAudio();
|
|
|
|
c.stop();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-02-09 21:09:27 +08:00
|
|
|
query.observe({
|
2022-02-12 00:45:55 +08:00
|
|
|
added: observeLogOut,
|
|
|
|
changed: observeLogOut,
|
2022-02-10 01:03:35 +08:00
|
|
|
});
|
|
|
|
});
|
2021-08-09 22:24:02 +08:00
|
|
|
}}
|
|
|
|
disabled={disable}
|
|
|
|
/>
|
|
|
|
)
|
2019-09-19 02:55:06 +08:00
|
|
|
}
|
2018-10-24 01:18:09 +08:00
|
|
|
{
|
2019-01-24 03:03:48 +08:00
|
|
|
moderatorJoinedAudio
|
|
|
|
? [
|
2018-10-24 01:18:09 +08:00
|
|
|
('|'),
|
|
|
|
(
|
2021-10-29 01:26:15 +08:00
|
|
|
<Styled.AudioButton
|
2018-10-24 01:18:09 +08:00
|
|
|
label={
|
2021-05-18 04:25:07 +08:00
|
|
|
stateBreakoutId === breakoutId
|
|
|
|
&& (joinedAudioOnly || isInBreakoutAudioTransfer)
|
|
|
|
? intl.formatMessage(intlMessages.breakoutReturnAudio)
|
|
|
|
: intl.formatMessage(intlMessages.breakoutJoinAudio)
|
2018-10-24 01:18:09 +08:00
|
|
|
}
|
2020-10-07 03:53:14 +08:00
|
|
|
disabled={stateBreakoutId !== breakoutId && joinedAudioOnly}
|
2019-09-19 04:00:32 +08:00
|
|
|
key={`join-audio-${breakoutId}`}
|
2018-10-24 03:29:19 +08:00
|
|
|
onClick={audioAction}
|
2018-10-24 01:18:09 +08:00
|
|
|
/>
|
|
|
|
),
|
|
|
|
]
|
|
|
|
: null
|
|
|
|
}
|
2021-10-29 01:26:15 +08:00
|
|
|
</Styled.BreakoutActions>
|
2018-10-24 01:18:09 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
renderBreakoutRooms() {
|
|
|
|
const {
|
|
|
|
breakoutRooms,
|
|
|
|
intl,
|
|
|
|
} = this.props;
|
|
|
|
|
2019-01-24 03:03:48 +08:00
|
|
|
const {
|
|
|
|
waiting,
|
|
|
|
requestedBreakoutId,
|
|
|
|
} = this.state;
|
|
|
|
|
2021-10-29 01:26:15 +08:00
|
|
|
const { animations } = Settings.application;
|
2021-08-09 22:24:02 +08:00
|
|
|
const roomItems = breakoutRooms.map((breakout) => (
|
2023-01-17 06:00:27 +08:00
|
|
|
<Styled.BreakoutItems key={`breakoutRoomItems-${breakout.breakoutId}`}>
|
2021-10-29 01:26:15 +08:00
|
|
|
<Styled.Content key={`breakoutRoomList-${breakout.breakoutId}`}>
|
2023-01-17 07:10:13 +08:00
|
|
|
<Styled.BreakoutRoomListNameLabel data-test={breakout.shortName} aria-hidden>
|
2021-08-09 22:24:02 +08:00
|
|
|
{breakout.isDefaultName
|
2021-06-15 03:59:27 +08:00
|
|
|
? intl.formatMessage(intlMessages.breakoutRoom, { 0: breakout.sequence })
|
2021-08-09 22:24:02 +08:00
|
|
|
: breakout.shortName}
|
2021-10-29 01:26:15 +08:00
|
|
|
<Styled.UsersAssignedNumberLabel>
|
2019-09-18 03:36:39 +08:00
|
|
|
(
|
2019-09-28 06:59:55 +08:00
|
|
|
{breakout.joinedUsers.length}
|
2019-09-18 03:36:39 +08:00
|
|
|
)
|
2021-10-29 01:26:15 +08:00
|
|
|
</Styled.UsersAssignedNumberLabel>
|
|
|
|
</Styled.BreakoutRoomListNameLabel>
|
2019-09-18 03:36:39 +08:00
|
|
|
{waiting && requestedBreakoutId === breakout.breakoutId ? (
|
|
|
|
<span>
|
|
|
|
{intl.formatMessage(intlMessages.generatingURL)}
|
2021-10-29 01:26:15 +08:00
|
|
|
<Styled.ConnectingAnimation animations={animations}/>
|
2019-09-18 03:36:39 +08:00
|
|
|
</span>
|
2019-09-28 06:59:55 +08:00
|
|
|
) : this.renderUserActions(
|
|
|
|
breakout.breakoutId,
|
|
|
|
breakout.joinedUsers,
|
2022-02-25 01:40:20 +08:00
|
|
|
breakout.shortName,
|
2019-09-28 06:59:55 +08:00
|
|
|
)}
|
2021-10-29 01:26:15 +08:00
|
|
|
</Styled.Content>
|
2022-09-16 02:34:14 +08:00
|
|
|
<Styled.JoinedUserNames
|
2022-09-30 19:17:15 +08:00
|
|
|
data-test={`userNameBreakoutRoom-${breakout.shortName}`}
|
2022-09-16 02:34:14 +08:00
|
|
|
>
|
2019-09-18 03:36:39 +08:00
|
|
|
{breakout.joinedUsers
|
|
|
|
.sort(BreakoutRoom.sortById)
|
|
|
|
.filter((value, idx, arr) => !(value.userId === (arr[idx + 1] || {}).userId))
|
2021-04-09 04:16:36 +08:00
|
|
|
.sort(Service.sortUsersByName)
|
2021-08-09 22:24:02 +08:00
|
|
|
.map((u) => u.name)
|
2019-09-28 03:45:55 +08:00
|
|
|
.join(', ')}
|
2021-10-29 01:26:15 +08:00
|
|
|
</Styled.JoinedUserNames>
|
|
|
|
</Styled.BreakoutItems>
|
2018-10-24 01:18:09 +08:00
|
|
|
));
|
|
|
|
|
2019-09-18 03:36:39 +08:00
|
|
|
return (
|
2021-10-29 01:26:15 +08:00
|
|
|
<Styled.BreakoutColumn>
|
2022-09-30 19:17:15 +08:00
|
|
|
<Styled.BreakoutScrollableList data-test="breakoutRoomList">
|
2019-09-18 03:36:39 +08:00
|
|
|
{roomItems}
|
2021-10-29 01:26:15 +08:00
|
|
|
</Styled.BreakoutScrollableList>
|
|
|
|
</Styled.BreakoutColumn>
|
2019-09-18 03:36:39 +08:00
|
|
|
);
|
2018-10-24 01:18:09 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
renderDuration() {
|
2021-06-03 02:29:40 +08:00
|
|
|
const {
|
2021-08-09 22:24:02 +08:00
|
|
|
intl,
|
|
|
|
breakoutRooms,
|
|
|
|
amIModerator,
|
|
|
|
isMeteorConnected,
|
2022-02-21 19:14:34 +08:00
|
|
|
setBreakoutsTime,
|
|
|
|
isNewTimeHigherThanMeetingRemaining,
|
2021-06-03 02:29:40 +08:00
|
|
|
} = this.props;
|
2021-08-09 22:24:02 +08:00
|
|
|
const {
|
2022-02-21 19:14:34 +08:00
|
|
|
newTime,
|
|
|
|
visibleSetTimeForm,
|
|
|
|
visibleSetTimeHigherThanMeetingTimeError,
|
2021-08-09 22:24:02 +08:00
|
|
|
} = this.state;
|
2018-10-24 01:18:09 +08:00
|
|
|
return (
|
2022-03-01 21:13:23 +08:00
|
|
|
<Styled.DurationContainer
|
|
|
|
centeredText={!visibleSetTimeForm}
|
|
|
|
ref={(ref) => this.durationContainerRef = ref}
|
|
|
|
>
|
|
|
|
<Styled.Duration>
|
2023-02-23 19:49:44 +08:00
|
|
|
<MeetingRemainingTime
|
2022-03-01 21:13:23 +08:00
|
|
|
messageDuration={intlMessages.breakoutDuration}
|
|
|
|
breakoutRoom={breakoutRooms[0]}
|
|
|
|
fromBreakoutPanel
|
|
|
|
/>
|
|
|
|
</Styled.Duration>
|
2022-02-21 19:14:34 +08:00
|
|
|
{amIModerator && visibleSetTimeForm ? (
|
|
|
|
<Styled.SetTimeContainer>
|
|
|
|
<label htmlFor="inputSetTimeSelector" >
|
|
|
|
{intl.formatMessage(intlMessages.setTimeInMinutes)}
|
2021-06-03 02:29:40 +08:00
|
|
|
</label>
|
|
|
|
<br />
|
2022-03-01 21:13:23 +08:00
|
|
|
<Styled.FlexRow>
|
|
|
|
<Styled.SetDurationInput
|
|
|
|
id="inputSetTimeSelector"
|
|
|
|
type="number"
|
|
|
|
min="1"
|
|
|
|
value={newTime}
|
|
|
|
onChange={this.changeSetTime}
|
|
|
|
aria-label={intl.formatMessage(intlMessages.setTimeInMinutes)}
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
|
|
<Styled.EndButton
|
2022-09-16 02:34:14 +08:00
|
|
|
data-test="sendButtonDurationTime"
|
2022-03-01 21:13:23 +08:00
|
|
|
color="primary"
|
|
|
|
disabled={!isMeteorConnected}
|
|
|
|
size="sm"
|
|
|
|
label={intl.formatMessage(intlMessages.setTimeLabel)}
|
|
|
|
onClick={() => {
|
|
|
|
this.showSetTimeHigherThanMeetingTimeError(false);
|
|
|
|
|
|
|
|
if (isNewTimeHigherThanMeetingRemaining(newTime)) {
|
|
|
|
this.showSetTimeHigherThanMeetingTimeError(true);
|
|
|
|
} else if (setBreakoutsTime(newTime)) {
|
|
|
|
this.resetSetTimeForm();
|
|
|
|
}
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</Styled.FlexRow>
|
2022-02-21 19:14:34 +08:00
|
|
|
{visibleSetTimeHigherThanMeetingTimeError ? (
|
2021-10-29 01:26:15 +08:00
|
|
|
<Styled.WithError>
|
2022-02-21 19:14:34 +08:00
|
|
|
{intl.formatMessage(intlMessages.setTimeHigherThanMeetingTimeError)}
|
2021-10-29 01:26:15 +08:00
|
|
|
</Styled.WithError>
|
2021-08-09 22:24:02 +08:00
|
|
|
) : null}
|
2022-02-21 19:14:34 +08:00
|
|
|
</Styled.SetTimeContainer>
|
2021-08-09 22:24:02 +08:00
|
|
|
) : null}
|
2021-10-29 01:26:15 +08:00
|
|
|
</Styled.DurationContainer>
|
2018-10-24 01:18:09 +08:00
|
|
|
);
|
2018-10-02 21:48:12 +08:00
|
|
|
}
|
2018-10-24 01:18:09 +08:00
|
|
|
|
2018-10-02 21:48:12 +08:00
|
|
|
render() {
|
2018-10-24 01:18:09 +08:00
|
|
|
const {
|
2021-05-18 04:25:07 +08:00
|
|
|
isMeteorConnected,
|
|
|
|
intl,
|
|
|
|
endAllBreakouts,
|
|
|
|
amIModerator,
|
2022-05-13 21:42:19 +08:00
|
|
|
isRTL,
|
2018-10-24 01:18:09 +08:00
|
|
|
} = this.props;
|
2018-10-02 21:48:12 +08:00
|
|
|
return (
|
2021-10-29 01:26:15 +08:00
|
|
|
<Styled.Panel ref={(n) => this.panel = n}>
|
2022-05-20 01:28:58 +08:00
|
|
|
<Header
|
|
|
|
leftButtonProps={{
|
|
|
|
'aria-label': intl.formatMessage(intlMessages.breakoutAriaTitle),
|
|
|
|
label: intl.formatMessage(intlMessages.breakoutTitle),
|
|
|
|
onClick: () => {
|
2022-03-01 21:13:23 +08:00
|
|
|
this.closePanel();
|
2022-05-20 01:28:58 +08:00
|
|
|
},
|
|
|
|
}}
|
|
|
|
customRightButton={amIModerator && (
|
2022-03-01 21:13:23 +08:00
|
|
|
<BreakoutDropdown
|
|
|
|
openBreakoutTimeManager={this.showSetTimeForm}
|
|
|
|
endAllBreakouts={() => {
|
|
|
|
this.closePanel();
|
|
|
|
endAllBreakouts();
|
|
|
|
}}
|
|
|
|
isMeteorConnected={isMeteorConnected}
|
|
|
|
amIModerator={amIModerator}
|
2022-05-13 21:42:19 +08:00
|
|
|
isRTL={isRTL}
|
2022-03-01 21:13:23 +08:00
|
|
|
/>
|
2022-05-20 01:28:58 +08:00
|
|
|
)}
|
|
|
|
/>
|
2022-03-01 21:13:23 +08:00
|
|
|
{this.renderDuration()}
|
2022-01-29 01:41:10 +08:00
|
|
|
{amIModerator
|
|
|
|
? (
|
|
|
|
<MessageFormContainer
|
|
|
|
{...{
|
|
|
|
title: intl.formatMessage(intlMessages.chatTitleMsgAllRooms),
|
|
|
|
}}
|
|
|
|
chatId="breakouts"
|
|
|
|
chatTitle={intl.formatMessage(intlMessages.chatTitleMsgAllRooms)}
|
|
|
|
disabled={!isMeteorConnected}
|
|
|
|
connected={isMeteorConnected}
|
|
|
|
locked={false}
|
|
|
|
/>
|
|
|
|
) : null }
|
|
|
|
{amIModerator ? <Styled.Separator /> : null }
|
2018-10-24 01:18:09 +08:00
|
|
|
{this.renderBreakoutRooms()}
|
2021-10-29 01:26:15 +08:00
|
|
|
</Styled.Panel>
|
2018-10-02 21:48:12 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default injectIntl(BreakoutRoom);
|