Fix null child element

This commit is contained in:
Augusto Bennemann 2018-01-17 11:34:35 -02:00
parent 5bf96b3c84
commit 10cdd603bc

View File

@ -66,6 +66,34 @@ class ActionsDropdown extends Component {
this.props.mountModal(<PresentationUploaderContainer />);
}
getAvailableActions() {
const {
intl,
handleShareScreen,
handleUnshareScreen,
isVideoBroadcasting,
} = this.props;
return _.compact([
(<DropdownListItem
icon="presentation"
label={intl.formatMessage(intlMessages.presentationLabel)}
description={intl.formatMessage(intlMessages.presentationDesc)}
key={_.uniqueId('action-item-')}
onClick={this.handlePresentationClick}
/>),
(Meteor.settings.public.kurento.enableScreensharing ?
<DropdownListItem
icon="desktop"
label={intl.formatMessage(isVideoBroadcasting ? intlMessages.stopDesktopShareLabel : intlMessages.desktopShareLabel)}
description={intl.formatMessage(isVideoBroadcasting ? intlMessages.stopDesktopShareDesc : intlMessages.desktopShareDesc)}
key={_.uniqueId('action-item-')}
onClick={isVideoBroadcasting ? handleUnshareScreen : handleShareScreen }
/>
: null),
]);
}
render() {
const {
intl,
@ -75,6 +103,8 @@ class ActionsDropdown extends Component {
isVideoBroadcasting,
} = this.props;
const availableActions = this.getAvailableActions();
if (!isUserPresenter) return null;
return (
@ -94,20 +124,7 @@ class ActionsDropdown extends Component {
</DropdownTrigger>
<DropdownContent placement="top left">
<DropdownList>
<DropdownListItem
icon="presentation"
label={intl.formatMessage(intlMessages.presentationLabel)}
description={intl.formatMessage(intlMessages.presentationDesc)}
onClick={this.handlePresentationClick}
/>
{Meteor.settings.public.kurento.enableScreensharing ?
<DropdownListItem
icon="desktop"
label={intl.formatMessage(isVideoBroadcasting ? intlMessages.stopDesktopShareLabel : intlMessages.desktopShareLabel)}
description={intl.formatMessage(isVideoBroadcasting ? intlMessages.stopDesktopShareDesc : intlMessages.desktopShareDesc)}
onClick={isVideoBroadcasting ? handleUnshareScreen : handleShareScreen }
/>
: null}
{availableActions}
</DropdownList>
</DropdownContent>
</Dropdown>