2019-06-03 22:28:05 +08:00
|
|
|
import React, { PureComponent } from 'react';
|
2017-06-04 10:40:14 +08:00
|
|
|
import PropTypes from 'prop-types';
|
2020-05-26 04:00:13 +08:00
|
|
|
import { defineMessages } from 'react-intl';
|
2018-11-01 02:51:56 +08:00
|
|
|
import withShortcutHelper from '/imports/ui/components/shortcut-help/service';
|
2018-11-30 01:24:02 +08:00
|
|
|
import ExternalVideoModal from '/imports/ui/components/external-video-player/modal/container';
|
2022-02-15 23:54:55 +08:00
|
|
|
import RandomUserSelectContainer from '/imports/ui/components/common/modal/random-user/container';
|
2022-02-23 01:41:16 +08:00
|
|
|
import LayoutModalContainer from '/imports/ui/components/layout/modal/container';
|
2022-02-15 23:38:55 +08:00
|
|
|
import BBBMenu from '/imports/ui/components/common/menu/component';
|
2022-03-15 22:54:33 +08:00
|
|
|
import Styled from './styles';
|
2023-05-11 04:03:20 +08:00
|
|
|
import TimerService from '/imports/ui/components/timer/service';
|
2021-11-06 03:13:33 +08:00
|
|
|
import { colorPrimary } from '/imports/ui/stylesheets/styled-components/palette';
|
2022-02-23 01:41:16 +08:00
|
|
|
import { PANELS, ACTIONS, LAYOUT_TYPE } from '../../layout/enums';
|
2023-02-23 22:23:51 +08:00
|
|
|
import { uniqueId } from '/imports/utils/string-utils';
|
2023-03-02 00:30:30 +08:00
|
|
|
import { disabledFeaturesTimer } from '/imports/ui/services/features';
|
2023-04-28 00:38:27 +08:00
|
|
|
import { isPresentationEnabled, isLayoutsEnabled } from '/imports/ui/services/features';
|
2023-04-27 00:09:02 +08:00
|
|
|
import VideoPreviewContainer from '/imports/ui/components/video-preview/container';
|
|
|
|
import { screenshareHasEnded } from '/imports/ui/components/screenshare/service';
|
2018-11-30 01:24:02 +08:00
|
|
|
|
2017-06-07 20:01:18 +08:00
|
|
|
const propTypes = {
|
2019-09-07 04:28:02 +08:00
|
|
|
amIPresenter: PropTypes.bool.isRequired,
|
2021-08-09 22:24:02 +08:00
|
|
|
intl: PropTypes.shape({
|
|
|
|
formatMessage: PropTypes.func.isRequired,
|
|
|
|
}).isRequired,
|
2019-09-07 04:28:02 +08:00
|
|
|
amIModerator: PropTypes.bool.isRequired,
|
2019-11-06 05:36:03 +08:00
|
|
|
shortcuts: PropTypes.string,
|
2019-01-11 00:10:45 +08:00
|
|
|
handleTakePresenter: PropTypes.func.isRequired,
|
2023-05-11 04:03:20 +08:00
|
|
|
isTimerActive: PropTypes.bool.isRequired,
|
|
|
|
isTimerEnabled: PropTypes.bool.isRequired,
|
2019-05-29 22:31:27 +08:00
|
|
|
allowExternalVideo: PropTypes.bool.isRequired,
|
|
|
|
stopExternalVideoShare: PropTypes.func.isRequired,
|
2022-03-04 02:03:05 +08:00
|
|
|
isMobile: PropTypes.bool.isRequired,
|
2021-12-17 04:44:09 +08:00
|
|
|
setMeetingLayout: PropTypes.func.isRequired,
|
2022-05-12 05:48:12 +08:00
|
|
|
setPushLayout: PropTypes.func.isRequired,
|
2021-12-17 02:19:48 +08:00
|
|
|
showPushLayout: PropTypes.bool.isRequired,
|
2017-06-07 20:01:18 +08:00
|
|
|
};
|
|
|
|
|
2019-11-06 05:36:03 +08:00
|
|
|
const defaultProps = {
|
|
|
|
shortcuts: '',
|
2021-12-15 20:36:16 +08:00
|
|
|
settingsLayout: LAYOUT_TYPE.SMART_LAYOUT,
|
2019-11-06 05:36:03 +08:00
|
|
|
};
|
|
|
|
|
2016-10-18 05:29:00 +08:00
|
|
|
const intlMessages = defineMessages({
|
|
|
|
actionsLabel: {
|
|
|
|
id: 'app.actionsBar.actionsDropdown.actionsLabel',
|
2017-04-10 23:50:03 +08:00
|
|
|
description: 'Actions button label',
|
2016-10-18 05:29:00 +08:00
|
|
|
},
|
2023-05-11 04:03:20 +08:00
|
|
|
activateTimerLabel: {
|
|
|
|
id: 'app.actionsBar.actionsDropdown.activateTimerLabel',
|
|
|
|
description: 'Activate timer label',
|
|
|
|
},
|
|
|
|
deactivateTimerLabel: {
|
|
|
|
id: 'app.actionsBar.actionsDropdown.deactivateTimerLabel',
|
|
|
|
description: 'Deactivate timer label',
|
|
|
|
},
|
2016-10-18 05:29:00 +08:00
|
|
|
presentationLabel: {
|
|
|
|
id: 'app.actionsBar.actionsDropdown.presentationLabel',
|
2017-04-10 23:50:03 +08:00
|
|
|
description: 'Upload a presentation option label',
|
2016-10-18 05:29:00 +08:00
|
|
|
},
|
|
|
|
presentationDesc: {
|
|
|
|
id: 'app.actionsBar.actionsDropdown.presentationDesc',
|
2017-04-11 21:52:30 +08:00
|
|
|
description: 'adds context to upload presentation option',
|
2016-10-18 05:29:00 +08:00
|
|
|
},
|
|
|
|
desktopShareDesc: {
|
|
|
|
id: 'app.actionsBar.actionsDropdown.desktopShareDesc',
|
2017-04-11 21:52:30 +08:00
|
|
|
description: 'adds context to desktop share option',
|
2016-10-18 05:29:00 +08:00
|
|
|
},
|
2017-11-06 23:39:55 +08:00
|
|
|
stopDesktopShareDesc: {
|
|
|
|
id: 'app.actionsBar.actionsDropdown.stopDesktopShareDesc',
|
|
|
|
description: 'adds context to stop desktop share option',
|
|
|
|
},
|
2018-09-24 06:20:20 +08:00
|
|
|
pollBtnLabel: {
|
|
|
|
id: 'app.actionsBar.actionsDropdown.pollBtnLabel',
|
|
|
|
description: 'poll menu toggle button label',
|
|
|
|
},
|
|
|
|
pollBtnDesc: {
|
|
|
|
id: 'app.actionsBar.actionsDropdown.pollBtnDesc',
|
|
|
|
description: 'poll menu toggle button description',
|
|
|
|
},
|
2019-01-11 00:10:45 +08:00
|
|
|
takePresenter: {
|
|
|
|
id: 'app.actionsBar.actionsDropdown.takePresenter',
|
|
|
|
description: 'Label for take presenter role option',
|
|
|
|
},
|
|
|
|
takePresenterDesc: {
|
|
|
|
id: 'app.actionsBar.actionsDropdown.takePresenterDesc',
|
|
|
|
description: 'Description of take presenter role option',
|
|
|
|
},
|
2019-02-16 01:32:03 +08:00
|
|
|
startExternalVideoLabel: {
|
2018-11-30 01:24:02 +08:00
|
|
|
id: 'app.actionsBar.actionsDropdown.shareExternalVideo',
|
2019-02-16 01:32:03 +08:00
|
|
|
description: 'Start sharing external video button',
|
|
|
|
},
|
|
|
|
stopExternalVideoLabel: {
|
|
|
|
id: 'app.actionsBar.actionsDropdown.stopShareExternalVideo',
|
|
|
|
description: 'Stop sharing external video button',
|
2018-11-30 01:24:02 +08:00
|
|
|
},
|
2020-08-29 01:23:27 +08:00
|
|
|
selectRandUserLabel: {
|
|
|
|
id: 'app.actionsBar.actionsDropdown.selectRandUserLabel',
|
|
|
|
description: 'Label for selecting a random user',
|
|
|
|
},
|
|
|
|
selectRandUserDesc: {
|
|
|
|
id: 'app.actionsBar.actionsDropdown.selectRandUserDesc',
|
|
|
|
description: 'Description for select random user option',
|
|
|
|
},
|
2021-12-15 20:36:16 +08:00
|
|
|
propagateLayoutLabel: {
|
|
|
|
id: 'app.actionsBar.actionsDropdown.propagateLayoutLabel',
|
|
|
|
description: 'Label for propagate layout button',
|
|
|
|
},
|
2022-02-23 01:41:16 +08:00
|
|
|
layoutModal: {
|
|
|
|
id: 'app.actionsBar.actionsDropdown.layoutModal',
|
|
|
|
description: 'Label for layouts selection button',
|
|
|
|
},
|
2023-04-27 00:09:02 +08:00
|
|
|
shareCameraAsContent: {
|
|
|
|
id: 'app.actionsBar.actionsDropdown.shareCameraAsContent',
|
|
|
|
description: 'Label for share camera as content',
|
|
|
|
},
|
|
|
|
unshareCameraAsContent: {
|
|
|
|
id: 'app.actionsBar.actionsDropdown.unshareCameraAsContent',
|
2023-03-11 01:25:24 +08:00
|
|
|
description: 'Label for unshare camera as content',
|
2023-04-27 00:09:02 +08:00
|
|
|
},
|
2016-10-18 05:29:00 +08:00
|
|
|
});
|
|
|
|
|
2020-03-10 20:58:14 +08:00
|
|
|
const handlePresentationClick = () => Session.set('showUploadPresentationView', true);
|
2020-02-26 03:29:14 +08:00
|
|
|
|
2019-06-03 22:28:05 +08:00
|
|
|
class ActionsDropdown extends PureComponent {
|
2016-10-18 05:29:00 +08:00
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
2017-05-04 04:51:17 +08:00
|
|
|
|
2023-02-23 22:23:51 +08:00
|
|
|
this.presentationItemId = uniqueId('action-item-');
|
|
|
|
this.pollId = uniqueId('action-item-');
|
|
|
|
this.takePresenterId = uniqueId('action-item-');
|
2023-05-11 04:03:20 +08:00
|
|
|
this.timerId = uniqueId('action-item-');
|
2023-02-23 22:23:51 +08:00
|
|
|
this.selectUserRandId = uniqueId('action-item-');
|
2023-03-22 01:55:43 +08:00
|
|
|
this.state = {
|
|
|
|
isExternalVideoModalOpen: false,
|
|
|
|
isRandomUserSelectModalOpen: false,
|
2023-04-27 00:09:02 +08:00
|
|
|
isLayoutModalOpen: false,
|
|
|
|
isCameraAsContentModalOpen: false,
|
|
|
|
};
|
2018-01-18 05:51:33 +08:00
|
|
|
|
2019-04-03 02:57:29 +08:00
|
|
|
this.handleExternalVideoClick = this.handleExternalVideoClick.bind(this);
|
2020-01-25 09:02:36 +08:00
|
|
|
this.makePresentationItems = this.makePresentationItems.bind(this);
|
2023-03-22 01:55:43 +08:00
|
|
|
this.setExternalVideoModalIsOpen = this.setExternalVideoModalIsOpen.bind(this);
|
|
|
|
this.setRandomUserSelectModalIsOpen = this.setRandomUserSelectModalIsOpen.bind(this);
|
|
|
|
this.setLayoutModalIsOpen = this.setLayoutModalIsOpen.bind(this);
|
2023-04-27 00:09:02 +08:00
|
|
|
this.setCameraAsContentModalIsOpen = this.setCameraAsContentModalIsOpen.bind(this);
|
|
|
|
this.setPropsToPassModal = this.setPropsToPassModal.bind(this);
|
|
|
|
this.setForceOpen = this.setForceOpen.bind(this);
|
2018-11-01 23:03:16 +08:00
|
|
|
}
|
|
|
|
|
2020-08-08 04:43:33 +08:00
|
|
|
componentDidUpdate(prevProps) {
|
|
|
|
const { amIPresenter: wasPresenter } = prevProps;
|
2023-03-23 04:32:47 +08:00
|
|
|
const { amIPresenter: isPresenter } = this.props;
|
2017-10-13 06:44:38 +08:00
|
|
|
if (wasPresenter && !isPresenter) {
|
2023-03-23 22:56:00 +08:00
|
|
|
this.setExternalVideoModalIsOpen(false);
|
2017-10-13 06:44:38 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-27 07:04:34 +08:00
|
|
|
handleExternalVideoClick() {
|
2023-03-22 01:55:43 +08:00
|
|
|
this.setExternalVideoModalIsOpen(true);
|
2021-04-27 07:04:34 +08:00
|
|
|
}
|
|
|
|
|
2018-01-17 21:34:35 +08:00
|
|
|
getAvailableActions() {
|
|
|
|
const {
|
|
|
|
intl,
|
2019-09-07 04:28:02 +08:00
|
|
|
amIPresenter,
|
2018-11-30 01:24:02 +08:00
|
|
|
allowExternalVideo,
|
2019-01-11 00:10:45 +08:00
|
|
|
handleTakePresenter,
|
2019-02-16 01:32:03 +08:00
|
|
|
isSharingVideo,
|
2019-07-02 22:54:37 +08:00
|
|
|
isPollingEnabled,
|
2021-03-20 02:52:03 +08:00
|
|
|
isSelectRandomUserEnabled,
|
2019-04-25 01:19:35 +08:00
|
|
|
stopExternalVideoShare,
|
2023-05-11 04:03:20 +08:00
|
|
|
isTimerActive,
|
|
|
|
isTimerEnabled,
|
2021-08-05 19:03:24 +08:00
|
|
|
layoutContextDispatch,
|
2021-12-17 04:44:09 +08:00
|
|
|
setMeetingLayout,
|
2022-05-12 05:48:12 +08:00
|
|
|
setPushLayout,
|
2021-12-17 02:19:48 +08:00
|
|
|
showPushLayout,
|
2023-03-17 20:52:53 +08:00
|
|
|
amIModerator,
|
2023-04-27 00:09:02 +08:00
|
|
|
isMobile,
|
2023-03-28 05:40:08 +08:00
|
|
|
hasCameraAsContent,
|
2023-04-27 00:09:02 +08:00
|
|
|
isCameraAsContentEnabled,
|
2018-01-17 21:34:35 +08:00
|
|
|
} = this.props;
|
|
|
|
|
2018-12-18 23:15:51 +08:00
|
|
|
const {
|
|
|
|
pollBtnLabel,
|
|
|
|
presentationLabel,
|
2019-01-11 00:10:45 +08:00
|
|
|
takePresenter,
|
2018-12-18 23:15:51 +08:00
|
|
|
} = intlMessages;
|
|
|
|
|
|
|
|
const {
|
|
|
|
formatMessage,
|
|
|
|
} = intl;
|
|
|
|
|
2021-08-09 01:13:47 +08:00
|
|
|
const actions = [];
|
|
|
|
|
2023-02-23 04:16:43 +08:00
|
|
|
if (amIPresenter && isPresentationEnabled()) {
|
2021-08-09 01:13:47 +08:00
|
|
|
actions.push({
|
2023-03-01 00:24:08 +08:00
|
|
|
icon: "upload",
|
2022-01-20 21:03:18 +08:00
|
|
|
dataTest: "managePresentations",
|
2021-08-09 01:13:47 +08:00
|
|
|
label: formatMessage(presentationLabel),
|
|
|
|
key: this.presentationItemId,
|
|
|
|
onClick: handlePresentationClick,
|
2021-08-10 06:39:04 +08:00
|
|
|
dividerTop: this.props?.presentations?.length > 1 ? true : false,
|
2021-08-09 01:13:47 +08:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
if (amIPresenter && isPollingEnabled) {
|
|
|
|
actions.push({
|
|
|
|
icon: "polling",
|
2021-08-14 09:32:19 +08:00
|
|
|
dataTest: "polling",
|
2021-08-09 01:13:47 +08:00
|
|
|
label: formatMessage(pollBtnLabel),
|
|
|
|
key: this.pollId,
|
|
|
|
onClick: () => {
|
|
|
|
if (Session.equals('pollInitiated', true)) {
|
|
|
|
Session.set('resetPollPanel', true);
|
|
|
|
}
|
2021-08-13 02:42:02 +08:00
|
|
|
layoutContextDispatch({
|
2021-08-09 01:13:47 +08:00
|
|
|
type: ACTIONS.SET_SIDEBAR_CONTENT_IS_OPEN,
|
|
|
|
value: true,
|
|
|
|
});
|
2021-08-13 02:42:02 +08:00
|
|
|
layoutContextDispatch({
|
2021-08-09 01:13:47 +08:00
|
|
|
type: ACTIONS.SET_SIDEBAR_CONTENT_PANEL,
|
|
|
|
value: PANELS.POLL,
|
|
|
|
});
|
|
|
|
Session.set('forcePollOpen', true);
|
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2023-03-17 20:52:53 +08:00
|
|
|
if (!amIPresenter && amIModerator) {
|
2021-08-09 01:13:47 +08:00
|
|
|
actions.push({
|
|
|
|
icon: "presentation",
|
|
|
|
label: formatMessage(takePresenter),
|
|
|
|
key: this.takePresenterId,
|
|
|
|
onClick: () => handleTakePresenter(),
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
if (amIPresenter && allowExternalVideo) {
|
|
|
|
actions.push({
|
2021-10-05 01:16:55 +08:00
|
|
|
icon: !isSharingVideo ? "external-video" : "external-video_off",
|
2021-08-09 01:13:47 +08:00
|
|
|
label: !isSharingVideo ? intl.formatMessage(intlMessages.startExternalVideoLabel)
|
|
|
|
: intl.formatMessage(intlMessages.stopExternalVideoLabel),
|
|
|
|
key: "external-video",
|
|
|
|
onClick: isSharingVideo ? stopExternalVideoShare : this.handleExternalVideoClick,
|
2022-01-20 21:03:18 +08:00
|
|
|
dataTest: "shareExternalVideo",
|
2021-08-09 01:13:47 +08:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
if (amIPresenter && isSelectRandomUserEnabled) {
|
|
|
|
actions.push({
|
|
|
|
icon: "user",
|
|
|
|
label: intl.formatMessage(intlMessages.selectRandUserLabel),
|
|
|
|
key: this.selectUserRandId,
|
2023-03-22 01:55:43 +08:00
|
|
|
onClick: () => this.setRandomUserSelectModalIsOpen(true),
|
2022-02-04 22:13:42 +08:00
|
|
|
dataTest: "selectRandomUser",
|
2021-08-09 01:13:47 +08:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2023-03-02 00:30:30 +08:00
|
|
|
if (amIModerator && isTimerEnabled && disabledFeaturesTimer()) {
|
2023-05-11 04:03:20 +08:00
|
|
|
actions.push({
|
|
|
|
icon: "time",
|
|
|
|
label: isTimerActive ? intl.formatMessage(intlMessages.deactivateTimerLabel)
|
|
|
|
: intl.formatMessage(intlMessages.activateTimerLabel),
|
|
|
|
key: this.timerId,
|
|
|
|
onClick: () => this.handleTimerClick(!isTimerActive),
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2023-02-23 02:53:57 +08:00
|
|
|
if (amIPresenter && showPushLayout && isLayoutsEnabled()) {
|
2021-12-15 20:36:16 +08:00
|
|
|
actions.push({
|
|
|
|
icon: 'send',
|
|
|
|
label: intl.formatMessage(intlMessages.propagateLayoutLabel),
|
|
|
|
key: 'propagate layout',
|
2022-05-12 05:48:12 +08:00
|
|
|
onClick: amIPresenter ? setMeetingLayout : setPushLayout,
|
2023-02-23 20:05:57 +08:00
|
|
|
dataTest: 'propagateLayout',
|
2021-12-15 20:36:16 +08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2023-02-23 02:53:57 +08:00
|
|
|
if (isLayoutsEnabled()){
|
2023-02-23 20:05:57 +08:00
|
|
|
actions.push({
|
|
|
|
icon: 'send',
|
|
|
|
label: intl.formatMessage(intlMessages.layoutModal),
|
|
|
|
key: 'layoutModal',
|
2023-03-22 01:55:43 +08:00
|
|
|
onClick: () => this.setLayoutModalIsOpen(true),
|
2023-02-23 20:05:57 +08:00
|
|
|
dataTest: 'layoutModal',
|
|
|
|
});
|
|
|
|
}
|
2023-04-27 00:09:02 +08:00
|
|
|
|
|
|
|
if (isCameraAsContentEnabled && amIPresenter && !isMobile) {
|
|
|
|
actions.push({
|
2023-03-28 05:40:08 +08:00
|
|
|
icon: hasCameraAsContent ? 'video_off' : 'video',
|
|
|
|
label: hasCameraAsContent
|
2023-04-27 00:09:02 +08:00
|
|
|
? intl.formatMessage(intlMessages.unshareCameraAsContent)
|
|
|
|
: intl.formatMessage(intlMessages.shareCameraAsContent),
|
|
|
|
key: 'camera as content',
|
2023-03-28 05:40:08 +08:00
|
|
|
onClick: hasCameraAsContent
|
2023-04-27 00:09:02 +08:00
|
|
|
? screenshareHasEnded
|
2023-03-29 21:36:22 +08:00
|
|
|
: () => {
|
|
|
|
screenshareHasEnded();
|
2023-04-28 00:38:27 +08:00
|
|
|
this.setCameraAsContentModalIsOpen(true);
|
2023-03-29 21:36:22 +08:00
|
|
|
},
|
2023-04-27 00:09:02 +08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-08-09 01:13:47 +08:00
|
|
|
return actions;
|
2018-01-17 21:34:35 +08:00
|
|
|
}
|
|
|
|
|
2023-05-03 04:46:33 +08:00
|
|
|
handleTimerClick(activate) {
|
|
|
|
if (activate) {
|
|
|
|
TimerService.activateTimer();
|
|
|
|
} else {
|
|
|
|
TimerService.deactivateTimer();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-25 09:02:36 +08:00
|
|
|
makePresentationItems() {
|
|
|
|
const {
|
|
|
|
presentations,
|
|
|
|
setPresentation,
|
|
|
|
podIds,
|
|
|
|
} = this.props;
|
|
|
|
|
2020-03-10 01:52:49 +08:00
|
|
|
if (!podIds || podIds.length < 1) return [];
|
|
|
|
|
|
|
|
// We still have code for other pods from the Flash client. This intentionally only cares
|
|
|
|
// about the first one because it's the default.
|
|
|
|
const { podId } = podIds[0];
|
2020-01-25 09:02:36 +08:00
|
|
|
|
2021-04-07 22:37:49 +08:00
|
|
|
const presentationItemElements = presentations
|
|
|
|
.sort((a, b) => (a.name.localeCompare(b.name)))
|
|
|
|
.map((p) => {
|
2021-11-06 03:13:33 +08:00
|
|
|
const customStyles = { color: colorPrimary };
|
2020-01-25 09:02:36 +08:00
|
|
|
|
2021-04-27 07:04:34 +08:00
|
|
|
return (
|
2021-08-09 01:13:47 +08:00
|
|
|
{
|
2021-11-06 03:13:33 +08:00
|
|
|
customStyles: p.current ? customStyles : null,
|
2021-08-09 01:13:47 +08:00
|
|
|
icon: "file",
|
|
|
|
iconRight: p.current ? 'check' : null,
|
2022-12-16 02:53:41 +08:00
|
|
|
selected: p.current ? true : false,
|
2021-08-09 01:13:47 +08:00
|
|
|
label: p.name,
|
|
|
|
description: "uploaded presentation file",
|
|
|
|
key: `uploaded-presentation-${p.id}`,
|
|
|
|
onClick: () => {
|
2021-04-27 07:04:34 +08:00
|
|
|
setPresentation(p.id, podId);
|
2021-08-09 01:13:47 +08:00
|
|
|
},
|
|
|
|
}
|
2021-04-07 22:37:49 +08:00
|
|
|
);
|
|
|
|
});
|
2020-01-25 09:02:36 +08:00
|
|
|
|
|
|
|
return presentationItemElements;
|
|
|
|
}
|
|
|
|
|
2023-03-22 01:55:43 +08:00
|
|
|
setExternalVideoModalIsOpen(value) {
|
|
|
|
this.setState({isExternalVideoModalOpen: value});
|
|
|
|
}
|
|
|
|
setRandomUserSelectModalIsOpen(value) {
|
|
|
|
this.setState({isRandomUserSelectModalOpen: value});
|
|
|
|
}
|
|
|
|
setLayoutModalIsOpen(value) {
|
|
|
|
this.setState({isLayoutModalOpen: value});
|
|
|
|
}
|
2023-04-27 00:09:02 +08:00
|
|
|
setCameraAsContentModalIsOpen(value) {
|
|
|
|
this.setState({isCameraAsContentModalOpen: value});
|
|
|
|
}
|
|
|
|
setPropsToPassModal(value) {
|
|
|
|
this.setState({propsToPassModal: value});
|
|
|
|
}
|
|
|
|
setForceOpen(value){
|
|
|
|
this.setState({forceOpen: value});
|
|
|
|
}
|
2023-03-22 01:55:43 +08:00
|
|
|
|
2023-04-12 23:51:23 +08:00
|
|
|
renderModal(isOpen, setIsOpen, priority, Component) {
|
2023-03-29 22:38:48 +08:00
|
|
|
return isOpen ? <Component
|
|
|
|
{...{
|
|
|
|
onRequestClose: () => setIsOpen(false),
|
|
|
|
priority,
|
|
|
|
setIsOpen,
|
|
|
|
isOpen
|
|
|
|
}}
|
|
|
|
/> : null
|
|
|
|
}
|
|
|
|
|
2023-05-11 04:03:20 +08:00
|
|
|
handleTimerClick(activate) {
|
2021-09-03 20:44:16 +08:00
|
|
|
const { mountModal, layoutContextDispatch } = this.props;
|
2023-05-11 04:03:20 +08:00
|
|
|
if (activate) {
|
2021-09-03 20:44:16 +08:00
|
|
|
TimerService.activateTimer(layoutContextDispatch);
|
2023-05-11 04:03:20 +08:00
|
|
|
} else {
|
|
|
|
TimerService.deactivateTimer();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-10-18 05:29:00 +08:00
|
|
|
render() {
|
2017-09-13 04:47:06 +08:00
|
|
|
const {
|
|
|
|
intl,
|
2019-09-07 04:28:02 +08:00
|
|
|
amIPresenter,
|
2018-11-01 02:51:56 +08:00
|
|
|
shortcuts: OPEN_ACTIONS_AK,
|
2019-06-27 00:29:34 +08:00
|
|
|
isMeteorConnected,
|
2021-05-12 22:07:18 +08:00
|
|
|
isDropdownOpen,
|
2022-03-04 01:46:20 +08:00
|
|
|
isMobile,
|
2022-05-13 21:42:19 +08:00
|
|
|
isRTL,
|
2023-04-12 23:51:23 +08:00
|
|
|
isSelectRandomUserEnabled,
|
2023-04-27 00:09:02 +08:00
|
|
|
propsToPassModal,
|
2017-09-13 04:47:06 +08:00
|
|
|
} = this.props;
|
2017-03-24 23:37:33 +08:00
|
|
|
|
2023-04-27 00:09:02 +08:00
|
|
|
const {
|
|
|
|
isExternalVideoModalOpen,
|
|
|
|
isRandomUserSelectModalOpen,
|
|
|
|
isLayoutModalOpen,
|
|
|
|
isCameraAsContentModalOpen,
|
|
|
|
} = this.state;
|
2023-03-22 01:55:43 +08:00
|
|
|
|
2018-01-17 21:34:35 +08:00
|
|
|
const availableActions = this.getAvailableActions();
|
2020-01-25 09:02:36 +08:00
|
|
|
const availablePresentations = this.makePresentationItems();
|
2021-08-10 06:39:04 +08:00
|
|
|
const children = availablePresentations.length > 1 && amIPresenter
|
2020-01-25 09:02:36 +08:00
|
|
|
? availablePresentations.concat(availableActions) : availableActions;
|
2018-01-17 21:34:35 +08:00
|
|
|
|
2023-03-08 03:09:02 +08:00
|
|
|
const customStyles = { top: '-1rem' };
|
|
|
|
|
|
|
|
if (availableActions.length === 0
|
2019-09-07 04:28:02 +08:00
|
|
|
|| !isMeteorConnected) {
|
|
|
|
return null;
|
|
|
|
}
|
2023-03-08 03:09:02 +08:00
|
|
|
|
2016-10-18 05:29:00 +08:00
|
|
|
return (
|
2023-03-22 01:55:43 +08:00
|
|
|
<>
|
|
|
|
<BBBMenu
|
|
|
|
customStyles={!isMobile ? customStyles : null}
|
|
|
|
accessKey={OPEN_ACTIONS_AK}
|
|
|
|
trigger={
|
|
|
|
<Styled.HideDropdownButton
|
|
|
|
open={isDropdownOpen}
|
|
|
|
hideLabel
|
|
|
|
aria-label={intl.formatMessage(intlMessages.actionsLabel)}
|
|
|
|
data-test="actionsButton"
|
|
|
|
label={intl.formatMessage(intlMessages.actionsLabel)}
|
|
|
|
icon="plus"
|
|
|
|
color="primary"
|
|
|
|
size="lg"
|
|
|
|
circle
|
|
|
|
onClick={() => null}
|
|
|
|
/>
|
|
|
|
}
|
|
|
|
actions={children}
|
|
|
|
opts={{
|
|
|
|
id: "actions-dropdown-menu",
|
|
|
|
keepMounted: true,
|
|
|
|
transitionDuration: 0,
|
|
|
|
elevation: 3,
|
2023-05-10 09:31:48 +08:00
|
|
|
getcontentanchorel: null,
|
2023-03-22 01:55:43 +08:00
|
|
|
fullwidth: "true",
|
|
|
|
anchorOrigin: { vertical: 'top', horizontal: isRTL ? 'right' : 'left' },
|
|
|
|
transformOrigin: { vertical: 'bottom', horizontal: isRTL ? 'right' : 'left' },
|
|
|
|
}}
|
|
|
|
/>
|
2023-03-29 22:38:48 +08:00
|
|
|
{this.renderModal(isExternalVideoModalOpen, this.setExternalVideoModalIsOpen, "low",
|
|
|
|
ExternalVideoModal)}
|
2023-04-12 23:51:23 +08:00
|
|
|
{(amIPresenter && isSelectRandomUserEnabled) ? this.renderModal(isRandomUserSelectModalOpen, this.setRandomUserSelectModalIsOpen,
|
|
|
|
"low", RandomUserSelectContainer) : null }
|
2023-04-27 00:09:02 +08:00
|
|
|
{this.renderModal(isLayoutModalOpen, this.setLayoutModalIsOpen,
|
2023-04-12 23:51:23 +08:00
|
|
|
"low", LayoutModalContainer)}
|
2023-04-27 00:09:02 +08:00
|
|
|
{this.renderModal(isCameraAsContentModalOpen, this.setCameraAsContentModalIsOpen,
|
|
|
|
'low', () => (
|
|
|
|
<VideoPreviewContainer
|
|
|
|
cameraAsContent
|
|
|
|
amIPresenter
|
|
|
|
{...{
|
|
|
|
callbackToClose: () => {
|
|
|
|
this.setPropsToPassModal({});
|
|
|
|
this.setForceOpen(false);
|
|
|
|
},
|
|
|
|
priority: 'low',
|
|
|
|
setIsOpen: this.setCameraAsContentModalIsOpen,
|
|
|
|
isOpen: isCameraAsContentModalOpen,
|
|
|
|
}}
|
|
|
|
{...propsToPassModal}
|
|
|
|
/>
|
|
|
|
))}
|
2023-03-22 01:55:43 +08:00
|
|
|
</>
|
2016-10-18 05:29:00 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-06-07 20:01:18 +08:00
|
|
|
ActionsDropdown.propTypes = propTypes;
|
2019-11-06 05:36:03 +08:00
|
|
|
ActionsDropdown.defaultProps = defaultProps;
|
2017-06-07 20:01:18 +08:00
|
|
|
|
2023-03-22 01:55:43 +08:00
|
|
|
export default withShortcutHelper(ActionsDropdown, 'openActions');
|