2019-06-25 02:06:02 +08:00
|
|
|
import React, { PureComponent } from 'react';
|
2019-01-30 10:15:01 +08:00
|
|
|
import PropTypes from 'prop-types';
|
2020-05-26 04:00:13 +08:00
|
|
|
import { defineMessages, injectIntl } from 'react-intl';
|
2023-02-22 01:57:34 +08:00
|
|
|
import { range } from '/imports/utils/array-utils';
|
2021-04-01 01:13:36 +08:00
|
|
|
import deviceInfo from '/imports/utils/deviceInfo';
|
2022-02-15 04:20:50 +08:00
|
|
|
import Button from '/imports/ui/components/common/button/component';
|
2018-11-30 03:47:04 +08:00
|
|
|
import { Session } from 'meteor/session';
|
2023-03-20 21:08:35 +08:00
|
|
|
import ModalFullscreen from '/imports/ui/components/common/modal/fullscreen/component';
|
2018-12-14 20:33:58 +08:00
|
|
|
import SortList from './sort-user-list/component';
|
2021-10-26 03:21:27 +08:00
|
|
|
import Styled from './styles';
|
2023-03-11 02:42:57 +08:00
|
|
|
import Icon from '/imports/ui/components/common/icon/component';
|
2022-10-20 01:09:11 +08:00
|
|
|
import { isImportSharedNotesFromBreakoutRoomsEnabled, isImportPresentationWithAnnotationsFromBreakoutRoomsEnabled } from '/imports/ui/services/features';
|
2022-10-20 22:37:11 +08:00
|
|
|
import { addNewAlert } from '/imports/ui/components/screenreader-alert/service';
|
2023-01-17 06:00:27 +08:00
|
|
|
import PresentationUploaderService from '/imports/ui/components/presentation/presentation-uploader/service';
|
2023-02-23 22:23:51 +08:00
|
|
|
import { uniqueId } from '/imports/utils/string-utils';
|
2018-09-28 22:42:07 +08:00
|
|
|
|
2019-06-29 04:52:19 +08:00
|
|
|
const ROLE_MODERATOR = Meteor.settings.public.user.role_moderator;
|
|
|
|
|
2018-09-28 22:42:07 +08:00
|
|
|
const intlMessages = defineMessages({
|
2018-10-24 01:18:09 +08:00
|
|
|
breakoutRoomTitle: {
|
2018-09-28 22:42:07 +08:00
|
|
|
id: 'app.createBreakoutRoom.title',
|
|
|
|
description: 'modal title',
|
|
|
|
},
|
2018-10-24 01:18:09 +08:00
|
|
|
breakoutRoomDesc: {
|
2018-09-28 22:42:07 +08:00
|
|
|
id: 'app.createBreakoutRoom.modalDesc',
|
2018-10-30 03:29:45 +08:00
|
|
|
description: 'modal description',
|
2018-09-28 22:42:07 +08:00
|
|
|
},
|
2022-03-24 21:56:07 +08:00
|
|
|
breakoutRoomUpdateDesc: {
|
|
|
|
id: 'app.updateBreakoutRoom.modalDesc',
|
|
|
|
description: 'update modal description',
|
|
|
|
},
|
|
|
|
cancelLabel: {
|
|
|
|
id: 'app.updateBreakoutRoom.cancelLabel',
|
|
|
|
description: 'used in the button that close update modal',
|
|
|
|
},
|
|
|
|
updateTitle: {
|
|
|
|
id: 'app.updateBreakoutRoom.title',
|
|
|
|
description: 'update breakout title',
|
|
|
|
},
|
|
|
|
updateConfirm: {
|
|
|
|
id: 'app.updateBreakoutRoom.confirm',
|
|
|
|
description: 'Update to breakout confirm button label',
|
|
|
|
},
|
|
|
|
resetUserRoom: {
|
|
|
|
id: 'app.update.resetRoom',
|
|
|
|
description: 'Reset user room button label',
|
|
|
|
},
|
2018-10-24 01:18:09 +08:00
|
|
|
confirmButton: {
|
|
|
|
id: 'app.createBreakoutRoom.confirm',
|
2018-10-30 03:29:45 +08:00
|
|
|
description: 'confirm button label',
|
2018-10-24 01:18:09 +08:00
|
|
|
},
|
2018-11-30 03:47:04 +08:00
|
|
|
dismissLabel: {
|
|
|
|
id: 'app.presentationUploder.dismissLabel',
|
|
|
|
description: 'used in the button that close modal',
|
|
|
|
},
|
2018-10-24 01:18:09 +08:00
|
|
|
numberOfRooms: {
|
|
|
|
id: 'app.createBreakoutRoom.numberOfRooms',
|
2018-10-30 03:29:45 +08:00
|
|
|
description: 'number of rooms label',
|
2018-10-24 01:18:09 +08:00
|
|
|
},
|
|
|
|
duration: {
|
|
|
|
id: 'app.createBreakoutRoom.durationInMinutes',
|
2018-10-30 03:29:45 +08:00
|
|
|
description: 'duration time label',
|
2018-10-24 01:18:09 +08:00
|
|
|
},
|
2021-11-11 21:10:31 +08:00
|
|
|
resetAssignments: {
|
|
|
|
id: 'app.createBreakoutRoom.resetAssignments',
|
|
|
|
description: 'reset assignments label',
|
|
|
|
},
|
|
|
|
resetAssignmentsDesc: {
|
|
|
|
id: 'app.createBreakoutRoom.resetAssignmentsDesc',
|
|
|
|
description: 'reset assignments label description',
|
|
|
|
},
|
2018-10-24 01:18:09 +08:00
|
|
|
randomlyAssign: {
|
|
|
|
id: 'app.createBreakoutRoom.randomlyAssign',
|
2018-10-30 03:29:45 +08:00
|
|
|
description: 'randomly assign label',
|
|
|
|
},
|
2021-08-17 11:07:20 +08:00
|
|
|
randomlyAssignDesc: {
|
|
|
|
id: 'app.createBreakoutRoom.randomlyAssignDesc',
|
|
|
|
description: 'randomly assign label description',
|
|
|
|
},
|
2021-06-15 03:59:27 +08:00
|
|
|
breakoutRoom: {
|
|
|
|
id: 'app.createBreakoutRoom.room',
|
|
|
|
description: 'breakout room',
|
2018-10-24 01:18:09 +08:00
|
|
|
},
|
2018-11-24 01:20:49 +08:00
|
|
|
freeJoinLabel: {
|
|
|
|
id: 'app.createBreakoutRoom.freeJoin',
|
|
|
|
description: 'free join label',
|
|
|
|
},
|
2022-09-20 23:43:13 +08:00
|
|
|
captureNotesLabel: {
|
|
|
|
id: 'app.createBreakoutRoom.captureNotes',
|
|
|
|
description: 'capture shared notes label',
|
|
|
|
},
|
2022-10-20 01:09:11 +08:00
|
|
|
captureSlidesLabel: {
|
|
|
|
id: 'app.createBreakoutRoom.captureSlides',
|
|
|
|
description: 'capture slides label',
|
2022-09-06 01:27:38 +08:00
|
|
|
},
|
2023-01-17 06:00:27 +08:00
|
|
|
captureNotesType: {
|
|
|
|
id: 'app.notes.label',
|
|
|
|
description: 'indicates notes have been captured',
|
|
|
|
},
|
|
|
|
captureSlidesType: {
|
|
|
|
id: 'app.shortcut-help.whiteboard',
|
|
|
|
description: 'indicates the whiteboard has been captured',
|
|
|
|
},
|
2018-11-27 20:44:22 +08:00
|
|
|
roomLabel: {
|
|
|
|
id: 'app.createBreakoutRoom.room',
|
|
|
|
description: 'Room label',
|
|
|
|
},
|
2018-11-30 03:47:04 +08:00
|
|
|
leastOneWarnBreakout: {
|
|
|
|
id: 'app.createBreakoutRoom.leastOneWarnBreakout',
|
|
|
|
description: 'warn message label',
|
|
|
|
},
|
2018-11-27 20:44:22 +08:00
|
|
|
notAssigned: {
|
|
|
|
id: 'app.createBreakoutRoom.notAssigned',
|
|
|
|
description: 'Not assigned label',
|
|
|
|
},
|
2018-12-14 20:33:58 +08:00
|
|
|
breakoutRoomLabel: {
|
|
|
|
id: 'app.createBreakoutRoom.breakoutRoomLabel',
|
|
|
|
description: 'breakout room label',
|
|
|
|
},
|
|
|
|
addParticipantLabel: {
|
|
|
|
id: 'app.createBreakoutRoom.addParticipantLabel',
|
|
|
|
description: 'add Participant label',
|
|
|
|
},
|
|
|
|
nextLabel: {
|
|
|
|
id: 'app.createBreakoutRoom.nextLabel',
|
|
|
|
description: 'Next label',
|
|
|
|
},
|
|
|
|
backLabel: {
|
|
|
|
id: 'app.audio.backLabel',
|
|
|
|
description: 'Back label',
|
|
|
|
},
|
2019-01-30 10:15:01 +08:00
|
|
|
minusRoomTime: {
|
|
|
|
id: 'app.createBreakoutRoom.minusRoomTime',
|
|
|
|
description: 'aria label for btn to decrease room time',
|
|
|
|
},
|
|
|
|
addRoomTime: {
|
|
|
|
id: 'app.createBreakoutRoom.addRoomTime',
|
|
|
|
description: 'aria label for btn to increase room time',
|
|
|
|
},
|
2019-04-12 04:12:22 +08:00
|
|
|
record: {
|
|
|
|
id: 'app.createBreakoutRoom.record',
|
|
|
|
description: 'label for checkbox to allow record',
|
|
|
|
},
|
2019-05-25 00:53:58 +08:00
|
|
|
roomTime: {
|
|
|
|
id: 'app.createBreakoutRoom.roomTime',
|
|
|
|
description: 'used to provide current room time for aria label',
|
|
|
|
},
|
2019-06-14 21:54:59 +08:00
|
|
|
numberOfRoomsIsValid: {
|
|
|
|
id: 'app.createBreakoutRoom.numberOfRoomsError',
|
|
|
|
description: 'Label an error message',
|
|
|
|
},
|
2021-06-12 03:06:56 +08:00
|
|
|
roomNameEmptyIsValid: {
|
|
|
|
id: 'app.createBreakoutRoom.emptyRoomNameError',
|
|
|
|
description: 'Label an error message',
|
|
|
|
},
|
|
|
|
roomNameDuplicatedIsValid: {
|
|
|
|
id: 'app.createBreakoutRoom.duplicatedRoomNameError',
|
|
|
|
description: 'Label an error message',
|
|
|
|
},
|
2021-02-04 21:59:13 +08:00
|
|
|
you: {
|
|
|
|
id: 'app.userList.you',
|
|
|
|
description: 'Text for identifying your user',
|
|
|
|
},
|
2021-06-12 00:21:26 +08:00
|
|
|
minimumDurationWarnBreakout: {
|
|
|
|
id: 'app.createBreakoutRoom.minimumDurationWarnBreakout',
|
|
|
|
description: 'minimum duration warning message label',
|
|
|
|
},
|
2021-09-11 10:08:04 +08:00
|
|
|
roomNameInputDesc: {
|
|
|
|
id: 'app.createBreakoutRoom.roomNameInputDesc',
|
|
|
|
description: 'aria description for room name change',
|
2021-11-11 21:10:31 +08:00
|
|
|
},
|
2022-10-20 22:37:11 +08:00
|
|
|
movedUserLabel: {
|
|
|
|
id: 'app.createBreakoutRoom.movedUserLabel',
|
|
|
|
description: 'screen reader alert when users are moved to rooms',
|
2023-06-30 21:53:58 +08:00
|
|
|
},
|
|
|
|
manageRooms: {
|
|
|
|
id: 'app.createBreakoutRoom.manageRoomsLabel',
|
|
|
|
description: 'Label for manage rooms',
|
|
|
|
},
|
2023-07-06 00:58:40 +08:00
|
|
|
sendInvitationToMods: {
|
|
|
|
id: 'app.createBreakoutRoom.sendInvitationToMods',
|
|
|
|
description: 'label for checkbox send invitation to moderators',
|
|
|
|
},
|
2018-09-28 22:42:07 +08:00
|
|
|
});
|
2019-01-30 10:15:01 +08:00
|
|
|
|
2021-02-09 01:40:03 +08:00
|
|
|
const BREAKOUT_LIM = Meteor.settings.public.app.breakouts.breakoutRoomLimit;
|
2018-11-05 20:27:56 +08:00
|
|
|
const MIN_BREAKOUT_ROOMS = 2;
|
2020-07-30 03:28:15 +08:00
|
|
|
const MAX_BREAKOUT_ROOMS = BREAKOUT_LIM > MIN_BREAKOUT_ROOMS ? BREAKOUT_LIM : MIN_BREAKOUT_ROOMS;
|
2021-06-12 00:21:26 +08:00
|
|
|
const MIN_BREAKOUT_TIME = 5;
|
2018-09-28 22:42:07 +08:00
|
|
|
|
2019-01-30 10:15:01 +08:00
|
|
|
const propTypes = {
|
2021-02-04 21:59:13 +08:00
|
|
|
intl: PropTypes.shape({
|
|
|
|
formatMessage: PropTypes.func.isRequired,
|
|
|
|
}).isRequired,
|
2021-02-09 01:40:03 +08:00
|
|
|
isMe: PropTypes.func.isRequired,
|
2019-01-30 10:15:01 +08:00
|
|
|
meetingName: PropTypes.string.isRequired,
|
|
|
|
users: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
|
|
createBreakoutRoom: PropTypes.func.isRequired,
|
2022-03-24 21:56:07 +08:00
|
|
|
getUsersNotJoined: PropTypes.func.isRequired,
|
2019-01-30 10:15:01 +08:00
|
|
|
getBreakouts: PropTypes.func.isRequired,
|
|
|
|
sendInvitation: PropTypes.func.isRequired,
|
2023-01-19 20:57:32 +08:00
|
|
|
isBreakoutRecordable: PropTypes.bool,
|
2019-01-30 10:15:01 +08:00
|
|
|
};
|
|
|
|
|
2023-03-11 02:42:57 +08:00
|
|
|
const setPresentationVisibility = (state) => {
|
|
|
|
const presentationInnerWrapper = document.getElementById('presentationInnerWrapper');
|
|
|
|
if (presentationInnerWrapper) {
|
|
|
|
presentationInnerWrapper.style.display = state;
|
|
|
|
}
|
2023-07-06 00:58:40 +08:00
|
|
|
};
|
2023-03-11 02:42:57 +08:00
|
|
|
|
2019-06-25 02:06:02 +08:00
|
|
|
class BreakoutRoom extends PureComponent {
|
2018-09-28 22:42:07 +08:00
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
2018-10-24 01:18:09 +08:00
|
|
|
this.changeNumberOfRooms = this.changeNumberOfRooms.bind(this);
|
2018-09-28 22:42:07 +08:00
|
|
|
this.changeDurationTime = this.changeDurationTime.bind(this);
|
2018-11-27 20:44:22 +08:00
|
|
|
this.changeUserRoom = this.changeUserRoom.bind(this);
|
2018-09-28 22:42:07 +08:00
|
|
|
this.increaseDurationTime = this.increaseDurationTime.bind(this);
|
|
|
|
this.decreaseDurationTime = this.decreaseDurationTime.bind(this);
|
2018-10-24 01:18:09 +08:00
|
|
|
this.onCreateBreakouts = this.onCreateBreakouts.bind(this);
|
2018-11-27 20:44:22 +08:00
|
|
|
this.setRoomUsers = this.setRoomUsers.bind(this);
|
2018-11-22 00:27:01 +08:00
|
|
|
this.setFreeJoin = this.setFreeJoin.bind(this);
|
2018-11-27 20:44:22 +08:00
|
|
|
this.getUserByRoom = this.getUserByRoom.bind(this);
|
2018-12-17 21:48:42 +08:00
|
|
|
this.onAssignRandomly = this.onAssignRandomly.bind(this);
|
2021-11-11 21:10:31 +08:00
|
|
|
this.onAssignReset = this.onAssignReset.bind(this);
|
2018-12-28 00:20:03 +08:00
|
|
|
this.onInviteBreakout = this.onInviteBreakout.bind(this);
|
2018-11-27 20:44:22 +08:00
|
|
|
this.renderUserItemByRoom = this.renderUserItemByRoom.bind(this);
|
|
|
|
this.renderRoomsGrid = this.renderRoomsGrid.bind(this);
|
|
|
|
this.renderBreakoutForm = this.renderBreakoutForm.bind(this);
|
2023-06-30 21:53:58 +08:00
|
|
|
this.renderCheckboxes = this.renderUnassingUsers.bind(this);
|
2018-12-14 20:33:58 +08:00
|
|
|
this.renderRoomSortList = this.renderRoomSortList.bind(this);
|
|
|
|
this.renderDesktop = this.renderDesktop.bind(this);
|
|
|
|
this.renderMobile = this.renderMobile.bind(this);
|
|
|
|
this.renderButtonSetLevel = this.renderButtonSetLevel.bind(this);
|
|
|
|
this.renderSelectUserScreen = this.renderSelectUserScreen.bind(this);
|
2018-12-28 00:20:03 +08:00
|
|
|
this.renderTitle = this.renderTitle.bind(this);
|
2018-11-30 03:47:04 +08:00
|
|
|
this.handleDismiss = this.handleDismiss.bind(this);
|
2018-12-28 00:20:03 +08:00
|
|
|
this.setInvitationConfig = this.setInvitationConfig.bind(this);
|
2019-04-12 04:12:22 +08:00
|
|
|
this.setRecord = this.setRecord.bind(this);
|
2022-09-20 23:43:13 +08:00
|
|
|
this.setCaptureNotes = this.setCaptureNotes.bind(this);
|
2023-07-06 00:58:40 +08:00
|
|
|
this.setInviteMods = this.setInviteMods.bind(this);
|
2022-10-20 01:09:11 +08:00
|
|
|
this.setCaptureSlides = this.setCaptureSlides.bind(this);
|
2019-03-07 04:22:20 +08:00
|
|
|
this.blurDurationTime = this.blurDurationTime.bind(this);
|
2019-05-01 03:24:04 +08:00
|
|
|
this.removeRoomUsers = this.removeRoomUsers.bind(this);
|
2019-06-14 21:54:59 +08:00
|
|
|
this.renderErrorMessages = this.renderErrorMessages.bind(this);
|
2022-03-24 21:56:07 +08:00
|
|
|
this.onUpdateBreakouts = this.onUpdateBreakouts.bind(this);
|
2018-11-28 02:00:15 +08:00
|
|
|
|
2018-09-28 22:42:07 +08:00
|
|
|
this.state = {
|
2018-10-24 01:53:46 +08:00
|
|
|
numberOfRooms: MIN_BREAKOUT_ROOMS,
|
2022-03-24 21:56:07 +08:00
|
|
|
selectedId: '',
|
2018-11-27 20:44:22 +08:00
|
|
|
users: [],
|
2019-03-07 01:04:37 +08:00
|
|
|
durationTime: 15,
|
2018-11-27 20:44:22 +08:00
|
|
|
freeJoin: false,
|
2018-12-14 20:33:58 +08:00
|
|
|
formFillLevel: 1,
|
2021-06-12 03:06:56 +08:00
|
|
|
roomNamesChanged: [],
|
2018-12-14 20:33:58 +08:00
|
|
|
roomSelected: 0,
|
2018-11-30 03:47:04 +08:00
|
|
|
preventClosing: true,
|
2023-07-06 00:58:40 +08:00
|
|
|
leastOneUserIsValid: null,
|
2019-06-14 21:54:59 +08:00
|
|
|
numberOfRoomsIsValid: true,
|
2021-06-12 03:06:56 +08:00
|
|
|
roomNameDuplicatedIsValid: true,
|
|
|
|
roomNameEmptyIsValid: true,
|
|
|
|
record: false,
|
2022-09-20 23:43:13 +08:00
|
|
|
captureNotes: false,
|
2023-07-06 00:58:40 +08:00
|
|
|
inviteMods: false,
|
2022-10-20 01:09:11 +08:00
|
|
|
captureSlides: false,
|
2021-06-12 00:21:26 +08:00
|
|
|
durationIsValid: true,
|
2020-01-22 23:31:53 +08:00
|
|
|
breakoutJoinedUsers: null,
|
2018-09-28 22:42:07 +08:00
|
|
|
};
|
2019-01-11 02:51:19 +08:00
|
|
|
|
2023-02-23 22:23:51 +08:00
|
|
|
this.btnLevelId = uniqueId('btn-set-level-');
|
2021-04-19 08:46:07 +08:00
|
|
|
|
|
|
|
this.handleMoveEvent = this.handleMoveEvent.bind(this);
|
|
|
|
this.handleShiftUser = this.handleShiftUser.bind(this);
|
2018-09-28 22:42:07 +08:00
|
|
|
}
|
|
|
|
|
2018-11-27 20:44:22 +08:00
|
|
|
componentDidMount() {
|
2021-11-11 21:10:31 +08:00
|
|
|
const {
|
2022-04-15 01:38:14 +08:00
|
|
|
breakoutJoinedUsers, getLastBreakouts, groups, isUpdate,
|
2023-01-23 23:35:43 +08:00
|
|
|
allowUserChooseRoomByDefault, captureSharedNotesByDefault,
|
2023-07-06 00:58:40 +08:00
|
|
|
captureWhiteboardByDefault, inviteModsByDefault,
|
2021-11-11 21:10:31 +08:00
|
|
|
} = this.props;
|
2023-03-11 02:42:57 +08:00
|
|
|
setPresentationVisibility('none');
|
2018-11-27 20:44:22 +08:00
|
|
|
this.setRoomUsers();
|
2022-03-24 21:56:07 +08:00
|
|
|
if (isUpdate) {
|
|
|
|
const usersToMerge = []
|
|
|
|
breakoutJoinedUsers.forEach((breakout) => {
|
|
|
|
breakout.joinedUsers.forEach((user) => {
|
|
|
|
usersToMerge.push({
|
|
|
|
userId: user.userId,
|
|
|
|
userName: user.name,
|
|
|
|
from: breakout.sequence,
|
|
|
|
room: breakout.sequence,
|
|
|
|
isModerator: user.role === ROLE_MODERATOR,
|
|
|
|
joined: true,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
this.setState((prevState) => {
|
|
|
|
return {
|
|
|
|
users: [
|
|
|
|
...prevState.users,
|
|
|
|
...usersToMerge,
|
|
|
|
],
|
|
|
|
};
|
|
|
|
});
|
|
|
|
}
|
2023-01-14 04:37:42 +08:00
|
|
|
this.setState({
|
2023-01-23 23:35:43 +08:00
|
|
|
freeJoin: allowUserChooseRoomByDefault,
|
|
|
|
captureSlides: captureWhiteboardByDefault,
|
|
|
|
captureNotes: captureSharedNotesByDefault,
|
2023-07-06 00:58:40 +08:00
|
|
|
inviteMods: inviteModsByDefault,
|
2023-01-14 04:37:42 +08:00
|
|
|
});
|
2022-03-24 21:56:07 +08:00
|
|
|
|
2021-11-11 21:10:31 +08:00
|
|
|
const lastBreakouts = getLastBreakouts();
|
|
|
|
if (lastBreakouts.length > 0) {
|
2021-11-13 04:02:29 +08:00
|
|
|
this.populateWithLastBreakouts(lastBreakouts);
|
2021-11-11 21:10:31 +08:00
|
|
|
} else if (groups && groups.length > 0) {
|
2021-11-13 04:02:29 +08:00
|
|
|
this.populateWithGroups(groups);
|
2021-11-11 21:10:31 +08:00
|
|
|
}
|
2018-11-27 20:44:22 +08:00
|
|
|
}
|
|
|
|
|
2021-08-09 22:24:02 +08:00
|
|
|
componentDidUpdate(prevProps, prevstate) {
|
|
|
|
if (this.listOfUsers) {
|
|
|
|
for (let i = 0; i < this.listOfUsers.children.length; i += 1) {
|
2021-10-11 03:34:41 +08:00
|
|
|
const roomWrapperChildren = this.listOfUsers.children[i].getElementsByTagName('div');
|
|
|
|
const roomList = roomWrapperChildren[roomWrapperChildren.length > 1 ? 1 : 0];
|
2021-08-09 22:24:02 +08:00
|
|
|
roomList.addEventListener('keydown', this.handleMoveEvent, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-08 03:56:42 +08:00
|
|
|
const unassignedUsers = document.getElementById('breakoutBox-0');
|
|
|
|
if (unassignedUsers) {
|
|
|
|
unassignedUsers.addEventListener('keydown', this.handleMoveEvent, true);
|
|
|
|
}
|
|
|
|
|
2021-08-09 22:24:02 +08:00
|
|
|
const { numberOfRooms } = this.state;
|
|
|
|
const { users } = this.props;
|
|
|
|
const { users: prevUsers } = prevProps;
|
|
|
|
if (numberOfRooms < prevstate.numberOfRooms) {
|
|
|
|
this.resetUserWhenRoomsChange(numberOfRooms);
|
|
|
|
}
|
|
|
|
const usersCount = users.length;
|
|
|
|
const prevUsersCount = prevUsers.length;
|
|
|
|
if (usersCount > prevUsersCount) {
|
|
|
|
this.setRoomUsers();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (usersCount < prevUsersCount) {
|
|
|
|
this.removeRoomUsers();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
componentWillUnmount() {
|
|
|
|
if (this.listOfUsers) {
|
|
|
|
for (let i = 0; i < this.listOfUsers.children.length; i += 1) {
|
|
|
|
const roomList = this.listOfUsers.children[i].getElementsByTagName('div')[0];
|
|
|
|
roomList.removeEventListener('keydown', this.handleMoveEvent, true);
|
|
|
|
}
|
|
|
|
}
|
2023-07-08 03:56:42 +08:00
|
|
|
const unassignedUsers = document.getElementById('breakoutBox-0');
|
|
|
|
if (unassignedUsers) {
|
|
|
|
unassignedUsers.removeEventListener('keydown', this.handleMoveEvent, true);
|
|
|
|
}
|
2021-08-09 22:24:02 +08:00
|
|
|
}
|
|
|
|
|
2021-04-19 08:46:07 +08:00
|
|
|
handleShiftUser(activeListSibling) {
|
|
|
|
const { users } = this.state;
|
|
|
|
if (activeListSibling) {
|
2021-08-17 04:10:40 +08:00
|
|
|
const text = activeListSibling.getElementsByTagName('input')[0].value;
|
2021-05-03 04:02:38 +08:00
|
|
|
const roomNumber = text.match(/\d/g).join('');
|
2021-08-09 22:24:02 +08:00
|
|
|
users.forEach((u, index) => {
|
2021-10-26 03:21:27 +08:00
|
|
|
if (`roomUserItem-${u.userId}` === document.activeElement.id) {
|
2021-08-09 22:24:02 +08:00
|
|
|
users[index].room = text.substr(text.length - 1).includes(')') ? 0 : parseInt(roomNumber, 10);
|
2022-10-20 22:37:11 +08:00
|
|
|
this.changeUserRoom(u.userId, users[index].room);
|
2021-04-19 08:46:07 +08:00
|
|
|
}
|
2021-05-03 04:02:38 +08:00
|
|
|
});
|
2023-07-08 03:56:42 +08:00
|
|
|
} else {
|
|
|
|
users.forEach((u, index) => {
|
|
|
|
if (`roomUserItem-${u.userId}` === document.activeElement.id) {
|
|
|
|
this.changeUserRoom(u.userId, 0);
|
|
|
|
}
|
|
|
|
});
|
2021-04-19 08:46:07 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
handleMoveEvent(event) {
|
|
|
|
if (this.listOfUsers) {
|
2021-05-03 04:02:38 +08:00
|
|
|
const { activeElement } = document;
|
|
|
|
|
|
|
|
if (event.key.includes('ArrowDown')) {
|
|
|
|
const {
|
2021-10-26 03:21:27 +08:00
|
|
|
nextElementSibling, id, childNodes, parentElement,
|
2021-05-03 04:02:38 +08:00
|
|
|
} = activeElement;
|
2021-10-26 03:21:27 +08:00
|
|
|
if (id.includes('breakoutBox')) return childNodes[0].focus();
|
2021-05-03 04:02:38 +08:00
|
|
|
|
2021-10-26 03:21:27 +08:00
|
|
|
if (id.includes('roomUserItem')) {
|
2021-05-03 04:02:38 +08:00
|
|
|
if (!nextElementSibling) {
|
|
|
|
return parentElement.firstElementChild.focus();
|
|
|
|
}
|
|
|
|
return nextElementSibling.focus();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (event.key.includes('ArrowUp')) {
|
|
|
|
const {
|
2021-10-26 03:21:27 +08:00
|
|
|
previousElementSibling, id, childNodes, parentElement,
|
2021-05-03 04:02:38 +08:00
|
|
|
} = activeElement;
|
2021-10-26 03:21:27 +08:00
|
|
|
if (id.includes('breakoutBox')) return childNodes[childNodes.length - 1].focus();
|
2021-05-03 04:02:38 +08:00
|
|
|
|
2021-10-26 03:21:27 +08:00
|
|
|
if (id.includes('roomUserItem')) {
|
2021-05-03 04:02:38 +08:00
|
|
|
if (!previousElementSibling) {
|
|
|
|
return parentElement.lastElementChild.focus();
|
|
|
|
}
|
|
|
|
return previousElementSibling.focus();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (event.key.includes('ArrowRight')) {
|
|
|
|
const { parentElement: listContainer } = activeElement;
|
2021-10-26 03:21:27 +08:00
|
|
|
if (listContainer.id.includes('breakoutBox')) {
|
2021-05-03 04:02:38 +08:00
|
|
|
this.handleShiftUser(listContainer.parentElement.nextSibling);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (event.key.includes('ArrowLeft')) {
|
|
|
|
const { parentElement: listContainer } = activeElement;
|
2021-10-26 03:21:27 +08:00
|
|
|
if (listContainer.id.includes('breakoutBox')) {
|
2021-05-03 04:02:38 +08:00
|
|
|
this.handleShiftUser(listContainer.parentElement.previousSibling);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-19 08:46:07 +08:00
|
|
|
this.setRoomUsers();
|
|
|
|
}
|
2021-08-09 22:24:02 +08:00
|
|
|
return true;
|
2021-04-19 08:46:07 +08:00
|
|
|
}
|
|
|
|
|
2021-08-09 22:24:02 +08:00
|
|
|
handleDismiss() {
|
2023-03-22 04:45:20 +08:00
|
|
|
const { setIsOpen } = this.props;
|
2023-03-11 02:42:57 +08:00
|
|
|
setPresentationVisibility('block');
|
2021-08-09 22:24:02 +08:00
|
|
|
return new Promise((resolve) => {
|
2023-03-22 04:45:20 +08:00
|
|
|
setIsOpen(false);
|
2019-05-01 03:24:04 +08:00
|
|
|
|
2021-08-09 22:24:02 +08:00
|
|
|
this.setState({
|
|
|
|
preventClosing: false,
|
|
|
|
}, resolve);
|
|
|
|
});
|
2018-11-27 20:44:22 +08:00
|
|
|
}
|
|
|
|
|
2018-10-24 01:18:09 +08:00
|
|
|
onCreateBreakouts() {
|
2023-03-11 02:42:57 +08:00
|
|
|
setPresentationVisibility('block');
|
2018-10-24 01:18:09 +08:00
|
|
|
const {
|
|
|
|
createBreakoutRoom,
|
|
|
|
} = this.props;
|
2018-12-20 01:08:01 +08:00
|
|
|
const {
|
|
|
|
users,
|
|
|
|
freeJoin,
|
2019-04-12 04:12:22 +08:00
|
|
|
record,
|
2022-09-20 23:43:13 +08:00
|
|
|
captureNotes,
|
2022-10-20 01:09:11 +08:00
|
|
|
captureSlides,
|
2019-06-14 21:54:59 +08:00
|
|
|
numberOfRoomsIsValid,
|
2021-06-12 03:06:56 +08:00
|
|
|
numberOfRooms,
|
|
|
|
durationTime,
|
2021-06-12 00:21:26 +08:00
|
|
|
durationIsValid,
|
2023-07-06 00:58:40 +08:00
|
|
|
inviteMods,
|
2018-12-20 01:08:01 +08:00
|
|
|
} = this.state;
|
2018-10-24 01:18:09 +08:00
|
|
|
|
2021-06-12 00:21:26 +08:00
|
|
|
if ((durationTime || 0) < MIN_BREAKOUT_TIME) {
|
|
|
|
this.setState({ durationIsValid: false });
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-01-29 01:04:32 +08:00
|
|
|
if (users.length === this.getUserByRoom(0).length && !freeJoin) {
|
2021-06-12 03:06:56 +08:00
|
|
|
this.setState({ leastOneUserIsValid: false });
|
2018-11-30 03:47:04 +08:00
|
|
|
return;
|
|
|
|
}
|
2019-06-14 21:54:59 +08:00
|
|
|
|
2021-06-12 00:21:26 +08:00
|
|
|
if (!numberOfRoomsIsValid || !durationIsValid) {
|
2019-06-14 21:54:59 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-02-22 01:57:34 +08:00
|
|
|
const duplicatedNames = range(1, numberOfRooms + 1).filter((n) => this.hasNameDuplicated(n));
|
2021-06-12 03:06:56 +08:00
|
|
|
if (duplicatedNames.length > 0) {
|
|
|
|
this.setState({ roomNameDuplicatedIsValid: false });
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-02-22 01:57:34 +08:00
|
|
|
const emptyNames = range(1, numberOfRooms + 1)
|
2021-08-09 22:24:02 +08:00
|
|
|
.filter((n) => this.getRoomName(n).length === 0);
|
2021-06-12 03:06:56 +08:00
|
|
|
if (emptyNames.length > 0) {
|
|
|
|
this.setState({ roomNameEmptyIsValid: false });
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-09-06 21:07:14 +08:00
|
|
|
this.handleDismiss();
|
2021-06-12 03:06:56 +08:00
|
|
|
|
2023-02-22 01:57:34 +08:00
|
|
|
const rooms = range(1, numberOfRooms + 1).map((seq) => ({
|
2021-06-12 03:06:56 +08:00
|
|
|
users: this.getUserByRoom(seq).map((u) => u.userId),
|
2021-06-15 03:59:27 +08:00
|
|
|
name: this.getFullName(seq),
|
2023-01-17 07:10:13 +08:00
|
|
|
captureNotesFilename: this.getCaptureFilename(seq, false),
|
|
|
|
captureSlidesFilename: this.getCaptureFilename(seq),
|
2021-06-15 03:59:27 +08:00
|
|
|
shortName: this.getRoomName(seq),
|
|
|
|
isDefaultName: !this.hasNameChanged(seq),
|
2018-12-20 01:08:01 +08:00
|
|
|
freeJoin,
|
2021-06-12 03:06:56 +08:00
|
|
|
sequence: seq,
|
2018-10-30 03:29:45 +08:00
|
|
|
}));
|
2018-10-24 01:18:09 +08:00
|
|
|
|
2023-07-06 00:58:40 +08:00
|
|
|
createBreakoutRoom(rooms, durationTime, record, captureNotes, captureSlides, inviteMods);
|
2018-11-30 03:47:04 +08:00
|
|
|
Session.set('isUserListOpen', true);
|
2018-10-24 01:18:09 +08:00
|
|
|
}
|
|
|
|
|
2018-12-28 00:20:03 +08:00
|
|
|
onInviteBreakout() {
|
2018-12-28 19:51:41 +08:00
|
|
|
const { getBreakouts, sendInvitation } = this.props;
|
2021-06-12 03:06:56 +08:00
|
|
|
const { users, freeJoin } = this.state;
|
2018-12-28 00:20:03 +08:00
|
|
|
const breakouts = getBreakouts();
|
2021-06-12 03:06:56 +08:00
|
|
|
if (users.length === this.getUserByRoom(0).length && !freeJoin) {
|
|
|
|
this.setState({ leastOneUserIsValid: false });
|
2018-12-28 00:20:03 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-01-17 01:41:21 +08:00
|
|
|
breakouts.forEach((breakout) => {
|
|
|
|
const { breakoutId } = breakout;
|
|
|
|
const breakoutUsers = this.getUserByRoom(breakout.sequence);
|
2021-05-03 04:02:38 +08:00
|
|
|
breakoutUsers.forEach((user) => sendInvitation(breakoutId, user.userId));
|
2019-01-17 01:41:21 +08:00
|
|
|
});
|
2018-12-28 00:20:03 +08:00
|
|
|
|
2021-09-06 21:07:14 +08:00
|
|
|
this.handleDismiss();
|
2018-12-28 00:20:03 +08:00
|
|
|
}
|
|
|
|
|
2022-03-24 21:56:07 +08:00
|
|
|
getBreakoutBySequence(sequence) {
|
|
|
|
const { getBreakouts } = this.props;
|
|
|
|
const breakouts = getBreakouts();
|
|
|
|
|
|
|
|
return breakouts.find((breakout) => breakout.sequence === sequence);
|
|
|
|
}
|
|
|
|
|
|
|
|
changeUserBreakout(fromBreakoutId, toBreakoutId, userId) {
|
|
|
|
const { moveUser } = this.props;
|
|
|
|
|
|
|
|
moveUser(fromBreakoutId, toBreakoutId, userId);
|
|
|
|
}
|
|
|
|
|
|
|
|
onUpdateBreakouts() {
|
2023-03-11 02:42:57 +08:00
|
|
|
setPresentationVisibility('block');
|
2022-03-24 21:56:07 +08:00
|
|
|
const { users } = this.state;
|
|
|
|
const leastOneUserIsValid = users.some((user) => user.from !== user.room);
|
|
|
|
|
|
|
|
if (!leastOneUserIsValid) {
|
|
|
|
this.setState({ leastOneUserIsValid });
|
|
|
|
}
|
|
|
|
|
|
|
|
users.forEach((user) => {
|
|
|
|
const { from, room } = user;
|
|
|
|
let { userId } = user;
|
|
|
|
|
2022-04-13 00:56:54 +08:00
|
|
|
if (from === room) return;
|
2022-03-24 21:56:07 +08:00
|
|
|
|
2022-04-13 00:56:54 +08:00
|
|
|
let toBreakoutId = '';
|
|
|
|
if (room !== 0) {
|
|
|
|
const toBreakout = this.getBreakoutBySequence(room);
|
|
|
|
toBreakoutId = toBreakout.breakoutId;
|
2022-04-12 20:50:19 +08:00
|
|
|
}
|
2022-03-24 21:56:07 +08:00
|
|
|
|
2022-04-13 00:56:54 +08:00
|
|
|
let fromBreakoutId = '';
|
|
|
|
if (from !== 0) {
|
|
|
|
[userId] = userId.split('-');
|
|
|
|
const fromBreakout = this.getBreakoutBySequence(from);
|
|
|
|
fromBreakoutId = fromBreakout.breakoutId;
|
|
|
|
}
|
2022-03-24 21:56:07 +08:00
|
|
|
|
|
|
|
this.changeUserBreakout(fromBreakoutId, toBreakoutId, userId);
|
|
|
|
});
|
|
|
|
|
|
|
|
this.handleDismiss();
|
|
|
|
}
|
|
|
|
|
2018-12-17 21:48:42 +08:00
|
|
|
onAssignRandomly() {
|
|
|
|
const { numberOfRooms } = this.state;
|
2023-07-06 00:58:40 +08:00
|
|
|
this.setState({ hasUsersAssign: false });
|
2019-06-13 06:58:56 +08:00
|
|
|
const { users } = this.state;
|
2019-06-14 01:36:22 +08:00
|
|
|
// We only want to assign viewers so filter out the moderators. We also want to get
|
|
|
|
// all users each run so that clicking the button again will reshuffle
|
2021-05-03 04:02:38 +08:00
|
|
|
const viewers = users.filter((user) => !user.isModerator);
|
2019-06-14 01:36:22 +08:00
|
|
|
// We want to keep assigning users until all viewers have been assigned a room
|
2019-06-13 06:58:56 +08:00
|
|
|
while (viewers.length > 0) {
|
2019-06-14 01:36:22 +08:00
|
|
|
// We cycle through the rooms picking one user for each room so that the rooms
|
|
|
|
// will have an equal number of people in each one
|
2019-06-29 04:52:19 +08:00
|
|
|
for (let i = 1; i <= numberOfRooms && viewers.length > 0; i += 1) {
|
2019-06-14 01:36:22 +08:00
|
|
|
// Select a random user for the room
|
2019-06-13 06:58:56 +08:00
|
|
|
const userIdx = Math.floor(Math.random() * (viewers.length));
|
|
|
|
this.changeUserRoom(viewers[userIdx].userId, i);
|
2019-06-14 01:36:22 +08:00
|
|
|
// Remove the picked user so they aren't selected again
|
2019-06-13 06:58:56 +08:00
|
|
|
viewers.splice(userIdx, 1);
|
|
|
|
}
|
|
|
|
}
|
2018-12-17 21:48:42 +08:00
|
|
|
}
|
|
|
|
|
2021-11-11 21:10:31 +08:00
|
|
|
onAssignReset() {
|
|
|
|
const { users } = this.state;
|
2023-07-06 00:58:40 +08:00
|
|
|
this.setState({ hasUsersAssign: true });
|
2021-11-11 21:10:31 +08:00
|
|
|
|
|
|
|
users.forEach((u) => {
|
|
|
|
if (u.room !== null && u.room > 0) {
|
|
|
|
this.changeUserRoom(u.userId, 0);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2018-12-28 00:20:03 +08:00
|
|
|
setInvitationConfig() {
|
|
|
|
const { getBreakouts } = this.props;
|
|
|
|
this.setState({
|
|
|
|
numberOfRooms: getBreakouts().length,
|
|
|
|
formFillLevel: 2,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2018-11-27 20:44:22 +08:00
|
|
|
setRoomUsers() {
|
2022-03-24 21:56:07 +08:00
|
|
|
const { users, getUsersNotJoined } = this.props;
|
2019-05-01 03:24:04 +08:00
|
|
|
const { users: stateUsers } = this.state;
|
2021-05-03 04:02:38 +08:00
|
|
|
const stateUsersId = stateUsers.map((user) => user.userId);
|
2022-03-24 21:56:07 +08:00
|
|
|
const roomUsers = getUsersNotJoined(users)
|
2021-05-03 04:02:38 +08:00
|
|
|
.filter((user) => !stateUsersId.includes(user.userId))
|
|
|
|
.map((user) => ({
|
2019-05-01 03:24:04 +08:00
|
|
|
userId: user.userId,
|
2022-04-07 01:35:44 +08:00
|
|
|
extId: user.extId,
|
2019-05-01 03:24:04 +08:00
|
|
|
userName: user.name,
|
2019-06-29 04:52:19 +08:00
|
|
|
isModerator: user.role === ROLE_MODERATOR,
|
2022-03-24 21:56:07 +08:00
|
|
|
from: 0,
|
2019-05-01 03:24:04 +08:00
|
|
|
room: 0,
|
|
|
|
}));
|
2018-11-27 20:44:22 +08:00
|
|
|
|
|
|
|
this.setState({
|
2019-05-01 03:24:04 +08:00
|
|
|
users: [
|
|
|
|
...stateUsers,
|
|
|
|
...roomUsers,
|
|
|
|
],
|
2018-11-27 20:44:22 +08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2018-11-22 00:29:20 +08:00
|
|
|
setFreeJoin(e) {
|
2021-06-12 03:06:56 +08:00
|
|
|
this.setState({ freeJoin: e.target.checked, leastOneUserIsValid: true });
|
2018-09-28 22:42:07 +08:00
|
|
|
}
|
|
|
|
|
2019-04-12 04:12:22 +08:00
|
|
|
setRecord(e) {
|
|
|
|
this.setState({ record: e.target.checked });
|
|
|
|
}
|
|
|
|
|
2022-09-20 23:43:13 +08:00
|
|
|
setCaptureNotes(e) {
|
|
|
|
this.setState({ captureNotes: e.target.checked });
|
|
|
|
}
|
|
|
|
|
2023-07-06 00:58:40 +08:00
|
|
|
setInviteMods(e) {
|
|
|
|
this.setState({ inviteMods: e.target.checked });
|
|
|
|
}
|
|
|
|
|
2022-10-20 01:09:11 +08:00
|
|
|
setCaptureSlides(e) {
|
|
|
|
this.setState({ captureSlides: e.target.checked });
|
2022-09-06 01:27:38 +08:00
|
|
|
}
|
|
|
|
|
2018-11-27 20:44:22 +08:00
|
|
|
getUserByRoom(room) {
|
2018-12-20 01:08:01 +08:00
|
|
|
const { users } = this.state;
|
2021-05-03 04:02:38 +08:00
|
|
|
return users.filter((user) => user.room === room);
|
2018-11-27 20:44:22 +08:00
|
|
|
}
|
|
|
|
|
2020-01-22 23:31:53 +08:00
|
|
|
getUsersByRoomSequence(sequence) {
|
|
|
|
const { breakoutJoinedUsers } = this.state;
|
|
|
|
if (!breakoutJoinedUsers) return [];
|
2021-05-03 04:02:38 +08:00
|
|
|
return breakoutJoinedUsers.filter((room) => room.sequence === sequence)[0].joinedUsers || [];
|
2020-01-22 23:31:53 +08:00
|
|
|
}
|
|
|
|
|
2023-01-19 07:51:06 +08:00
|
|
|
getRoomName(position, padWithZeroes = false) {
|
2021-08-09 22:24:02 +08:00
|
|
|
const { intl } = this.props;
|
|
|
|
const { roomNamesChanged } = this.state;
|
2019-05-01 03:24:04 +08:00
|
|
|
|
2021-08-09 22:24:02 +08:00
|
|
|
if (this.hasNameChanged(position)) {
|
|
|
|
return roomNamesChanged[position];
|
|
|
|
}
|
2019-05-01 03:24:04 +08:00
|
|
|
|
2023-01-19 07:51:06 +08:00
|
|
|
return intl.formatMessage(intlMessages.breakoutRoom, {
|
|
|
|
0: padWithZeroes ? `${position}`.padStart(2, '0') : position
|
|
|
|
});
|
2021-08-09 22:24:02 +08:00
|
|
|
}
|
2018-11-30 03:47:04 +08:00
|
|
|
|
2021-08-09 22:24:02 +08:00
|
|
|
getFullName(position) {
|
|
|
|
const { meetingName } = this.props;
|
2018-11-30 03:47:04 +08:00
|
|
|
|
2021-08-09 22:24:02 +08:00
|
|
|
return `${meetingName} (${this.getRoomName(position)})`;
|
2018-11-30 03:47:04 +08:00
|
|
|
}
|
|
|
|
|
2023-01-17 06:00:27 +08:00
|
|
|
getCaptureFilename(position, slides = true) {
|
|
|
|
const { intl } = this.props;
|
|
|
|
const presentations = PresentationUploaderService.getPresentations();
|
|
|
|
|
|
|
|
const captureType = slides
|
|
|
|
? intl.formatMessage(intlMessages.captureSlidesType)
|
|
|
|
: intl.formatMessage(intlMessages.captureNotesType);
|
|
|
|
|
2023-06-30 21:53:58 +08:00
|
|
|
const fileName = `${this.getRoomName(position, true)}_${captureType}`.replace(/ /g, '_');
|
2023-01-17 06:00:27 +08:00
|
|
|
|
2023-01-19 07:51:06 +08:00
|
|
|
const fileNameDuplicatedCount = presentations.filter((pres) => pres.filename?.startsWith(fileName)
|
2023-06-30 21:53:58 +08:00
|
|
|
|| pres.name?.startsWith(fileName)).length;
|
2023-01-17 06:00:27 +08:00
|
|
|
|
2023-01-19 07:51:06 +08:00
|
|
|
return fileNameDuplicatedCount === 0 ? fileName : `${fileName}(${fileNameDuplicatedCount + 1})`;
|
2023-01-17 06:00:27 +08:00
|
|
|
}
|
|
|
|
|
2018-11-27 20:44:22 +08:00
|
|
|
resetUserWhenRoomsChange(rooms) {
|
|
|
|
const { users } = this.state;
|
2021-05-03 04:02:38 +08:00
|
|
|
const filtredUsers = users.filter((u) => u.room > rooms);
|
|
|
|
filtredUsers.forEach((u) => this.changeUserRoom(u.userId, 0));
|
2018-11-27 20:44:22 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
changeUserRoom(userId, room) {
|
2022-10-24 21:48:38 +08:00
|
|
|
const { intl } = this.props;
|
2021-06-12 03:06:56 +08:00
|
|
|
const { users, freeJoin } = this.state;
|
2018-12-28 00:20:03 +08:00
|
|
|
|
2021-10-26 03:58:37 +08:00
|
|
|
const idxUser = users.findIndex((user) => user.userId === userId.replace('roomUserItem-', ''));
|
2019-08-28 23:56:56 +08:00
|
|
|
|
|
|
|
const usersCopy = [...users];
|
2022-10-20 22:37:11 +08:00
|
|
|
let userName = null;
|
2019-08-28 23:56:56 +08:00
|
|
|
|
2022-10-20 22:37:11 +08:00
|
|
|
if (idxUser >= 0) {
|
|
|
|
usersCopy[idxUser].room = room;
|
|
|
|
userName = usersCopy[idxUser].userName;
|
|
|
|
};
|
2019-08-28 23:56:56 +08:00
|
|
|
|
2019-06-14 21:54:59 +08:00
|
|
|
this.setState({
|
2019-08-28 23:56:56 +08:00
|
|
|
users: usersCopy,
|
2021-06-12 03:06:56 +08:00
|
|
|
leastOneUserIsValid: (this.getUserByRoom(0).length !== users.length || freeJoin),
|
2022-10-20 22:37:11 +08:00
|
|
|
}, () => {
|
|
|
|
addNewAlert(intl.formatMessage(intlMessages.movedUserLabel, { 0: userName, 1: room }))
|
2019-06-14 21:54:59 +08:00
|
|
|
});
|
2018-11-27 20:44:22 +08:00
|
|
|
}
|
|
|
|
|
2018-09-28 22:42:07 +08:00
|
|
|
increaseDurationTime() {
|
2018-12-20 01:08:01 +08:00
|
|
|
const { durationTime } = this.state;
|
2021-06-16 00:17:03 +08:00
|
|
|
const number = ((1 * durationTime) + 1);
|
|
|
|
const newDurationTime = number > MIN_BREAKOUT_TIME ? number : MIN_BREAKOUT_TIME;
|
2021-06-12 00:21:26 +08:00
|
|
|
|
2021-06-16 00:17:03 +08:00
|
|
|
this.setState({ durationTime: newDurationTime, durationIsValid: true });
|
2018-09-28 22:42:07 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
decreaseDurationTime() {
|
2018-12-20 01:08:01 +08:00
|
|
|
const { durationTime } = this.state;
|
|
|
|
const number = ((1 * durationTime) - 1);
|
2021-06-16 00:17:03 +08:00
|
|
|
const newDurationTime = number > MIN_BREAKOUT_TIME ? number : MIN_BREAKOUT_TIME;
|
2021-06-12 00:21:26 +08:00
|
|
|
|
2021-06-16 00:17:03 +08:00
|
|
|
this.setState({ durationTime: newDurationTime, durationIsValid: true });
|
2018-09-28 22:42:07 +08:00
|
|
|
}
|
|
|
|
|
2018-11-22 00:29:20 +08:00
|
|
|
changeDurationTime(event) {
|
2021-06-12 00:21:26 +08:00
|
|
|
const durationTime = Number.parseInt(event.target.value, 10) || '';
|
|
|
|
const durationIsValid = durationTime >= MIN_BREAKOUT_TIME;
|
|
|
|
|
|
|
|
this.setState({ durationTime, durationIsValid });
|
2018-11-22 00:29:20 +08:00
|
|
|
}
|
|
|
|
|
2019-03-07 04:22:20 +08:00
|
|
|
blurDurationTime(event) {
|
2019-04-05 01:40:07 +08:00
|
|
|
const value = Number.parseInt(event.target.value, 10);
|
|
|
|
this.setState({ durationTime: !(value <= 0) ? value : 1 });
|
2019-03-07 04:22:20 +08:00
|
|
|
}
|
|
|
|
|
2018-11-22 00:29:20 +08:00
|
|
|
changeNumberOfRooms(event) {
|
2019-06-14 21:54:59 +08:00
|
|
|
const numberOfRooms = Number.parseInt(event.target.value, 10);
|
|
|
|
this.setState({
|
|
|
|
numberOfRooms,
|
|
|
|
numberOfRoomsIsValid: numberOfRooms <= MAX_BREAKOUT_ROOMS
|
2021-06-12 00:21:26 +08:00
|
|
|
&& numberOfRooms >= MIN_BREAKOUT_ROOMS,
|
2019-06-14 21:54:59 +08:00
|
|
|
});
|
2018-11-22 00:27:01 +08:00
|
|
|
}
|
|
|
|
|
2021-08-09 22:24:02 +08:00
|
|
|
removeRoomUsers() {
|
|
|
|
const { users } = this.props;
|
|
|
|
const { users: stateUsers } = this.state;
|
|
|
|
const userIds = users.map((user) => user.userId);
|
|
|
|
const removeUsers = stateUsers.filter((user) => userIds.includes(user.userId));
|
2021-06-15 03:59:27 +08:00
|
|
|
|
2021-08-09 22:24:02 +08:00
|
|
|
this.setState({
|
|
|
|
users: removeUsers,
|
|
|
|
});
|
2021-06-15 03:59:27 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
hasNameChanged(position) {
|
|
|
|
const { intl } = this.props;
|
|
|
|
const { roomNamesChanged } = this.state;
|
|
|
|
|
|
|
|
if (typeof roomNamesChanged[position] !== 'undefined'
|
2021-08-09 22:24:02 +08:00
|
|
|
&& roomNamesChanged[position] !== intl
|
|
|
|
.formatMessage(intlMessages.breakoutRoom, { 0: position })) {
|
2021-06-15 03:59:27 +08:00
|
|
|
return true;
|
|
|
|
}
|
2021-08-09 22:24:02 +08:00
|
|
|
return false;
|
2021-06-12 03:06:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
hasNameDuplicated(position) {
|
|
|
|
const { numberOfRooms } = this.state;
|
|
|
|
const currName = this.getRoomName(position).trim();
|
2023-02-22 01:57:34 +08:00
|
|
|
const equals = range(1, numberOfRooms + 1)
|
2021-06-12 03:06:56 +08:00
|
|
|
.filter((n) => this.getRoomName(n).trim() === currName);
|
|
|
|
if (equals.length > 1) return true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-11-13 04:02:29 +08:00
|
|
|
populateWithLastBreakouts(lastBreakouts) {
|
2022-12-16 04:28:44 +08:00
|
|
|
const { getBreakoutUserWasIn, users, intl } = this.props;
|
2021-11-13 04:02:29 +08:00
|
|
|
|
|
|
|
const changedNames = [];
|
|
|
|
lastBreakouts.forEach((breakout) => {
|
|
|
|
if (breakout.isDefaultName === false) {
|
|
|
|
changedNames[breakout.sequence] = breakout.shortName;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
roomNamesChanged: changedNames,
|
|
|
|
numberOfRooms: lastBreakouts.length,
|
|
|
|
roomNameDuplicatedIsValid: true,
|
|
|
|
roomNameEmptyIsValid: true,
|
|
|
|
}, () => {
|
2023-02-22 01:57:34 +08:00
|
|
|
const rooms = range(1, lastBreakouts.length + 1).map((seq) => this.getRoomName(seq));
|
2021-11-13 04:02:29 +08:00
|
|
|
|
|
|
|
users.forEach((u) => {
|
|
|
|
const lastUserBreakout = getBreakoutUserWasIn(u.userId, u.extId);
|
|
|
|
if (lastUserBreakout !== null) {
|
|
|
|
const lastUserBreakoutName = lastUserBreakout.isDefaultName === false
|
|
|
|
? lastUserBreakout.shortName
|
|
|
|
: intl.formatMessage(intlMessages.breakoutRoom, { 0: lastUserBreakout.sequence });
|
|
|
|
|
|
|
|
if (rooms.indexOf(lastUserBreakoutName) !== false) {
|
|
|
|
this.changeUserRoom(u.userId, rooms.indexOf(lastUserBreakoutName) + 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
populateWithGroups(groups) {
|
|
|
|
const { users } = this.props;
|
|
|
|
|
|
|
|
const changedNames = [];
|
|
|
|
groups.forEach((group, idx) => {
|
|
|
|
if (group.name.length > 0) {
|
|
|
|
changedNames[idx + 1] = group.name;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
roomNamesChanged: changedNames,
|
|
|
|
numberOfRooms: groups.length > 1 ? groups.length : 2,
|
|
|
|
roomNameDuplicatedIsValid: true,
|
|
|
|
roomNameEmptyIsValid: true,
|
|
|
|
}, () => {
|
|
|
|
groups.forEach((group, groupIdx) => {
|
|
|
|
const usersInGroup = group.usersExtId;
|
|
|
|
if (usersInGroup.length > 0) {
|
|
|
|
usersInGroup.forEach((groupUserExtId) => {
|
|
|
|
users.filter((u) => u.extId === groupUserExtId).forEach((foundUser) => {
|
|
|
|
this.changeUserRoom(foundUser.userId, groupIdx + 1);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2023-06-30 21:53:58 +08:00
|
|
|
renderContent() {
|
|
|
|
const { intl } = this.props;
|
|
|
|
const {
|
|
|
|
leastOneUserIsValid,
|
|
|
|
allowDrop,
|
|
|
|
} = this.state;
|
|
|
|
const drop = (room) => (ev) => {
|
|
|
|
ev.preventDefault();
|
|
|
|
const data = ev.dataTransfer.getData('text');
|
|
|
|
this.changeUserRoom(data, room);
|
|
|
|
this.setState({ selectedId: '' });
|
|
|
|
};
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Styled.ContentContainer>
|
|
|
|
<Styled.Alert valid={leastOneUserIsValid} role="alert">
|
|
|
|
<Styled.FreeJoinLabel>
|
|
|
|
<Styled.BreakoutNameInput
|
|
|
|
type="text"
|
|
|
|
readOnly
|
|
|
|
value={
|
|
|
|
intl.formatMessage(intlMessages.notAssigned, { 0: this.getUserByRoom(0).length })
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
</Styled.FreeJoinLabel>
|
|
|
|
<Styled.BreakoutBox hundred id="breakoutBox-0" onDrop={drop(0)} onDragOver={allowDrop} tabIndex={0}>
|
|
|
|
{this.renderUserItemByRoom(0)}
|
|
|
|
</Styled.BreakoutBox>
|
|
|
|
<Styled.SpanWarn data-test="warningNoUserAssigned" valid={leastOneUserIsValid}>
|
|
|
|
{intl.formatMessage(intlMessages.leastOneWarnBreakout)}
|
|
|
|
</Styled.SpanWarn>
|
|
|
|
</Styled.Alert>
|
|
|
|
{this.renderRoomsGrid()}
|
|
|
|
</Styled.ContentContainer>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2018-11-27 20:44:22 +08:00
|
|
|
renderRoomsGrid() {
|
2022-09-13 21:45:13 +08:00
|
|
|
const { intl, isUpdate } = this.props;
|
2018-12-20 01:08:01 +08:00
|
|
|
const {
|
2021-06-12 03:06:56 +08:00
|
|
|
leastOneUserIsValid,
|
2018-12-20 01:08:01 +08:00
|
|
|
numberOfRooms,
|
2021-06-12 03:06:56 +08:00
|
|
|
roomNamesChanged,
|
2018-12-20 01:08:01 +08:00
|
|
|
} = this.state;
|
2021-06-12 03:06:56 +08:00
|
|
|
|
2019-06-27 03:27:51 +08:00
|
|
|
const rooms = (numberOfRooms > MAX_BREAKOUT_ROOMS
|
|
|
|
|| numberOfRooms < MIN_BREAKOUT_ROOMS)
|
|
|
|
? 0 : numberOfRooms;
|
2018-11-27 20:44:22 +08:00
|
|
|
const allowDrop = (ev) => {
|
|
|
|
ev.preventDefault();
|
|
|
|
};
|
|
|
|
|
2021-05-03 04:02:38 +08:00
|
|
|
const drop = (room) => (ev) => {
|
2018-11-27 20:44:22 +08:00
|
|
|
ev.preventDefault();
|
|
|
|
const data = ev.dataTransfer.getData('text');
|
|
|
|
this.changeUserRoom(data, room);
|
2022-03-24 21:56:07 +08:00
|
|
|
this.setState({ selectedId: '' });
|
2018-11-27 20:44:22 +08:00
|
|
|
};
|
|
|
|
|
2021-06-12 03:06:56 +08:00
|
|
|
const changeRoomName = (position) => (ev) => {
|
2021-08-09 22:24:02 +08:00
|
|
|
const newRoomsNames = [...roomNamesChanged];
|
2021-06-12 03:06:56 +08:00
|
|
|
newRoomsNames[position] = ev.target.value;
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
roomNamesChanged: newRoomsNames,
|
|
|
|
roomNameDuplicatedIsValid: true,
|
|
|
|
roomNameEmptyIsValid: true,
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2018-11-27 20:44:22 +08:00
|
|
|
return (
|
2022-09-23 04:17:15 +08:00
|
|
|
<Styled.BoxContainer key="rooms-grid-" ref={(r) => { this.listOfUsers = r; }} data-test="roomGrid">
|
2018-11-27 20:44:22 +08:00
|
|
|
{
|
2023-02-22 01:57:34 +08:00
|
|
|
range(1, rooms + 1).map((value) => (
|
2019-01-30 10:15:01 +08:00
|
|
|
<div key={`room-${value}`}>
|
2021-10-26 03:21:27 +08:00
|
|
|
<Styled.FreeJoinLabel>
|
|
|
|
<Styled.RoomName
|
2021-06-12 03:06:56 +08:00
|
|
|
type="text"
|
|
|
|
maxLength="255"
|
2021-10-26 03:21:27 +08:00
|
|
|
duplicated={this.hasNameDuplicated(value)}
|
2021-06-12 03:06:56 +08:00
|
|
|
value={this.getRoomName(value)}
|
|
|
|
onChange={changeRoomName(value)}
|
|
|
|
onBlur={changeRoomName(value)}
|
2021-09-11 10:08:04 +08:00
|
|
|
aria-label={`${this.getRoomName(value)}`}
|
|
|
|
aria-describedby={this.getRoomName(value).length === 0 ? `room-error-${value}` : `room-input-${value}`}
|
2022-09-23 04:17:15 +08:00
|
|
|
data-test={this.getRoomName(value).length === 0 ? `room-error-${value}` : `roomName-${value}`}
|
2022-09-13 21:45:13 +08:00
|
|
|
readOnly={isUpdate}
|
2021-06-12 03:06:56 +08:00
|
|
|
/>
|
2021-11-11 21:10:31 +08:00
|
|
|
<div aria-hidden id={`room-input-${value}`} className="sr-only">
|
2021-09-11 10:08:04 +08:00
|
|
|
{intl.formatMessage(intlMessages.roomNameInputDesc)}
|
|
|
|
</div>
|
2021-10-26 03:21:27 +08:00
|
|
|
</Styled.FreeJoinLabel>
|
|
|
|
<Styled.BreakoutBox id={`breakoutBox-${value}`} onDrop={drop(value)} onDragOver={allowDrop} tabIndex={0}>
|
2018-12-20 01:08:01 +08:00
|
|
|
{this.renderUserItemByRoom(value)}
|
2021-10-26 03:21:27 +08:00
|
|
|
</Styled.BreakoutBox>
|
2021-08-09 22:24:02 +08:00
|
|
|
{this.hasNameDuplicated(value) ? (
|
2021-10-26 03:21:27 +08:00
|
|
|
<Styled.SpanWarn valid={false}>
|
2021-06-12 03:06:56 +08:00
|
|
|
{intl.formatMessage(intlMessages.roomNameDuplicatedIsValid)}
|
2021-10-26 03:21:27 +08:00
|
|
|
</Styled.SpanWarn>
|
2021-08-09 22:24:02 +08:00
|
|
|
) : null}
|
|
|
|
{this.getRoomName(value).length === 0 ? (
|
2021-10-26 03:21:27 +08:00
|
|
|
<Styled.SpanWarn valid={false} aria-hidden id={`room-error-${value}`}>
|
2021-06-12 03:06:56 +08:00
|
|
|
{intl.formatMessage(intlMessages.roomNameEmptyIsValid)}
|
2021-10-26 03:21:27 +08:00
|
|
|
</Styled.SpanWarn>
|
2021-08-09 22:24:02 +08:00
|
|
|
) : null}
|
2019-01-30 10:15:01 +08:00
|
|
|
</div>
|
2018-12-20 01:08:01 +08:00
|
|
|
))
|
2018-11-27 20:44:22 +08:00
|
|
|
}
|
2021-10-26 03:21:27 +08:00
|
|
|
</Styled.BoxContainer>
|
2018-11-27 20:44:22 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
renderBreakoutForm() {
|
2018-12-28 00:20:03 +08:00
|
|
|
const {
|
|
|
|
intl,
|
2022-03-24 21:56:07 +08:00
|
|
|
isUpdate,
|
2023-06-30 21:53:58 +08:00
|
|
|
isBreakoutRecordable,
|
2018-12-28 00:20:03 +08:00
|
|
|
} = this.props;
|
2018-12-20 01:08:01 +08:00
|
|
|
const {
|
|
|
|
numberOfRooms,
|
|
|
|
durationTime,
|
2019-06-14 21:54:59 +08:00
|
|
|
numberOfRoomsIsValid,
|
2021-06-12 00:21:26 +08:00
|
|
|
durationIsValid,
|
2023-06-30 21:53:58 +08:00
|
|
|
freeJoin,
|
|
|
|
record,
|
|
|
|
captureNotes,
|
|
|
|
captureSlides,
|
2023-07-06 00:58:40 +08:00
|
|
|
inviteMods,
|
2018-12-20 01:08:01 +08:00
|
|
|
} = this.state;
|
2022-04-15 01:38:14 +08:00
|
|
|
if (isUpdate) return null;
|
2018-12-28 00:20:03 +08:00
|
|
|
|
2018-11-27 20:44:22 +08:00
|
|
|
return (
|
2019-09-19 04:06:59 +08:00
|
|
|
<React.Fragment key="breakout-form">
|
2021-10-26 03:21:27 +08:00
|
|
|
<Styled.BreakoutSettings>
|
2019-06-14 21:54:59 +08:00
|
|
|
<div>
|
2021-10-26 03:21:27 +08:00
|
|
|
<Styled.FormLabel valid={numberOfRoomsIsValid} aria-hidden>
|
2019-06-14 21:54:59 +08:00
|
|
|
{intl.formatMessage(intlMessages.numberOfRooms)}
|
2021-10-26 03:21:27 +08:00
|
|
|
</Styled.FormLabel>
|
|
|
|
<Styled.InputRooms
|
2019-06-14 21:54:59 +08:00
|
|
|
id="numberOfRooms"
|
|
|
|
name="numberOfRooms"
|
2021-10-26 03:21:27 +08:00
|
|
|
valid={numberOfRoomsIsValid}
|
2019-06-14 21:54:59 +08:00
|
|
|
value={numberOfRooms}
|
|
|
|
onChange={this.changeNumberOfRooms}
|
|
|
|
aria-label={intl.formatMessage(intlMessages.numberOfRooms)}
|
2019-01-30 10:15:01 +08:00
|
|
|
>
|
2019-06-14 21:54:59 +08:00
|
|
|
{
|
2023-02-23 22:23:51 +08:00
|
|
|
range(MIN_BREAKOUT_ROOMS, MAX_BREAKOUT_ROOMS + 1).map((item) => (<option key={uniqueId('value-')}>{item}</option>))
|
2019-06-14 21:54:59 +08:00
|
|
|
}
|
2021-10-26 03:21:27 +08:00
|
|
|
</Styled.InputRooms>
|
2018-11-27 20:44:22 +08:00
|
|
|
</div>
|
2021-10-26 03:21:27 +08:00
|
|
|
<Styled.DurationLabel valid={durationIsValid} htmlFor="breakoutRoomTime">
|
|
|
|
<Styled.LabelText aria-hidden>
|
2019-06-14 21:54:59 +08:00
|
|
|
{intl.formatMessage(intlMessages.duration)}
|
2021-10-26 03:21:27 +08:00
|
|
|
</Styled.LabelText>
|
|
|
|
<Styled.DurationArea>
|
|
|
|
<Styled.DurationInput
|
2019-06-14 21:54:59 +08:00
|
|
|
type="number"
|
|
|
|
min="1"
|
|
|
|
value={durationTime}
|
|
|
|
onChange={this.changeDurationTime}
|
|
|
|
onBlur={this.blurDurationTime}
|
|
|
|
aria-label={intl.formatMessage(intlMessages.duration)}
|
2022-09-10 00:54:50 +08:00
|
|
|
data-test="durationTime"
|
2019-06-14 21:54:59 +08:00
|
|
|
/>
|
2021-10-26 03:21:27 +08:00
|
|
|
</Styled.DurationArea>
|
2023-07-21 03:59:53 +08:00
|
|
|
<Styled.SpanWarn data-test="minimumDurationWarnBreakout" valid={durationIsValid}>
|
2021-08-09 22:24:02 +08:00
|
|
|
{
|
|
|
|
intl.formatMessage(
|
|
|
|
intlMessages.minimumDurationWarnBreakout,
|
|
|
|
{ 0: MIN_BREAKOUT_TIME },
|
|
|
|
)
|
|
|
|
}
|
2021-10-26 03:21:27 +08:00
|
|
|
</Styled.SpanWarn>
|
|
|
|
</Styled.DurationLabel>
|
2023-06-30 21:53:58 +08:00
|
|
|
<Styled.CheckBoxesContainer key="breakout-checkboxes">
|
|
|
|
<Styled.FreeJoinLabel htmlFor="freeJoinCheckbox" key="free-join-breakouts">
|
|
|
|
<Styled.FreeJoinCheckbox
|
|
|
|
type="checkbox"
|
|
|
|
id="freeJoinCheckbox"
|
|
|
|
onChange={this.setFreeJoin}
|
|
|
|
checked={freeJoin}
|
|
|
|
aria-label={intl.formatMessage(intlMessages.freeJoinLabel)}
|
|
|
|
/>
|
|
|
|
<span aria-hidden>{intl.formatMessage(intlMessages.freeJoinLabel)}</span>
|
|
|
|
</Styled.FreeJoinLabel>
|
|
|
|
{
|
|
|
|
isBreakoutRecordable ? (
|
|
|
|
<Styled.FreeJoinLabel htmlFor="recordBreakoutCheckbox" key="record-breakouts">
|
|
|
|
<Styled.FreeJoinCheckbox
|
|
|
|
id="recordBreakoutCheckbox"
|
|
|
|
type="checkbox"
|
|
|
|
onChange={this.setRecord}
|
|
|
|
checked={record}
|
|
|
|
aria-label={intl.formatMessage(intlMessages.record)}
|
|
|
|
/>
|
|
|
|
<span aria-hidden>
|
|
|
|
{intl.formatMessage(intlMessages.record)}
|
|
|
|
</span>
|
|
|
|
</Styled.FreeJoinLabel>
|
|
|
|
) : null
|
|
|
|
}
|
|
|
|
{
|
|
|
|
isImportPresentationWithAnnotationsFromBreakoutRoomsEnabled() ? (
|
|
|
|
<Styled.FreeJoinLabel htmlFor="captureSlidesBreakoutCheckbox" key="capture-slides-breakouts">
|
|
|
|
<Styled.FreeJoinCheckbox
|
|
|
|
id="captureSlidesBreakoutCheckbox"
|
|
|
|
type="checkbox"
|
|
|
|
onChange={this.setCaptureSlides}
|
|
|
|
checked={captureSlides}
|
|
|
|
aria-label={intl.formatMessage(intlMessages.captureSlidesLabel)}
|
|
|
|
/>
|
|
|
|
<span aria-hidden>
|
|
|
|
{intl.formatMessage(intlMessages.captureSlidesLabel)}
|
|
|
|
</span>
|
|
|
|
</Styled.FreeJoinLabel>
|
|
|
|
) : null
|
|
|
|
}
|
|
|
|
{
|
|
|
|
isImportSharedNotesFromBreakoutRoomsEnabled() ? (
|
|
|
|
<Styled.FreeJoinLabel htmlFor="captureNotesBreakoutCheckbox" key="capture-notes-breakouts">
|
|
|
|
<Styled.FreeJoinCheckbox
|
|
|
|
id="captureNotesBreakoutCheckbox"
|
|
|
|
type="checkbox"
|
|
|
|
onChange={this.setCaptureNotes}
|
|
|
|
checked={captureNotes}
|
|
|
|
aria-label={intl.formatMessage(intlMessages.captureNotesLabel)}
|
|
|
|
/>
|
|
|
|
<span aria-hidden>
|
|
|
|
{intl.formatMessage(intlMessages.captureNotesLabel)}
|
|
|
|
</span>
|
|
|
|
</Styled.FreeJoinLabel>
|
|
|
|
) : null
|
|
|
|
}
|
2023-07-06 00:58:40 +08:00
|
|
|
<Styled.FreeJoinLabel htmlFor="sendInvitationToAssignedModeratorsCheckbox" key="send-invitation-to-assigned-moderators-breakouts">
|
|
|
|
<Styled.FreeJoinCheckbox
|
|
|
|
id="sendInvitationToAssignedModeratorsCheckbox"
|
|
|
|
type="checkbox"
|
|
|
|
onChange={this.setInviteMods}
|
|
|
|
checked={inviteMods}
|
|
|
|
aria-label={intl.formatMessage(intlMessages.sendInvitationToMods)}
|
|
|
|
/>
|
|
|
|
<span aria-hidden>
|
|
|
|
{intl.formatMessage(intlMessages.sendInvitationToMods)}
|
|
|
|
</span>
|
|
|
|
</Styled.FreeJoinLabel>
|
2023-06-30 21:53:58 +08:00
|
|
|
</Styled.CheckBoxesContainer>
|
2021-10-26 03:21:27 +08:00
|
|
|
</Styled.BreakoutSettings>
|
|
|
|
<Styled.SpanWarn valid={numberOfRoomsIsValid}>
|
2019-06-14 21:54:59 +08:00
|
|
|
{intl.formatMessage(intlMessages.numberOfRoomsIsValid)}
|
2021-10-26 03:21:27 +08:00
|
|
|
</Styled.SpanWarn>
|
2021-09-11 10:08:04 +08:00
|
|
|
<span aria-hidden id="randomlyAssignDesc" className="sr-only">
|
2021-08-17 11:07:20 +08:00
|
|
|
{intl.formatMessage(intlMessages.randomlyAssignDesc)}
|
|
|
|
</span>
|
2023-06-30 21:53:58 +08:00
|
|
|
<Styled.Separator />
|
2019-06-14 21:54:59 +08:00
|
|
|
</React.Fragment>
|
2018-11-27 20:44:22 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2018-12-14 20:33:58 +08:00
|
|
|
renderSelectUserScreen() {
|
2018-12-20 01:08:01 +08:00
|
|
|
const {
|
|
|
|
users,
|
|
|
|
roomSelected,
|
|
|
|
} = this.state;
|
2020-01-22 23:31:53 +08:00
|
|
|
|
2018-12-14 20:33:58 +08:00
|
|
|
return (
|
|
|
|
<SortList
|
|
|
|
confirm={() => this.setState({ formFillLevel: 2 })}
|
2018-12-20 01:08:01 +08:00
|
|
|
users={users}
|
|
|
|
room={roomSelected}
|
2018-12-14 20:33:58 +08:00
|
|
|
onCheck={this.changeUserRoom}
|
2021-05-03 04:02:38 +08:00
|
|
|
onUncheck={(userId) => this.changeUserRoom(userId, 0)}
|
2018-12-14 20:33:58 +08:00
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2023-06-30 21:53:58 +08:00
|
|
|
renderUnassingUsers() {
|
2022-09-06 01:27:38 +08:00
|
|
|
const {
|
2023-06-30 21:53:58 +08:00
|
|
|
intl,
|
|
|
|
isUpdate,
|
2022-09-06 01:27:38 +08:00
|
|
|
} = this.props;
|
2022-04-15 01:38:14 +08:00
|
|
|
if (isUpdate) return null;
|
2019-04-12 04:12:22 +08:00
|
|
|
const {
|
2023-06-30 21:53:58 +08:00
|
|
|
numberOfRoomsIsValid,
|
2023-07-06 00:58:40 +08:00
|
|
|
leastOneUserIsValid,
|
2019-04-12 04:12:22 +08:00
|
|
|
} = this.state;
|
2023-07-06 00:58:40 +08:00
|
|
|
|
2018-11-27 20:44:22 +08:00
|
|
|
return (
|
2023-06-30 21:53:58 +08:00
|
|
|
<Styled.AssignBtnsContainer>
|
|
|
|
<Styled.LabelText bold aria-hidden>
|
|
|
|
{intl.formatMessage(intlMessages.manageRooms)}
|
|
|
|
</Styled.LabelText>
|
2023-07-06 00:58:40 +08:00
|
|
|
{leastOneUserIsValid ? (
|
|
|
|
<Styled.AssignBtns
|
|
|
|
data-test="resetAssignments"
|
|
|
|
label={intl.formatMessage(intlMessages.resetAssignments)}
|
|
|
|
aria-describedby="resetAssignmentsDesc"
|
|
|
|
onClick={this.onAssignReset}
|
|
|
|
size="sm"
|
|
|
|
color="default"
|
|
|
|
disabled={!numberOfRoomsIsValid}
|
|
|
|
/>
|
|
|
|
) : (
|
|
|
|
<Styled.AssignBtns
|
|
|
|
random
|
|
|
|
data-test="randomlyAssign"
|
|
|
|
label={intl.formatMessage(intlMessages.randomlyAssign)}
|
|
|
|
aria-describedby="randomlyAssignDesc"
|
|
|
|
onClick={this.onAssignRandomly}
|
|
|
|
size="sm"
|
|
|
|
color="default"
|
|
|
|
/>
|
|
|
|
)}
|
2023-06-30 21:53:58 +08:00
|
|
|
</Styled.AssignBtnsContainer>
|
2018-11-27 20:44:22 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
renderUserItemByRoom(room) {
|
2018-12-20 01:08:01 +08:00
|
|
|
const {
|
2021-06-12 03:06:56 +08:00
|
|
|
leastOneUserIsValid,
|
2022-03-24 21:56:07 +08:00
|
|
|
selectedId,
|
2018-12-20 01:08:01 +08:00
|
|
|
} = this.state;
|
2021-02-04 21:59:13 +08:00
|
|
|
|
|
|
|
const { intl, isMe } = this.props;
|
|
|
|
|
2018-11-28 02:00:15 +08:00
|
|
|
const dragStart = (ev) => {
|
2018-11-27 20:44:22 +08:00
|
|
|
ev.dataTransfer.setData('text', ev.target.id);
|
2022-03-24 21:56:07 +08:00
|
|
|
this.setState({ selectedId: ev.target.id });
|
2018-11-30 03:47:04 +08:00
|
|
|
|
2021-06-12 03:06:56 +08:00
|
|
|
if (!leastOneUserIsValid) {
|
|
|
|
this.setState({ leastOneUserIsValid: true });
|
2018-11-30 03:47:04 +08:00
|
|
|
}
|
2018-11-28 02:00:15 +08:00
|
|
|
};
|
|
|
|
|
2018-12-14 20:33:58 +08:00
|
|
|
const dragEnd = () => {
|
2022-03-24 21:56:07 +08:00
|
|
|
this.setState({ selectedId: '' });
|
2018-11-27 20:44:22 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
return this.getUserByRoom(room)
|
2021-05-03 04:02:38 +08:00
|
|
|
.map((user) => (
|
2021-10-26 03:21:27 +08:00
|
|
|
<Styled.RoomUserItem
|
2021-08-17 19:21:51 +08:00
|
|
|
tabIndex={-1}
|
2021-10-26 03:21:27 +08:00
|
|
|
id={`roomUserItem-${user.userId}`}
|
2018-11-30 03:47:04 +08:00
|
|
|
key={user.userId}
|
2022-03-24 21:56:07 +08:00
|
|
|
selected={selectedId.replace('roomUserItem-', '') === user.userId.replace('roomUserItem-', '')}
|
2021-10-26 03:21:27 +08:00
|
|
|
disabled={false}
|
2022-03-24 21:56:07 +08:00
|
|
|
highlight={room !== user.from}
|
2018-11-27 20:44:22 +08:00
|
|
|
draggable
|
2018-11-28 02:00:15 +08:00
|
|
|
onDragStart={dragStart}
|
|
|
|
onDragEnd={dragEnd}
|
2018-11-27 20:44:22 +08:00
|
|
|
>
|
2022-03-24 21:56:07 +08:00
|
|
|
<span>
|
|
|
|
<span>{user.userName}</span>
|
|
|
|
<i>{(isMe(user.userId)) ? ` (${intl.formatMessage(intlMessages.you)})` : ''}</i>
|
|
|
|
</span>
|
2023-06-30 21:53:58 +08:00
|
|
|
{room !== user.from ? (
|
2022-03-24 21:56:07 +08:00
|
|
|
<span
|
|
|
|
className="close"
|
|
|
|
role="button"
|
|
|
|
aria-label={intl.formatMessage(intlMessages.resetUserRoom)}
|
|
|
|
onClick={() => this.changeUserRoom(user.userId, user.from)}
|
|
|
|
>
|
|
|
|
<Icon iconName="close" />
|
|
|
|
</span>
|
2023-06-30 21:53:58 +08:00
|
|
|
) : null}
|
2021-10-26 03:21:27 +08:00
|
|
|
</Styled.RoomUserItem>
|
2021-05-03 04:02:38 +08:00
|
|
|
));
|
2018-11-27 20:44:22 +08:00
|
|
|
}
|
2020-01-22 23:31:53 +08:00
|
|
|
|
2018-12-14 20:33:58 +08:00
|
|
|
renderRoomSortList() {
|
2022-04-15 01:38:14 +08:00
|
|
|
const { intl } = this.props;
|
2018-12-14 20:33:58 +08:00
|
|
|
const { numberOfRooms } = this.state;
|
2021-05-03 04:02:38 +08:00
|
|
|
const onClick = (roomNumber) => this.setState({ formFillLevel: 3, roomSelected: roomNumber });
|
2018-12-14 20:33:58 +08:00
|
|
|
return (
|
2021-10-26 03:21:27 +08:00
|
|
|
<Styled.ListContainer>
|
2018-12-14 20:33:58 +08:00
|
|
|
<span>
|
|
|
|
{
|
|
|
|
new Array(numberOfRooms).fill(1).map((room, idx) => (
|
2021-10-26 03:21:27 +08:00
|
|
|
<Styled.RoomItem>
|
|
|
|
<Styled.ItemTitle>
|
2018-12-14 20:33:58 +08:00
|
|
|
{intl.formatMessage(intlMessages.breakoutRoomLabel, { 0: idx + 1 })}
|
2021-10-26 03:21:27 +08:00
|
|
|
</Styled.ItemTitle>
|
|
|
|
<Styled.ItemButton
|
2018-12-14 20:33:58 +08:00
|
|
|
label={intl.formatMessage(intlMessages.addParticipantLabel)}
|
|
|
|
size="lg"
|
|
|
|
ghost
|
|
|
|
color="primary"
|
|
|
|
onClick={() => onClick(idx + 1)}
|
|
|
|
/>
|
2021-10-26 03:21:27 +08:00
|
|
|
</Styled.RoomItem>
|
2018-12-14 20:33:58 +08:00
|
|
|
))
|
|
|
|
}
|
|
|
|
</span>
|
2022-04-15 01:38:14 +08:00
|
|
|
{this.renderButtonSetLevel(1, intl.formatMessage(intlMessages.backLabel))}
|
2021-10-26 03:21:27 +08:00
|
|
|
</Styled.ListContainer>
|
2018-12-14 20:33:58 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2019-06-14 21:54:59 +08:00
|
|
|
renderErrorMessages() {
|
|
|
|
const {
|
|
|
|
intl,
|
|
|
|
} = this.props;
|
|
|
|
const {
|
2021-06-12 03:06:56 +08:00
|
|
|
leastOneUserIsValid,
|
2019-06-14 21:54:59 +08:00
|
|
|
numberOfRoomsIsValid,
|
2021-06-12 03:06:56 +08:00
|
|
|
roomNameDuplicatedIsValid,
|
|
|
|
roomNameEmptyIsValid,
|
2019-06-14 21:54:59 +08:00
|
|
|
} = this.state;
|
|
|
|
return (
|
2021-05-03 04:02:38 +08:00
|
|
|
<>
|
2021-06-12 03:06:56 +08:00
|
|
|
{!leastOneUserIsValid
|
2019-06-14 21:54:59 +08:00
|
|
|
&& (
|
2021-10-26 03:21:27 +08:00
|
|
|
<Styled.WithError>
|
2021-06-12 00:21:26 +08:00
|
|
|
{intl.formatMessage(intlMessages.leastOneWarnBreakout)}
|
2021-10-26 03:21:27 +08:00
|
|
|
</Styled.WithError>
|
2021-05-03 04:02:38 +08:00
|
|
|
)}
|
2019-06-14 21:54:59 +08:00
|
|
|
{!numberOfRoomsIsValid
|
|
|
|
&& (
|
2021-10-26 03:21:27 +08:00
|
|
|
<Styled.WithError>
|
2021-06-12 00:21:26 +08:00
|
|
|
{intl.formatMessage(intlMessages.numberOfRoomsIsValid)}
|
2021-10-26 03:21:27 +08:00
|
|
|
</Styled.WithError>
|
2021-05-03 04:02:38 +08:00
|
|
|
)}
|
2021-06-12 03:06:56 +08:00
|
|
|
{!roomNameDuplicatedIsValid
|
|
|
|
&& (
|
2021-10-26 03:21:27 +08:00
|
|
|
<Styled.WithError>
|
2021-08-09 22:24:02 +08:00
|
|
|
{intl.formatMessage(intlMessages.roomNameDuplicatedIsValid)}
|
2021-10-26 03:21:27 +08:00
|
|
|
</Styled.WithError>
|
2021-06-12 03:06:56 +08:00
|
|
|
)}
|
|
|
|
{!roomNameEmptyIsValid
|
|
|
|
&& (
|
2021-10-26 03:21:27 +08:00
|
|
|
<Styled.WithError>
|
2021-08-09 22:24:02 +08:00
|
|
|
{intl.formatMessage(intlMessages.roomNameEmptyIsValid)}
|
2021-10-26 03:21:27 +08:00
|
|
|
</Styled.WithError>
|
2021-06-12 03:06:56 +08:00
|
|
|
)}
|
2021-05-03 04:02:38 +08:00
|
|
|
</>
|
2019-06-14 21:54:59 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2018-12-14 20:33:58 +08:00
|
|
|
renderDesktop() {
|
|
|
|
return [
|
|
|
|
this.renderBreakoutForm(),
|
2023-06-30 21:53:58 +08:00
|
|
|
this.renderUnassingUsers(),
|
|
|
|
this.renderContent(),
|
2018-12-14 20:33:58 +08:00
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
renderMobile() {
|
|
|
|
const { intl } = this.props;
|
|
|
|
const { formFillLevel } = this.state;
|
|
|
|
if (formFillLevel === 2) {
|
2019-06-14 21:54:59 +08:00
|
|
|
return [
|
|
|
|
this.renderErrorMessages(),
|
|
|
|
this.renderRoomSortList(),
|
|
|
|
];
|
2018-12-14 20:33:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (formFillLevel === 3) {
|
2019-06-14 21:54:59 +08:00
|
|
|
return [
|
|
|
|
this.renderErrorMessages(),
|
|
|
|
this.renderSelectUserScreen(),
|
|
|
|
];
|
2018-12-14 20:33:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return [
|
2019-06-14 21:54:59 +08:00
|
|
|
this.renderErrorMessages(),
|
2018-12-14 20:33:58 +08:00
|
|
|
this.renderBreakoutForm(),
|
2023-06-30 21:53:58 +08:00
|
|
|
this.renderUnassingUsers(),
|
2018-12-14 20:33:58 +08:00
|
|
|
this.renderButtonSetLevel(2, intl.formatMessage(intlMessages.nextLabel)),
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
renderButtonSetLevel(level, label) {
|
|
|
|
return (
|
|
|
|
<Button
|
|
|
|
color="primary"
|
|
|
|
size="lg"
|
|
|
|
label={label}
|
|
|
|
onClick={() => this.setState({ formFillLevel: level })}
|
2019-01-11 02:51:19 +08:00
|
|
|
key={this.btnLevelId}
|
2018-12-14 20:33:58 +08:00
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2018-12-28 00:20:03 +08:00
|
|
|
renderTitle() {
|
2022-03-24 21:56:07 +08:00
|
|
|
const { intl, isUpdate } = this.props;
|
2018-12-28 00:20:03 +08:00
|
|
|
return (
|
2021-10-26 03:21:27 +08:00
|
|
|
<Styled.SubTitle>
|
2023-06-30 21:53:58 +08:00
|
|
|
{isUpdate
|
2022-03-24 21:56:07 +08:00
|
|
|
? intl.formatMessage(intlMessages.breakoutRoomUpdateDesc)
|
2023-06-30 21:53:58 +08:00
|
|
|
: intl.formatMessage(intlMessages.breakoutRoomDesc)}
|
2021-10-26 03:21:27 +08:00
|
|
|
</Styled.SubTitle>
|
2018-12-28 00:20:03 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
2023-04-12 23:51:23 +08:00
|
|
|
const { intl, isUpdate, isOpen, priority, setIsOpen, } = this.props;
|
2019-06-14 21:54:59 +08:00
|
|
|
const {
|
|
|
|
preventClosing,
|
2021-06-12 03:06:56 +08:00
|
|
|
leastOneUserIsValid,
|
2019-06-14 21:54:59 +08:00
|
|
|
numberOfRoomsIsValid,
|
2021-06-12 03:06:56 +08:00
|
|
|
roomNameDuplicatedIsValid,
|
|
|
|
roomNameEmptyIsValid,
|
2021-06-12 00:21:26 +08:00
|
|
|
durationIsValid,
|
2019-06-14 21:54:59 +08:00
|
|
|
} = this.state;
|
2018-11-27 20:44:22 +08:00
|
|
|
|
2021-04-01 01:13:36 +08:00
|
|
|
const { isMobile } = deviceInfo;
|
2018-12-14 20:33:58 +08:00
|
|
|
|
2018-09-28 22:42:07 +08:00
|
|
|
return (
|
2023-03-20 21:08:35 +08:00
|
|
|
<ModalFullscreen
|
2018-12-28 00:20:03 +08:00
|
|
|
title={
|
2022-04-15 01:38:14 +08:00
|
|
|
isUpdate
|
2022-03-24 21:56:07 +08:00
|
|
|
? intl.formatMessage(intlMessages.updateTitle)
|
2018-12-28 00:20:03 +08:00
|
|
|
: intl.formatMessage(intlMessages.breakoutRoomTitle)
|
|
|
|
}
|
2018-10-24 01:18:09 +08:00
|
|
|
confirm={
|
|
|
|
{
|
2022-04-15 01:38:14 +08:00
|
|
|
label: isUpdate
|
2022-03-24 21:56:07 +08:00
|
|
|
? intl.formatMessage(intlMessages.updateConfirm)
|
2018-12-28 00:20:03 +08:00
|
|
|
: intl.formatMessage(intlMessages.confirmButton),
|
2022-04-15 01:38:14 +08:00
|
|
|
callback: isUpdate ? this.onUpdateBreakouts : this.onCreateBreakouts,
|
2021-06-12 03:06:56 +08:00
|
|
|
disabled: !leastOneUserIsValid
|
2021-08-09 22:24:02 +08:00
|
|
|
|| !numberOfRoomsIsValid
|
|
|
|
|| !roomNameDuplicatedIsValid
|
|
|
|
|| !roomNameEmptyIsValid
|
|
|
|
|| !durationIsValid
|
|
|
|
,
|
2018-10-24 01:18:09 +08:00
|
|
|
}
|
|
|
|
}
|
2018-11-30 03:47:04 +08:00
|
|
|
dismiss={{
|
|
|
|
callback: this.handleDismiss,
|
2022-03-24 21:56:07 +08:00
|
|
|
label: isUpdate
|
|
|
|
? intl.formatMessage(intlMessages.cancelLabel)
|
|
|
|
: intl.formatMessage(intlMessages.dismissLabel),
|
2018-11-30 03:47:04 +08:00
|
|
|
}}
|
2018-12-20 01:08:01 +08:00
|
|
|
preventClosing={preventClosing}
|
2023-04-12 23:51:23 +08:00
|
|
|
{...{
|
|
|
|
isOpen,
|
|
|
|
priority,
|
|
|
|
setIsOpen,
|
|
|
|
}}
|
2018-09-28 22:42:07 +08:00
|
|
|
>
|
2021-10-26 03:21:27 +08:00
|
|
|
<Styled.Content>
|
2022-04-15 01:38:14 +08:00
|
|
|
{this.renderTitle()}
|
2021-04-01 01:13:36 +08:00
|
|
|
{isMobile ? this.renderMobile() : this.renderDesktop()}
|
2021-10-26 03:21:27 +08:00
|
|
|
</Styled.Content>
|
2023-03-20 21:08:35 +08:00
|
|
|
</ModalFullscreen>
|
2018-09-28 22:42:07 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-30 10:15:01 +08:00
|
|
|
BreakoutRoom.propTypes = propTypes;
|
|
|
|
|
2023-03-22 04:45:20 +08:00
|
|
|
export default injectIntl(BreakoutRoom);
|