2018-11-23 22:14:48 +08:00
|
|
|
import React, { PureComponent } from 'react';
|
2020-05-26 04:00:13 +08:00
|
|
|
import { defineMessages, injectIntl } from 'react-intl';
|
2019-01-16 02:08:42 +08:00
|
|
|
import PropTypes from 'prop-types';
|
2019-01-12 08:20:04 +08:00
|
|
|
import EndMeetingConfirmationContainer from '/imports/ui/components/end-meeting-confirmation/container';
|
2016-12-08 23:40:11 +08:00
|
|
|
import AboutContainer from '/imports/ui/components/about/container';
|
2022-11-15 20:49:24 +08:00
|
|
|
import MobileAppModal from '/imports/ui/components/mobile-app-modal/container';
|
2023-09-22 04:47:51 +08:00
|
|
|
import OptionsMenuContainer from '/imports/ui/components/settings/container';
|
2022-02-15 23:38:55 +08:00
|
|
|
import BBBMenu from '/imports/ui/components/common/menu/component';
|
2018-04-27 01:24:25 +08:00
|
|
|
import ShortcutHelpComponent from '/imports/ui/components/shortcut-help/component';
|
2018-11-01 02:51:56 +08:00
|
|
|
import withShortcutHelper from '/imports/ui/components/shortcut-help/service';
|
2022-02-15 22:42:02 +08:00
|
|
|
import FullscreenService from '/imports/ui/components/common/fullscreen-button/service';
|
2022-11-10 23:09:19 +08:00
|
|
|
import { colorDanger, colorWhite } from '/imports/ui/stylesheets/styled-components/palette';
|
2023-11-29 02:31:28 +08:00
|
|
|
import { OptionsDropdownItemType } from 'bigbluebutton-html-plugin-sdk/dist/cjs/extensible-areas/options-dropdown-item/enums';
|
2021-12-10 22:55:37 +08:00
|
|
|
import Styled from './styles';
|
2021-12-06 20:18:23 +08:00
|
|
|
import browserInfo from '/imports/utils/browserInfo';
|
2022-11-15 20:49:24 +08:00
|
|
|
import deviceInfo from '/imports/utils/deviceInfo';
|
2017-10-06 20:50:01 +08:00
|
|
|
|
2016-09-22 03:49:31 +08:00
|
|
|
const intlMessages = defineMessages({
|
2016-09-23 04:51:00 +08:00
|
|
|
optionsLabel: {
|
2023-09-22 04:47:51 +08:00
|
|
|
id: 'app.navBar.optionsDropdown.optionsLabel',
|
2017-04-10 23:50:03 +08:00
|
|
|
description: 'Options button label',
|
2016-09-22 03:49:31 +08:00
|
|
|
},
|
|
|
|
fullscreenLabel: {
|
2023-09-22 04:47:51 +08:00
|
|
|
id: 'app.navBar.optionsDropdown.fullscreenLabel',
|
2017-04-10 23:50:03 +08:00
|
|
|
description: 'Make fullscreen option label',
|
2016-09-22 03:49:31 +08:00
|
|
|
},
|
|
|
|
settingsLabel: {
|
2023-09-22 04:47:51 +08:00
|
|
|
id: 'app.navBar.optionsDropdown.settingsLabel',
|
2017-04-10 23:50:03 +08:00
|
|
|
description: 'Open settings option label',
|
2016-09-22 03:49:31 +08:00
|
|
|
},
|
2016-12-08 05:14:14 +08:00
|
|
|
aboutLabel: {
|
2023-09-22 04:47:51 +08:00
|
|
|
id: 'app.navBar.optionsDropdown.aboutLabel',
|
2017-04-10 23:50:03 +08:00
|
|
|
description: 'About option label',
|
2016-12-08 05:14:14 +08:00
|
|
|
},
|
|
|
|
aboutDesc: {
|
2023-09-22 04:47:51 +08:00
|
|
|
id: 'app.navBar.optionsDropdown.aboutDesc',
|
2017-04-10 23:50:03 +08:00
|
|
|
description: 'Describes about option',
|
2016-12-08 05:14:14 +08:00
|
|
|
},
|
2016-09-22 03:49:31 +08:00
|
|
|
leaveSessionLabel: {
|
2023-09-22 04:47:51 +08:00
|
|
|
id: 'app.navBar.optionsDropdown.leaveSessionLabel',
|
2017-04-10 23:50:03 +08:00
|
|
|
description: 'Leave session button label',
|
2016-09-22 03:49:31 +08:00
|
|
|
},
|
2016-09-23 04:51:00 +08:00
|
|
|
fullscreenDesc: {
|
2023-09-22 04:47:51 +08:00
|
|
|
id: 'app.navBar.optionsDropdown.fullscreenDesc',
|
2017-04-10 23:50:03 +08:00
|
|
|
description: 'Describes fullscreen option',
|
2016-09-23 04:51:00 +08:00
|
|
|
},
|
|
|
|
settingsDesc: {
|
2023-09-22 04:47:51 +08:00
|
|
|
id: 'app.navBar.optionsDropdown.settingsDesc',
|
2017-04-10 23:50:03 +08:00
|
|
|
description: 'Describes settings option',
|
2016-09-23 04:51:00 +08:00
|
|
|
},
|
|
|
|
leaveSessionDesc: {
|
2023-09-22 04:47:51 +08:00
|
|
|
id: 'app.navBar.optionsDropdown.leaveSessionDesc',
|
2017-04-10 23:50:03 +08:00
|
|
|
description: 'Describes leave session option',
|
2016-09-23 04:51:00 +08:00
|
|
|
},
|
2017-08-11 00:05:51 +08:00
|
|
|
exitFullscreenDesc: {
|
2023-09-22 04:47:51 +08:00
|
|
|
id: 'app.navBar.optionsDropdown.exitFullscreenDesc',
|
2017-04-10 23:50:03 +08:00
|
|
|
description: 'Describes exit fullscreen option',
|
2017-02-14 00:21:53 +08:00
|
|
|
},
|
2017-08-11 00:05:51 +08:00
|
|
|
exitFullscreenLabel: {
|
2023-09-22 04:47:51 +08:00
|
|
|
id: 'app.navBar.optionsDropdown.exitFullscreenLabel',
|
2017-04-10 23:50:03 +08:00
|
|
|
description: 'Exit fullscreen option label',
|
2017-02-14 00:21:53 +08:00
|
|
|
},
|
2018-05-03 10:20:38 +08:00
|
|
|
hotkeysLabel: {
|
2023-09-22 04:47:51 +08:00
|
|
|
id: 'app.navBar.optionsDropdown.hotkeysLabel',
|
2018-05-03 11:33:28 +08:00
|
|
|
description: 'Hotkeys options label',
|
2018-05-03 10:20:38 +08:00
|
|
|
},
|
|
|
|
hotkeysDesc: {
|
2023-09-22 04:47:51 +08:00
|
|
|
id: 'app.navBar.optionsDropdown.hotkeysDesc',
|
2018-05-03 11:33:28 +08:00
|
|
|
description: 'Describes hotkeys option',
|
2018-05-03 10:20:38 +08:00
|
|
|
},
|
2018-08-10 05:08:16 +08:00
|
|
|
helpLabel: {
|
2023-09-22 04:47:51 +08:00
|
|
|
id: 'app.navBar.optionsDropdown.helpLabel',
|
2018-08-10 05:08:16 +08:00
|
|
|
description: 'Help options label',
|
|
|
|
},
|
2022-11-15 20:49:24 +08:00
|
|
|
openAppLabel: {
|
2023-09-22 04:47:51 +08:00
|
|
|
id: 'app.navBar.optionsDropdown.openAppLabel',
|
2022-11-15 20:49:24 +08:00
|
|
|
description: 'Open mobile app label',
|
|
|
|
},
|
2018-08-10 05:08:16 +08:00
|
|
|
helpDesc: {
|
2023-09-22 04:47:51 +08:00
|
|
|
id: 'app.navBar.optionsDropdown.helpDesc',
|
2018-08-10 05:08:16 +08:00
|
|
|
description: 'Describes help option',
|
|
|
|
},
|
2019-01-12 08:20:04 +08:00
|
|
|
endMeetingLabel: {
|
2024-02-06 21:12:25 +08:00
|
|
|
id: 'app.navBar.optionsDropdown.endMeetingForAllLabel',
|
2019-01-12 08:20:04 +08:00
|
|
|
description: 'End meeting options label',
|
|
|
|
},
|
|
|
|
endMeetingDesc: {
|
2023-09-22 04:47:51 +08:00
|
|
|
id: 'app.navBar.optionsDropdown.endMeetingDesc',
|
2019-01-12 08:20:04 +08:00
|
|
|
description: 'Describes settings option closing the current meeting',
|
|
|
|
},
|
2022-05-14 00:04:23 +08:00
|
|
|
startCaption: {
|
|
|
|
id: 'app.audio.captions.button.start',
|
|
|
|
description: 'Start audio captions',
|
|
|
|
},
|
|
|
|
stopCaption: {
|
|
|
|
id: 'app.audio.captions.button.stop',
|
|
|
|
description: 'Stop audio captions',
|
|
|
|
},
|
2016-09-22 03:49:31 +08:00
|
|
|
});
|
|
|
|
|
2019-01-16 02:08:42 +08:00
|
|
|
const propTypes = {
|
2021-08-14 01:04:42 +08:00
|
|
|
intl: PropTypes.shape({
|
|
|
|
formatMessage: PropTypes.func.isRequired,
|
|
|
|
}).isRequired,
|
2019-01-16 02:08:42 +08:00
|
|
|
handleToggleFullscreen: PropTypes.func.isRequired,
|
2019-03-11 03:21:48 +08:00
|
|
|
noIOSFullscreen: PropTypes.bool,
|
2019-01-16 02:08:42 +08:00
|
|
|
amIModerator: PropTypes.bool,
|
|
|
|
shortcuts: PropTypes.string,
|
2019-05-14 22:28:18 +08:00
|
|
|
isBreakoutRoom: PropTypes.bool,
|
2019-06-27 00:29:34 +08:00
|
|
|
isMeteorConnected: PropTypes.bool.isRequired,
|
2021-08-14 01:04:42 +08:00
|
|
|
isDropdownOpen: PropTypes.bool,
|
2024-02-17 04:25:43 +08:00
|
|
|
audioCaptionsEnabled: PropTypes.bool,
|
2022-05-14 00:04:23 +08:00
|
|
|
audioCaptionsActive: PropTypes.bool.isRequired,
|
|
|
|
audioCaptionsSet: PropTypes.func.isRequired,
|
2022-03-04 02:03:05 +08:00
|
|
|
isMobile: PropTypes.bool.isRequired,
|
2023-11-21 00:30:07 +08:00
|
|
|
isDirectLeaveButtonEnabled: PropTypes.bool.isRequired,
|
2023-09-22 04:47:51 +08:00
|
|
|
optionsDropdownItems: PropTypes.arrayOf(PropTypes.shape({
|
|
|
|
id: PropTypes.string,
|
|
|
|
type: PropTypes.string,
|
|
|
|
})).isRequired,
|
2023-12-08 03:40:32 +08:00
|
|
|
userLeaveMeeting: PropTypes.func.isRequired,
|
2019-01-16 02:08:42 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
const defaultProps = {
|
2019-03-11 03:21:48 +08:00
|
|
|
noIOSFullscreen: true,
|
2019-01-16 02:08:42 +08:00
|
|
|
amIModerator: false,
|
|
|
|
shortcuts: '',
|
2019-05-14 22:28:18 +08:00
|
|
|
isBreakoutRoom: false,
|
2021-08-14 01:04:42 +08:00
|
|
|
isDropdownOpen: false,
|
2024-02-17 04:25:43 +08:00
|
|
|
audioCaptionsEnabled: false,
|
2019-01-16 02:08:42 +08:00
|
|
|
};
|
|
|
|
|
2019-07-25 01:46:51 +08:00
|
|
|
const ALLOW_FULLSCREEN = Meteor.settings.public.app.allowFullscreen;
|
2022-11-15 20:49:24 +08:00
|
|
|
const BBB_TABLET_APP_CONFIG = Meteor.settings.public.app.bbbTabletApp;
|
|
|
|
const { isSafari, isTabletApp } = browserInfo;
|
2021-12-06 20:18:23 +08:00
|
|
|
const FULLSCREEN_CHANGE_EVENT = isSafari ? 'webkitfullscreenchange' : 'fullscreenchange';
|
2019-07-25 01:46:51 +08:00
|
|
|
|
2023-09-22 04:47:51 +08:00
|
|
|
class OptionsDropdown extends PureComponent {
|
2016-09-07 03:10:18 +08:00
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
2017-05-25 06:42:02 +08:00
|
|
|
|
|
|
|
this.state = {
|
2023-03-21 21:00:46 +08:00
|
|
|
isAboutModalOpen: false,
|
|
|
|
isShortcutHelpModalOpen: false,
|
2023-09-22 04:47:51 +08:00
|
|
|
isOptionsMenuModalOpen: false,
|
2023-03-21 21:00:46 +08:00
|
|
|
isEndMeetingConfirmationModalOpen: false,
|
2023-11-21 00:30:07 +08:00
|
|
|
isMobileAppModalOpen: false,
|
2019-07-27 00:48:51 +08:00
|
|
|
isFullscreen: false,
|
2017-05-25 06:42:02 +08:00
|
|
|
};
|
|
|
|
|
2019-06-13 23:02:02 +08:00
|
|
|
// Set the logout code to 680 because it's not a real code and can be matched on the other side
|
|
|
|
this.LOGOUT_CODE = '680';
|
|
|
|
|
|
|
|
this.leaveSession = this.leaveSession.bind(this);
|
2019-07-27 00:48:51 +08:00
|
|
|
this.onFullscreenChange = this.onFullscreenChange.bind(this);
|
2023-09-22 04:47:51 +08:00
|
|
|
this.setOptionsMenuModalIsOpen = this.setOptionsMenuModalIsOpen.bind(this);
|
2023-03-21 21:00:46 +08:00
|
|
|
this.setEndMeetingConfirmationModalIsOpen = this.setEndMeetingConfirmationModalIsOpen.bind(this);
|
|
|
|
this.setMobileAppModalIsOpen = this.setMobileAppModalIsOpen.bind(this);
|
2023-03-23 23:26:39 +08:00
|
|
|
this.setAboutModalIsOpen = this.setAboutModalIsOpen.bind(this);
|
|
|
|
this.setShortcutHelpModalIsOpen = this.setShortcutHelpModalIsOpen.bind(this);
|
2019-07-27 00:48:51 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
componentDidMount() {
|
2021-12-06 20:18:23 +08:00
|
|
|
document.documentElement.addEventListener(FULLSCREEN_CHANGE_EVENT, this.onFullscreenChange);
|
2019-07-30 23:03:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
componentWillUnmount() {
|
2021-12-06 20:18:23 +08:00
|
|
|
document.documentElement.removeEventListener(FULLSCREEN_CHANGE_EVENT, this.onFullscreenChange);
|
2017-12-16 14:41:54 +08:00
|
|
|
}
|
|
|
|
|
2019-07-27 00:48:51 +08:00
|
|
|
onFullscreenChange() {
|
|
|
|
const { isFullscreen } = this.state;
|
|
|
|
const newIsFullscreen = FullscreenService.isFullScreen(document.documentElement);
|
|
|
|
if (isFullscreen !== newIsFullscreen) {
|
|
|
|
this.setState({ isFullscreen: newIsFullscreen });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-09 01:13:47 +08:00
|
|
|
getFullscreenItem(menuItems) {
|
2019-01-16 02:08:42 +08:00
|
|
|
const {
|
|
|
|
intl,
|
2019-03-11 03:21:48 +08:00
|
|
|
noIOSFullscreen,
|
2019-01-16 02:08:42 +08:00
|
|
|
handleToggleFullscreen,
|
|
|
|
} = this.props;
|
2019-07-27 00:48:51 +08:00
|
|
|
const { isFullscreen } = this.state;
|
2017-05-25 06:42:02 +08:00
|
|
|
|
2019-07-25 01:46:51 +08:00
|
|
|
if (noIOSFullscreen || !ALLOW_FULLSCREEN) return null;
|
|
|
|
|
2018-05-09 05:37:58 +08:00
|
|
|
let fullscreenLabel = intl.formatMessage(intlMessages.fullscreenLabel);
|
|
|
|
let fullscreenDesc = intl.formatMessage(intlMessages.fullscreenDesc);
|
|
|
|
let fullscreenIcon = 'fullscreen';
|
2016-09-02 04:19:37 +08:00
|
|
|
|
2019-03-13 01:05:32 +08:00
|
|
|
if (isFullscreen) {
|
2018-05-09 00:04:15 +08:00
|
|
|
fullscreenLabel = intl.formatMessage(intlMessages.exitFullscreenLabel);
|
|
|
|
fullscreenDesc = intl.formatMessage(intlMessages.exitFullscreenDesc);
|
|
|
|
fullscreenIcon = 'exit_fullscreen';
|
|
|
|
}
|
2018-05-09 05:37:58 +08:00
|
|
|
|
2019-01-16 02:08:42 +08:00
|
|
|
return (
|
2021-08-09 01:13:47 +08:00
|
|
|
menuItems.push(
|
|
|
|
{
|
2021-08-14 01:04:42 +08:00
|
|
|
key: 'list-item-fullscreen',
|
2021-08-09 01:13:47 +08:00
|
|
|
icon: fullscreenIcon,
|
|
|
|
label: fullscreenLabel,
|
2022-10-28 22:46:37 +08:00
|
|
|
description: fullscreenDesc,
|
2021-08-14 01:04:42 +08:00
|
|
|
onClick: handleToggleFullscreen,
|
|
|
|
},
|
|
|
|
)
|
2018-12-06 01:42:31 +08:00
|
|
|
);
|
2019-01-16 02:08:42 +08:00
|
|
|
}
|
|
|
|
|
2019-05-25 05:26:00 +08:00
|
|
|
leaveSession() {
|
2023-12-08 03:40:32 +08:00
|
|
|
const { userLeaveMeeting } = this.props;
|
|
|
|
|
|
|
|
userLeaveMeeting();
|
2019-05-25 05:26:00 +08:00
|
|
|
// we don't check askForFeedbackOnLogout here,
|
|
|
|
// it is checked in meeting-ended component
|
2019-06-13 23:02:02 +08:00
|
|
|
Session.set('codeError', this.LOGOUT_CODE);
|
2019-05-25 05:26:00 +08:00
|
|
|
}
|
|
|
|
|
2023-03-21 21:00:46 +08:00
|
|
|
setAboutModalIsOpen(value) {
|
|
|
|
this.setState({isAboutModalOpen: value})
|
|
|
|
}
|
|
|
|
|
|
|
|
setShortcutHelpModalIsOpen(value) {
|
|
|
|
this.setState({isShortcutHelpModalOpen: value})
|
|
|
|
}
|
|
|
|
|
2023-09-22 04:47:51 +08:00
|
|
|
setOptionsMenuModalIsOpen(value) {
|
|
|
|
this.setState({isOptionsMenuModalOpen: value})
|
2023-03-21 21:00:46 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
setEndMeetingConfirmationModalIsOpen(value) {
|
|
|
|
this.setState({isEndMeetingConfirmationModalOpen: value})
|
|
|
|
}
|
|
|
|
|
|
|
|
setMobileAppModalIsOpen(value) {
|
|
|
|
this.setState({isMobileAppModalOpen: value})
|
|
|
|
}
|
|
|
|
|
2019-01-16 02:08:42 +08:00
|
|
|
renderMenuItems() {
|
|
|
|
const {
|
2023-03-21 21:00:46 +08:00
|
|
|
intl, amIModerator, isBreakoutRoom, isMeteorConnected, audioCaptionsEnabled,
|
2023-11-21 00:30:07 +08:00
|
|
|
audioCaptionsActive, audioCaptionsSet, isMobile, optionsDropdownItems, isDirectLeaveButtonEnabled,
|
2019-01-16 02:08:42 +08:00
|
|
|
} = this.props;
|
|
|
|
|
2022-11-15 20:49:24 +08:00
|
|
|
const { isIos } = deviceInfo;
|
|
|
|
|
2019-05-14 22:28:18 +08:00
|
|
|
const allowedToEndMeeting = amIModerator && !isBreakoutRoom;
|
|
|
|
|
2019-07-16 21:55:56 +08:00
|
|
|
const {
|
|
|
|
showHelpButton: helpButton,
|
|
|
|
helpLink,
|
|
|
|
allowLogout: allowLogoutSetting,
|
|
|
|
} = Meteor.settings.public.app;
|
|
|
|
|
2021-08-09 01:13:47 +08:00
|
|
|
this.menuItems = [];
|
|
|
|
|
2021-08-14 01:04:42 +08:00
|
|
|
this.getFullscreenItem(this.menuItems);
|
2021-08-09 01:13:47 +08:00
|
|
|
|
|
|
|
this.menuItems.push(
|
|
|
|
{
|
2021-08-14 01:04:42 +08:00
|
|
|
key: 'list-item-settings',
|
|
|
|
icon: 'settings',
|
|
|
|
dataTest: 'settings',
|
2021-08-09 01:13:47 +08:00
|
|
|
label: intl.formatMessage(intlMessages.settingsLabel),
|
2022-10-28 22:46:37 +08:00
|
|
|
description: intl.formatMessage(intlMessages.settingsDesc),
|
2023-09-22 04:47:51 +08:00
|
|
|
onClick: () => this.setOptionsMenuModalIsOpen(true),
|
2021-08-09 01:13:47 +08:00
|
|
|
},
|
|
|
|
{
|
2021-08-14 01:04:42 +08:00
|
|
|
key: 'list-item-about',
|
|
|
|
icon: 'about',
|
2022-08-18 19:46:31 +08:00
|
|
|
dataTest: 'aboutModal',
|
2021-08-09 01:13:47 +08:00
|
|
|
label: intl.formatMessage(intlMessages.aboutLabel),
|
2022-10-28 22:46:37 +08:00
|
|
|
description: intl.formatMessage(intlMessages.aboutDesc),
|
2023-03-21 21:00:46 +08:00
|
|
|
onClick: () => this.setAboutModalIsOpen(true),
|
2021-08-14 01:04:42 +08:00
|
|
|
},
|
2021-08-09 01:13:47 +08:00
|
|
|
);
|
|
|
|
|
2021-08-14 00:53:04 +08:00
|
|
|
if (helpButton) {
|
2021-08-09 01:13:47 +08:00
|
|
|
this.menuItems.push(
|
|
|
|
{
|
2021-08-14 01:04:42 +08:00
|
|
|
key: 'list-item-help',
|
|
|
|
icon: 'help',
|
|
|
|
iconRight: 'popout_window',
|
2021-08-09 01:13:47 +08:00
|
|
|
label: intl.formatMessage(intlMessages.helpLabel),
|
2022-09-07 00:52:45 +08:00
|
|
|
dataTest: 'helpButton',
|
2022-10-28 22:46:37 +08:00
|
|
|
description: intl.formatMessage(intlMessages.helpDesc),
|
2021-08-14 01:04:42 +08:00
|
|
|
onClick: () => window.open(`${helpLink}`),
|
|
|
|
},
|
2021-08-09 01:13:47 +08:00
|
|
|
);
|
|
|
|
}
|
2021-08-14 01:04:42 +08:00
|
|
|
|
2022-11-15 20:49:24 +08:00
|
|
|
if (isIos &&
|
|
|
|
!isTabletApp &&
|
|
|
|
BBB_TABLET_APP_CONFIG.enabled == true &&
|
|
|
|
BBB_TABLET_APP_CONFIG.iosAppStoreUrl !== '') {
|
|
|
|
this.menuItems.push(
|
|
|
|
{
|
|
|
|
key: 'list-item-help',
|
|
|
|
icon: 'popout_window',
|
|
|
|
label: intl.formatMessage(intlMessages.openAppLabel),
|
2023-03-21 21:00:46 +08:00
|
|
|
onClick: () => this.setMobileAppModalIsOpen(true),
|
2022-11-15 20:49:24 +08:00
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2022-05-14 00:04:23 +08:00
|
|
|
if (audioCaptionsEnabled && isMobile) {
|
|
|
|
this.menuItems.push(
|
|
|
|
{
|
|
|
|
key: 'audioCaptions',
|
|
|
|
dataTest: 'audioCaptions',
|
|
|
|
icon: audioCaptionsActive ? 'closed_caption_stop' : 'closed_caption',
|
|
|
|
label: intl.formatMessage(
|
|
|
|
audioCaptionsActive ? intlMessages.stopCaption : intlMessages.startCaption,
|
|
|
|
),
|
|
|
|
onClick: () => audioCaptionsSet(!audioCaptionsActive),
|
|
|
|
},
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2021-08-09 01:13:47 +08:00
|
|
|
this.menuItems.push(
|
|
|
|
{
|
2021-08-14 01:04:42 +08:00
|
|
|
key: 'list-item-shortcuts',
|
|
|
|
icon: 'shortcuts',
|
2021-08-09 01:13:47 +08:00
|
|
|
label: intl.formatMessage(intlMessages.hotkeysLabel),
|
2022-10-28 22:46:37 +08:00
|
|
|
description: intl.formatMessage(intlMessages.hotkeysDesc),
|
2023-03-21 21:00:46 +08:00
|
|
|
onClick: () => this.setShortcutHelpModalIsOpen(true),
|
2023-08-24 22:59:04 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
key: 'separator-01',
|
|
|
|
isSeparator: true,
|
2021-08-14 01:04:42 +08:00
|
|
|
},
|
2021-08-09 01:13:47 +08:00
|
|
|
);
|
|
|
|
|
2023-09-22 04:47:51 +08:00
|
|
|
optionsDropdownItems.forEach((item) => {
|
|
|
|
switch (item.type) {
|
2023-11-29 02:31:28 +08:00
|
|
|
case OptionsDropdownItemType.OPTION:
|
2023-09-22 04:47:51 +08:00
|
|
|
this.menuItems.push({
|
|
|
|
key: item.id,
|
|
|
|
icon: item.icon,
|
|
|
|
onClick: item.onClick,
|
|
|
|
label: item.label,
|
|
|
|
});
|
|
|
|
break;
|
2023-11-29 02:31:28 +08:00
|
|
|
case OptionsDropdownItemType.SEPARATOR:
|
2023-09-22 04:47:51 +08:00
|
|
|
this.menuItems.push({
|
|
|
|
key: item.id,
|
|
|
|
isSeparator: true,
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2023-11-21 00:30:07 +08:00
|
|
|
if (allowLogoutSetting && isMeteorConnected && !isDirectLeaveButtonEnabled) {
|
2021-08-09 01:13:47 +08:00
|
|
|
this.menuItems.push(
|
|
|
|
{
|
2022-10-27 21:05:07 +08:00
|
|
|
key: 'list-item-logout',
|
|
|
|
dataTest: 'logout',
|
|
|
|
icon: 'logout',
|
|
|
|
label: intl.formatMessage(intlMessages.leaveSessionLabel),
|
2022-11-10 22:00:28 +08:00
|
|
|
description: intl.formatMessage(intlMessages.leaveSessionDesc),
|
2022-10-27 21:05:07 +08:00
|
|
|
onClick: () => this.leaveSession(),
|
2021-08-14 01:04:42 +08:00
|
|
|
},
|
|
|
|
);
|
2021-08-14 00:53:04 +08:00
|
|
|
}
|
2021-08-09 01:13:47 +08:00
|
|
|
|
2023-11-21 00:30:07 +08:00
|
|
|
if (allowedToEndMeeting && isMeteorConnected && !isDirectLeaveButtonEnabled) {
|
2022-11-10 23:09:19 +08:00
|
|
|
const customStyles = { background: colorDanger, color: colorWhite };
|
2021-11-06 02:38:01 +08:00
|
|
|
|
2021-08-09 01:13:47 +08:00
|
|
|
this.menuItems.push(
|
|
|
|
{
|
2022-10-27 21:05:07 +08:00
|
|
|
key: 'list-item-end-meeting',
|
2024-02-06 21:12:25 +08:00
|
|
|
icon: 'close',
|
2022-10-27 21:05:07 +08:00
|
|
|
label: intl.formatMessage(intlMessages.endMeetingLabel),
|
2022-11-10 22:00:28 +08:00
|
|
|
description: intl.formatMessage(intlMessages.endMeetingDesc),
|
2021-11-06 02:38:01 +08:00
|
|
|
customStyles,
|
2023-03-21 21:00:46 +08:00
|
|
|
onClick: () => this.setEndMeetingConfirmationModalIsOpen(true),
|
2021-08-14 01:04:42 +08:00
|
|
|
},
|
|
|
|
);
|
2021-08-14 00:53:04 +08:00
|
|
|
}
|
2021-08-09 01:13:47 +08:00
|
|
|
|
|
|
|
return this.menuItems;
|
2017-12-16 14:41:54 +08:00
|
|
|
}
|
2017-02-14 00:21:53 +08:00
|
|
|
|
2023-03-23 23:26:39 +08:00
|
|
|
renderModal(isOpen, setIsOpen, priority, Component, otherOptions) {
|
|
|
|
return isOpen ? <Component
|
|
|
|
{...{
|
|
|
|
...otherOptions,
|
|
|
|
onRequestClose: () => setIsOpen(false),
|
|
|
|
priority,
|
|
|
|
setIsOpen,
|
|
|
|
isOpen
|
|
|
|
}}
|
|
|
|
/> : null
|
|
|
|
}
|
|
|
|
|
2017-12-16 14:41:54 +08:00
|
|
|
render() {
|
2018-11-01 02:51:56 +08:00
|
|
|
const {
|
|
|
|
intl,
|
|
|
|
shortcuts: OPEN_OPTIONS_AK,
|
2021-05-14 20:47:37 +08:00
|
|
|
isDropdownOpen,
|
2022-03-04 02:03:05 +08:00
|
|
|
isMobile,
|
2022-05-13 21:42:19 +08:00
|
|
|
isRTL,
|
2018-11-01 02:51:56 +08:00
|
|
|
} = this.props;
|
2017-02-14 00:21:53 +08:00
|
|
|
|
2023-09-22 04:47:51 +08:00
|
|
|
const { isAboutModalOpen, isShortcutHelpModalOpen, isOptionsMenuModalOpen,
|
2023-03-21 21:00:46 +08:00
|
|
|
isEndMeetingConfirmationModalOpen, isMobileAppModalOpen, } = this.state;
|
|
|
|
|
2022-05-13 21:42:19 +08:00
|
|
|
const customStyles = { top: '1rem' };
|
2021-08-14 01:04:42 +08:00
|
|
|
|
2021-11-06 02:38:01 +08:00
|
|
|
return (
|
2023-03-21 21:00:46 +08:00
|
|
|
<>
|
|
|
|
<BBBMenu
|
|
|
|
accessKey={OPEN_OPTIONS_AK}
|
|
|
|
customStyles={!isMobile ? customStyles : null}
|
|
|
|
trigger={(
|
|
|
|
<Styled.DropdownButton
|
|
|
|
state={isDropdownOpen ? 'open' : 'closed'}
|
|
|
|
label={intl.formatMessage(intlMessages.optionsLabel)}
|
|
|
|
icon="more"
|
|
|
|
data-test="optionsButton"
|
|
|
|
color="dark"
|
|
|
|
size="md"
|
|
|
|
circle
|
|
|
|
hideLabel
|
|
|
|
// FIXME: Without onClick react proptypes keep warning
|
|
|
|
// even after the DropdownTrigger inject an onClick handler
|
|
|
|
onClick={() => null}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
actions={this.renderMenuItems()}
|
|
|
|
opts={{
|
|
|
|
id: 'app-settings-dropdown-menu',
|
|
|
|
keepMounted: true,
|
|
|
|
transitionDuration: 0,
|
|
|
|
elevation: 3,
|
2023-05-10 09:31:48 +08:00
|
|
|
getcontentanchorel: null,
|
2023-03-21 21:00:46 +08:00
|
|
|
fullwidth: 'true',
|
|
|
|
anchorOrigin: { vertical: 'bottom', horizontal: isRTL ? 'left' : 'right' },
|
|
|
|
transformorigin: { vertical: 'top', horizontal: isRTL ? 'left' : 'right' },
|
|
|
|
}}
|
|
|
|
/>
|
2023-03-23 23:26:39 +08:00
|
|
|
{this.renderModal(isAboutModalOpen, this.setAboutModalIsOpen, "low",
|
|
|
|
AboutContainer)}
|
|
|
|
{this.renderModal(isShortcutHelpModalOpen, this.setShortcutHelpModalIsOpen,
|
|
|
|
"low", ShortcutHelpComponent)}
|
2023-09-22 04:47:51 +08:00
|
|
|
{this.renderModal(isOptionsMenuModalOpen, this.setOptionsMenuModalIsOpen,
|
|
|
|
"low", OptionsMenuContainer)}
|
2023-03-23 23:26:39 +08:00
|
|
|
{this.renderModal(isEndMeetingConfirmationModalOpen, this.setEndMeetingConfirmationModalIsOpen,
|
2023-03-29 22:38:48 +08:00
|
|
|
"low", EndMeetingConfirmationContainer)}
|
|
|
|
{this.renderModal(isMobileAppModalOpen, this.setMobileAppModalIsOpen, "low",
|
2023-03-23 23:26:39 +08:00
|
|
|
MobileAppModal)}
|
2023-03-21 21:00:46 +08:00
|
|
|
</>
|
2016-09-02 04:19:37 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2023-09-22 04:47:51 +08:00
|
|
|
OptionsDropdown.propTypes = propTypes;
|
|
|
|
OptionsDropdown.defaultProps = defaultProps;
|
|
|
|
export default withShortcutHelper(injectIntl(OptionsDropdown), 'openOptions');
|