2017-06-04 10:40:14 +08:00
|
|
|
import React, { Component } from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
2016-10-18 05:29:00 +08:00
|
|
|
import { defineMessages, injectIntl } from 'react-intl';
|
|
|
|
|
|
|
|
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';
|
|
|
|
import DropdownList from '/imports/ui/components/dropdown/list/component';
|
|
|
|
import DropdownListItem from '/imports/ui/components/dropdown/list/item/component';
|
|
|
|
|
|
|
|
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
|
|
|
},
|
|
|
|
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
|
|
|
},
|
|
|
|
initPollLabel: {
|
|
|
|
id: 'app.actionsBar.actionsDropdown.initPollLabel',
|
2017-04-10 23:50:03 +08:00
|
|
|
description: 'Initiate a poll option label',
|
2016-10-18 05:29:00 +08:00
|
|
|
},
|
|
|
|
desktopShareLabel: {
|
|
|
|
id: 'app.actionsBar.actionsDropdown.desktopShareLabel',
|
2017-04-10 23:50:03 +08:00
|
|
|
description: 'Desktop Share 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
|
|
|
},
|
|
|
|
initPollDesc: {
|
|
|
|
id: 'app.actionsBar.actionsDropdown.initPollDesc',
|
2017-04-11 21:52:30 +08:00
|
|
|
description: 'adds context to init Poll 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-06-03 03:25:02 +08:00
|
|
|
const presentation = () => { console.log('Should show the uploader component'); };
|
2016-10-18 05:29:00 +08:00
|
|
|
|
2017-06-03 03:25:02 +08:00
|
|
|
const polling = () => { console.log('Should initiate a polling'); };
|
2016-10-18 05:29:00 +08:00
|
|
|
|
|
|
|
class ActionsDropdown extends Component {
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
2017-09-13 04:47:06 +08:00
|
|
|
const {
|
|
|
|
intl,
|
|
|
|
isUserPresenter,
|
|
|
|
handleShareScreen,
|
|
|
|
} = this.props;
|
|
|
|
|
2017-03-24 23:37:33 +08:00
|
|
|
|
2017-09-13 04:47:06 +08:00
|
|
|
if (!isUserPresenter) return null;
|
|
|
|
//return null; // temporarily disabling the functionality
|
2017-03-24 22:49:38 +08:00
|
|
|
|
2016-10-18 05:29:00 +08:00
|
|
|
return (
|
2017-06-11 03:21:13 +08:00
|
|
|
<Dropdown ref={(ref) => { this._dropdown = ref; }}>
|
2017-05-19 02:38:07 +08:00
|
|
|
<DropdownTrigger tabIndex={0}>
|
2016-10-18 05:29:00 +08:00
|
|
|
<Button
|
|
|
|
label={intl.formatMessage(intlMessages.actionsLabel)}
|
2017-03-02 09:03:02 +08:00
|
|
|
icon="add"
|
2016-10-18 05:29:00 +08:00
|
|
|
color="primary"
|
|
|
|
size="lg"
|
2017-06-03 03:25:02 +08:00
|
|
|
circle
|
2016-10-18 05:29:00 +08:00
|
|
|
onClick={() => null}
|
|
|
|
/>
|
|
|
|
</DropdownTrigger>
|
|
|
|
<DropdownContent placement="top left">
|
|
|
|
<DropdownList>
|
|
|
|
<DropdownListItem
|
|
|
|
icon="presentation"
|
|
|
|
label={intl.formatMessage(intlMessages.presentationLabel)}
|
|
|
|
description={intl.formatMessage(intlMessages.presentationDesc)}
|
|
|
|
onClick={presentation.bind(this)}
|
|
|
|
/>
|
|
|
|
|
|
|
|
{/* These icons are unaligned because of the font issue
|
|
|
|
Check it later */}
|
|
|
|
<DropdownListItem
|
|
|
|
icon="polling"
|
|
|
|
label={intl.formatMessage(intlMessages.initPollLabel)}
|
|
|
|
description={intl.formatMessage(intlMessages.initPollDesc)}
|
|
|
|
onClick={polling.bind(this)}
|
|
|
|
/>
|
|
|
|
<DropdownListItem
|
|
|
|
icon="desktop"
|
|
|
|
label={intl.formatMessage(intlMessages.desktopShareLabel)}
|
|
|
|
description={intl.formatMessage(intlMessages.desktopShareDesc)}
|
2017-09-13 04:47:06 +08:00
|
|
|
onClick={handleShareScreen}
|
2016-10-18 05:29:00 +08:00
|
|
|
/>
|
|
|
|
</DropdownList>
|
|
|
|
</DropdownContent>
|
|
|
|
</Dropdown>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default injectIntl(ActionsDropdown);
|