2016-09-22 03:49:31 +08:00
|
|
|
import React, { Component, PropTypes } from 'react';
|
|
|
|
import { defineMessages, injectIntl } from 'react-intl';
|
2016-12-06 03:16:52 +08:00
|
|
|
import cx from 'classnames';
|
2016-09-08 03:17:15 +08:00
|
|
|
import styles from '../styles';
|
2016-09-02 04:19:37 +08:00
|
|
|
|
|
|
|
import { showModal } from '/imports/ui/components/app/service';
|
|
|
|
import LogoutConfirmation from '/imports/ui/components/logout-confirmation/component';
|
2016-12-08 23:40:11 +08:00
|
|
|
import AboutContainer from '/imports/ui/components/about/container';
|
2016-11-24 04:01:09 +08:00
|
|
|
import SettingsMenuContainer from '/imports/ui/components/settings/container';
|
2016-09-02 04:19:37 +08:00
|
|
|
|
|
|
|
import Button from '/imports/ui/components/button/component';
|
|
|
|
import Dropdown from '/imports/ui/components/dropdown/component';
|
|
|
|
import DropdownTrigger from '/imports/ui/components/dropdown/trigger/component';
|
|
|
|
import DropdownContent from '/imports/ui/components/dropdown/content/component';
|
2016-09-07 03:10:18 +08:00
|
|
|
import DropdownList from '/imports/ui/components/dropdown/list/component';
|
|
|
|
import DropdownListItem from '/imports/ui/components/dropdown/list/item/component';
|
|
|
|
import DropdownListSeparator from '/imports/ui/components/dropdown/list/separator/component';
|
|
|
|
|
2016-09-22 03:49:31 +08:00
|
|
|
const intlMessages = defineMessages({
|
2016-09-23 04:51:00 +08:00
|
|
|
optionsLabel: {
|
2016-09-27 05:55:33 +08:00
|
|
|
id: 'app.navBar.settingsDropdown.optionsLabel',
|
2016-09-22 03:49:31 +08:00
|
|
|
defaultMessage: 'Options',
|
|
|
|
},
|
|
|
|
fullscreenLabel: {
|
2016-09-27 05:55:33 +08:00
|
|
|
id: 'app.navBar.settingsDropdown.fullscreenLabel',
|
2016-09-22 03:49:31 +08:00
|
|
|
defaultMessage: 'Make fullscreen',
|
|
|
|
},
|
|
|
|
settingsLabel: {
|
2016-09-27 05:55:33 +08:00
|
|
|
id: 'app.navBar.settingsDropdown.settingsLabel',
|
2016-09-22 03:49:31 +08:00
|
|
|
defaultMessage: 'Open settings',
|
|
|
|
},
|
2016-12-08 05:14:14 +08:00
|
|
|
aboutLabel: {
|
|
|
|
id: 'app.navBar.settingsDropdown.aboutLabel',
|
|
|
|
defaultMessage: 'About',
|
|
|
|
},
|
|
|
|
aboutDesc: {
|
|
|
|
id: 'app.navBar.settingsDropdown.aboutDesc',
|
|
|
|
defaultMessage: 'About',
|
|
|
|
},
|
2016-09-22 03:49:31 +08:00
|
|
|
leaveSessionLabel: {
|
2016-09-27 05:55:33 +08:00
|
|
|
id: 'app.navBar.settingsDropdown.leaveSessionLabel',
|
2016-09-22 03:49:31 +08:00
|
|
|
defaultMessage: 'Logout',
|
|
|
|
},
|
2016-09-23 04:51:00 +08:00
|
|
|
fullscreenDesc: {
|
2016-09-27 05:55:33 +08:00
|
|
|
id: 'app.navBar.settingsDropdown.fullscreenDesc',
|
2016-09-23 04:51:00 +08:00
|
|
|
defaultMessage: 'Make the settings menu fullscreen',
|
|
|
|
},
|
|
|
|
settingsDesc: {
|
2016-09-27 05:55:33 +08:00
|
|
|
id: 'app.navBar.settingsDropdown.settingsDesc',
|
2016-09-23 04:51:00 +08:00
|
|
|
defaultMessage: 'Change the general settings',
|
|
|
|
},
|
|
|
|
leaveSessionDesc: {
|
2016-09-27 05:55:33 +08:00
|
|
|
id: 'app.navBar.settingsDropdown.leaveSessionDesc',
|
2016-09-23 04:51:00 +08:00
|
|
|
defaultMessage: 'Leave the meeting',
|
|
|
|
},
|
2017-02-14 00:21:53 +08:00
|
|
|
exitFullScreenDesc: {
|
|
|
|
id: 'app.navBar.settingsDropdown.exitFullScreenDesc',
|
2017-02-14 23:11:27 +08:00
|
|
|
defaultMessage: 'exit fullscreen mode',
|
2017-02-14 00:21:53 +08:00
|
|
|
},
|
|
|
|
exitFullScreenLabel: {
|
|
|
|
id: 'app.navBar.settingsDropdown.exitFullScreenLabel',
|
|
|
|
defaultMessage: 'Exit fullscreen',
|
|
|
|
},
|
2016-09-22 03:49:31 +08:00
|
|
|
});
|
|
|
|
|
2016-11-24 04:01:09 +08:00
|
|
|
const openSettings = () => showModal(<SettingsMenuContainer />);
|
2016-09-02 04:19:37 +08:00
|
|
|
|
2016-12-21 02:06:01 +08:00
|
|
|
const openAbout = () => showModal(<AboutContainer />);
|
2016-12-08 05:14:14 +08:00
|
|
|
|
2016-09-07 03:10:18 +08:00
|
|
|
const openLogoutConfirmation = () => showModal(<LogoutConfirmation />);
|
2016-09-02 04:19:37 +08:00
|
|
|
|
2016-09-27 05:55:33 +08:00
|
|
|
class SettingsDropdown extends Component {
|
2016-09-07 03:10:18 +08:00
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
2016-09-02 04:19:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
2017-02-14 00:21:53 +08:00
|
|
|
|
2017-03-17 08:29:58 +08:00
|
|
|
const { intl, isFullScreen } = this.props;
|
2017-02-14 00:21:53 +08:00
|
|
|
|
2017-03-17 08:29:58 +08:00
|
|
|
let fullScreenLabel = intl.formatMessage(intlMessages.fullscreenLabel);
|
|
|
|
let fullScreenDesc = intl.formatMessage(intlMessages.fullscreenDesc);
|
2017-02-14 00:21:53 +08:00
|
|
|
|
2017-03-17 08:29:58 +08:00
|
|
|
if (isFullScreen) {
|
2017-02-14 00:21:53 +08:00
|
|
|
fullScreenLabel = intl.formatMessage(intlMessages.exitFullScreenLabel);
|
|
|
|
fullScreenDesc = intl.formatMessage(intlMessages.exitFullScreenDesc);
|
|
|
|
}
|
|
|
|
|
2016-09-02 04:19:37 +08:00
|
|
|
return (
|
|
|
|
<Dropdown ref="dropdown">
|
|
|
|
<DropdownTrigger>
|
|
|
|
<Button
|
2016-09-23 04:51:00 +08:00
|
|
|
label={intl.formatMessage(intlMessages.optionsLabel)}
|
2016-09-02 04:19:37 +08:00
|
|
|
icon="more"
|
|
|
|
ghost={true}
|
|
|
|
circle={true}
|
|
|
|
hideLabel={true}
|
2016-12-06 03:16:52 +08:00
|
|
|
className={cx(styles.btn, styles.btnSettings)}
|
2016-09-07 03:10:18 +08:00
|
|
|
|
|
|
|
// FIXME: Without onClick react proptypes keep warning
|
|
|
|
// even after the DropdownTrigger inject an onClick handler
|
|
|
|
onClick={() => null}
|
2016-09-02 04:19:37 +08:00
|
|
|
/>
|
|
|
|
</DropdownTrigger>
|
2016-09-07 03:10:18 +08:00
|
|
|
<DropdownContent placement="bottom right">
|
|
|
|
<DropdownList>
|
|
|
|
<DropdownListItem
|
2016-09-14 03:46:12 +08:00
|
|
|
icon="fullscreen"
|
2017-02-14 00:21:53 +08:00
|
|
|
label={fullScreenLabel}
|
|
|
|
description={fullScreenDesc}
|
|
|
|
onClick={this.props.handleToggleFullscreen}
|
2016-09-07 03:10:18 +08:00
|
|
|
/>
|
|
|
|
<DropdownListItem
|
|
|
|
icon="more"
|
2016-09-22 03:49:31 +08:00
|
|
|
label={intl.formatMessage(intlMessages.settingsLabel)}
|
2016-09-23 04:51:00 +08:00
|
|
|
description={intl.formatMessage(intlMessages.settingsDesc)}
|
2016-09-07 03:10:18 +08:00
|
|
|
onClick={openSettings.bind(this)}
|
|
|
|
/>
|
2016-12-08 05:14:14 +08:00
|
|
|
<DropdownListItem
|
2016-12-08 23:58:58 +08:00
|
|
|
label={intl.formatMessage(intlMessages.aboutLabel)}
|
|
|
|
description={intl.formatMessage(intlMessages.aboutDesc)}
|
2016-12-09 00:04:28 +08:00
|
|
|
onClick={openAbout.bind(this)}
|
2016-12-08 05:14:14 +08:00
|
|
|
/>
|
2016-09-07 03:10:18 +08:00
|
|
|
<DropdownListSeparator />
|
|
|
|
<DropdownListItem
|
|
|
|
icon="logout"
|
2016-09-22 03:49:31 +08:00
|
|
|
label={intl.formatMessage(intlMessages.leaveSessionLabel)}
|
2016-09-23 04:51:00 +08:00
|
|
|
description={intl.formatMessage(intlMessages.leaveSessionDesc)}
|
2016-09-07 03:10:18 +08:00
|
|
|
onClick={openLogoutConfirmation.bind(this)}
|
|
|
|
/>
|
|
|
|
</DropdownList>
|
2016-09-02 04:19:37 +08:00
|
|
|
</DropdownContent>
|
|
|
|
</Dropdown>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2016-09-22 03:49:31 +08:00
|
|
|
|
|
|
|
export default injectIntl(SettingsDropdown);
|