code format and unused code removal
This commit is contained in:
parent
c9b27dfb4c
commit
7d484c1aef
@ -1,6 +1,5 @@
|
|||||||
import React, { PureComponent } from 'react';
|
import React, { PureComponent } from 'react';
|
||||||
import { defineMessages, injectIntl } from 'react-intl';
|
import { defineMessages, injectIntl } from 'react-intl';
|
||||||
import _ from 'lodash';
|
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { withModalMounter } from '/imports/ui/components/modal/service';
|
import { withModalMounter } from '/imports/ui/components/modal/service';
|
||||||
import EndMeetingConfirmationContainer from '/imports/ui/components/end-meeting-confirmation/container';
|
import EndMeetingConfirmationContainer from '/imports/ui/components/end-meeting-confirmation/container';
|
||||||
@ -8,7 +7,7 @@ import { makeCall } from '/imports/ui/services/api';
|
|||||||
import AboutContainer from '/imports/ui/components/about/container';
|
import AboutContainer from '/imports/ui/components/about/container';
|
||||||
import SettingsMenuContainer from '/imports/ui/components/settings/container';
|
import SettingsMenuContainer from '/imports/ui/components/settings/container';
|
||||||
import Button from '/imports/ui/components/button/component';
|
import Button from '/imports/ui/components/button/component';
|
||||||
import BBBMenu from "/imports/ui/components/menu/component";
|
import BBBMenu from '/imports/ui/components/menu/component';
|
||||||
import ShortcutHelpComponent from '/imports/ui/components/shortcut-help/component';
|
import ShortcutHelpComponent from '/imports/ui/components/shortcut-help/component';
|
||||||
import withShortcutHelper from '/imports/ui/components/shortcut-help/service';
|
import withShortcutHelper from '/imports/ui/components/shortcut-help/service';
|
||||||
import FullscreenService from '../../fullscreen-button/service';
|
import FullscreenService from '../../fullscreen-button/service';
|
||||||
@ -87,7 +86,9 @@ const intlMessages = defineMessages({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
intl: PropTypes.object.isRequired,
|
intl: PropTypes.shape({
|
||||||
|
formatMessage: PropTypes.func.isRequired,
|
||||||
|
}).isRequired,
|
||||||
handleToggleFullscreen: PropTypes.func.isRequired,
|
handleToggleFullscreen: PropTypes.func.isRequired,
|
||||||
mountModal: PropTypes.func.isRequired,
|
mountModal: PropTypes.func.isRequired,
|
||||||
noIOSFullscreen: PropTypes.bool,
|
noIOSFullscreen: PropTypes.bool,
|
||||||
@ -95,6 +96,7 @@ const propTypes = {
|
|||||||
shortcuts: PropTypes.string,
|
shortcuts: PropTypes.string,
|
||||||
isBreakoutRoom: PropTypes.bool,
|
isBreakoutRoom: PropTypes.bool,
|
||||||
isMeteorConnected: PropTypes.bool.isRequired,
|
isMeteorConnected: PropTypes.bool.isRequired,
|
||||||
|
isDropdownOpen: PropTypes.bool,
|
||||||
};
|
};
|
||||||
|
|
||||||
const defaultProps = {
|
const defaultProps = {
|
||||||
@ -102,6 +104,7 @@ const defaultProps = {
|
|||||||
amIModerator: false,
|
amIModerator: false,
|
||||||
shortcuts: '',
|
shortcuts: '',
|
||||||
isBreakoutRoom: false,
|
isBreakoutRoom: false,
|
||||||
|
isDropdownOpen: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
const ALLOW_FULLSCREEN = Meteor.settings.public.app.allowFullscreen;
|
const ALLOW_FULLSCREEN = Meteor.settings.public.app.allowFullscreen;
|
||||||
@ -111,15 +114,12 @@ class SettingsDropdown extends PureComponent {
|
|||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
isSettingOpen: false,
|
|
||||||
isFullscreen: false,
|
isFullscreen: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Set the logout code to 680 because it's not a real code and can be matched on the other side
|
// 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.LOGOUT_CODE = '680';
|
||||||
|
|
||||||
this.onActionsShow = this.onActionsShow.bind(this);
|
|
||||||
this.onActionsHide = this.onActionsHide.bind(this);
|
|
||||||
this.leaveSession = this.leaveSession.bind(this);
|
this.leaveSession = this.leaveSession.bind(this);
|
||||||
this.onFullscreenChange = this.onFullscreenChange.bind(this);
|
this.onFullscreenChange = this.onFullscreenChange.bind(this);
|
||||||
}
|
}
|
||||||
@ -132,18 +132,6 @@ class SettingsDropdown extends PureComponent {
|
|||||||
document.documentElement.removeEventListener('fullscreenchange', this.onFullscreenChange);
|
document.documentElement.removeEventListener('fullscreenchange', this.onFullscreenChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
onActionsShow() {
|
|
||||||
this.setState({
|
|
||||||
isSettingOpen: true,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
onActionsHide() {
|
|
||||||
this.setState({
|
|
||||||
isSettingOpen: false,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
onFullscreenChange() {
|
onFullscreenChange() {
|
||||||
const { isFullscreen } = this.state;
|
const { isFullscreen } = this.state;
|
||||||
const newIsFullscreen = FullscreenService.isFullScreen(document.documentElement);
|
const newIsFullscreen = FullscreenService.isFullScreen(document.documentElement);
|
||||||
@ -175,12 +163,12 @@ class SettingsDropdown extends PureComponent {
|
|||||||
return (
|
return (
|
||||||
menuItems.push(
|
menuItems.push(
|
||||||
{
|
{
|
||||||
key: "list-item-fullscreen",
|
key: 'list-item-fullscreen',
|
||||||
icon: fullscreenIcon,
|
icon: fullscreenIcon,
|
||||||
label: fullscreenLabel,
|
label: fullscreenLabel,
|
||||||
// description: fullscreenDesc,
|
// description: fullscreenDesc,
|
||||||
onClick: handleToggleFullscreen
|
onClick: handleToggleFullscreen,
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -190,11 +178,9 @@ class SettingsDropdown extends PureComponent {
|
|||||||
// we don't check askForFeedbackOnLogout here,
|
// we don't check askForFeedbackOnLogout here,
|
||||||
// it is checked in meeting-ended component
|
// it is checked in meeting-ended component
|
||||||
Session.set('codeError', this.LOGOUT_CODE);
|
Session.set('codeError', this.LOGOUT_CODE);
|
||||||
// mountModal(<MeetingEndedComponent code={LOGOUT_CODE} />);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
renderMenuItems() {
|
renderMenuItems() {
|
||||||
|
|
||||||
const {
|
const {
|
||||||
intl, mountModal, amIModerator, isBreakoutRoom, isMeteorConnected,
|
intl, mountModal, amIModerator, isBreakoutRoom, isMeteorConnected,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
@ -209,77 +195,76 @@ class SettingsDropdown extends PureComponent {
|
|||||||
|
|
||||||
this.menuItems = [];
|
this.menuItems = [];
|
||||||
|
|
||||||
this.getFullscreenItem(this.menuItems),
|
this.getFullscreenItem(this.menuItems);
|
||||||
|
|
||||||
this.menuItems.push(
|
this.menuItems.push(
|
||||||
{
|
{
|
||||||
key: "list-item-settings",
|
key: 'list-item-settings',
|
||||||
icon: "settings",
|
icon: 'settings',
|
||||||
dataTest: "settings",
|
dataTest: 'settings',
|
||||||
label: intl.formatMessage(intlMessages.settingsLabel),
|
label: intl.formatMessage(intlMessages.settingsLabel),
|
||||||
// description: intl.formatMessage(intlMessages.settingsDesc),
|
// description: intl.formatMessage(intlMessages.settingsDesc),
|
||||||
onClick: () => mountModal(<SettingsMenuContainer />)
|
onClick: () => mountModal(<SettingsMenuContainer />),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: "list-item-about",
|
key: 'list-item-about',
|
||||||
icon: "about",
|
icon: 'about',
|
||||||
label: intl.formatMessage(intlMessages.aboutLabel),
|
label: intl.formatMessage(intlMessages.aboutLabel),
|
||||||
// description: intl.formatMessage(intlMessages.aboutDesc),
|
// description: intl.formatMessage(intlMessages.aboutDesc),
|
||||||
onClick: () => mountModal(<AboutContainer />)
|
onClick: () => mountModal(<AboutContainer />),
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (helpButton) {
|
if (helpButton) {
|
||||||
this.menuItems.push(
|
this.menuItems.push(
|
||||||
{
|
{
|
||||||
key: "list-item-help",
|
key: 'list-item-help',
|
||||||
icon: "help",
|
icon: 'help',
|
||||||
iconRight: "popout_window",
|
iconRight: 'popout_window',
|
||||||
label: intl.formatMessage(intlMessages.helpLabel),
|
label: intl.formatMessage(intlMessages.helpLabel),
|
||||||
// description: intl.formatMessage(intlMessages.helpDesc),
|
// description: intl.formatMessage(intlMessages.helpDesc),
|
||||||
onClick: () => window.open(`${helpLink}`)
|
onClick: () => window.open(`${helpLink}`),
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.menuItems.push(
|
this.menuItems.push(
|
||||||
{
|
{
|
||||||
key: "list-item-shortcuts",
|
key: 'list-item-shortcuts',
|
||||||
icon: "shortcuts",
|
icon: 'shortcuts',
|
||||||
label: intl.formatMessage(intlMessages.hotkeysLabel),
|
label: intl.formatMessage(intlMessages.hotkeysLabel),
|
||||||
// description: intl.formatMessage(intlMessages.hotkeysDesc),
|
// description: intl.formatMessage(intlMessages.hotkeysDesc),
|
||||||
onClick: () => mountModal(<ShortcutHelpComponent />),
|
onClick: () => mountModal(<ShortcutHelpComponent />),
|
||||||
divider: true
|
divider: true,
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (allowedToEndMeeting && isMeteorConnected) {
|
if (allowedToEndMeeting && isMeteorConnected) {
|
||||||
this.menuItems.push(
|
this.menuItems.push(
|
||||||
{
|
{
|
||||||
key: "list-item-end-meeting",
|
key: 'list-item-end-meeting',
|
||||||
icon: "application",
|
icon: 'application',
|
||||||
label: intl.formatMessage(intlMessages.endMeetingLabel),
|
label: intl.formatMessage(intlMessages.endMeetingLabel),
|
||||||
// description: intl.formatMessage(intlMessages.endMeetingDesc),
|
// description: intl.formatMessage(intlMessages.endMeetingDesc),
|
||||||
onClick: () => mountModal(<EndMeetingConfirmationContainer />)
|
onClick: () => mountModal(<EndMeetingConfirmationContainer />),
|
||||||
}
|
},
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (allowLogoutSetting && isMeteorConnected) {
|
if (allowLogoutSetting && isMeteorConnected) {
|
||||||
this.menuItems.push(
|
this.menuItems.push(
|
||||||
{
|
{
|
||||||
key: "list-item-logout",
|
key: 'list-item-logout',
|
||||||
dataTest: "logout",
|
dataTest: 'logout',
|
||||||
icon: "logout",
|
icon: 'logout',
|
||||||
label: intl.formatMessage(intlMessages.leaveSessionLabel),
|
label: intl.formatMessage(intlMessages.leaveSessionLabel),
|
||||||
// description: intl.formatMessage(intlMessages.leaveSessionDesc),
|
// description: intl.formatMessage(intlMessages.leaveSessionDesc),
|
||||||
onClick: () => this.leaveSession()
|
onClick: () => this.leaveSession(),
|
||||||
}
|
},
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.menuItems;
|
return this.menuItems;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
@ -294,7 +279,7 @@ class SettingsDropdown extends PureComponent {
|
|||||||
<BBBMenu
|
<BBBMenu
|
||||||
classes={[styles.offsetTop]}
|
classes={[styles.offsetTop]}
|
||||||
accessKey={OPEN_OPTIONS_AK}
|
accessKey={OPEN_OPTIONS_AK}
|
||||||
trigger={
|
trigger={(
|
||||||
<Button
|
<Button
|
||||||
label={intl.formatMessage(intlMessages.optionsLabel)}
|
label={intl.formatMessage(intlMessages.optionsLabel)}
|
||||||
icon="more"
|
icon="more"
|
||||||
@ -302,13 +287,11 @@ class SettingsDropdown extends PureComponent {
|
|||||||
circle
|
circle
|
||||||
hideLabel
|
hideLabel
|
||||||
className={isDropdownOpen ? styles.hideDropdownButton : styles.btn}
|
className={isDropdownOpen ? styles.hideDropdownButton : styles.btn}
|
||||||
|
|
||||||
// FIXME: Without onClick react proptypes keep warning
|
// FIXME: Without onClick react proptypes keep warning
|
||||||
// even after the DropdownTrigger inject an onClick handler
|
// even after the DropdownTrigger inject an onClick handler
|
||||||
onClick={() => null}
|
onClick={() => null}
|
||||||
/>
|
/>
|
||||||
}
|
)}
|
||||||
|
|
||||||
actions={this.renderMenuItems()}
|
actions={this.renderMenuItems()}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user