2019-04-02 13:16:52 +00:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
import type { Dispatch } from 'redux';
|
|
|
|
|
2020-04-29 07:35:18 +00:00
|
|
|
import { getFeatureFlag, INVITE_ENABLED } from '../../../../base/flags';
|
2019-04-02 13:16:52 +00:00
|
|
|
import { translate } from '../../../../base/i18n';
|
2019-08-30 16:39:06 +00:00
|
|
|
import { IconAddPeople } from '../../../../base/icons';
|
2019-04-02 13:16:52 +00:00
|
|
|
import { connect } from '../../../../base/redux';
|
2020-07-24 12:14:33 +00:00
|
|
|
import { AbstractButton, type AbstractButtonProps } from '../../../../base/toolbox/components';
|
2020-03-24 12:37:24 +00:00
|
|
|
import { doInvitePeople } from '../../../actions.native';
|
2019-04-02 13:16:52 +00:00
|
|
|
|
|
|
|
type Props = AbstractButtonProps & {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The Redux dispatch function.
|
|
|
|
*/
|
|
|
|
dispatch: Dispatch<any>
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements an {@link AbstractButton} to enter add/invite people to the
|
|
|
|
* current call/conference/meeting.
|
|
|
|
*/
|
|
|
|
class InviteButton extends AbstractButton<Props, *> {
|
|
|
|
accessibilityLabel = 'toolbar.accessibilityLabel.shareRoom';
|
2019-08-30 16:39:06 +00:00
|
|
|
icon = IconAddPeople;
|
2019-04-02 13:16:52 +00:00
|
|
|
label = 'toolbar.shareRoom';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handles clicking / pressing the button, and opens the appropriate dialog.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_handleClick() {
|
2020-03-24 12:37:24 +00:00
|
|
|
this.props.dispatch(doInvitePeople());
|
2019-04-02 13:16:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-09 13:26:19 +00:00
|
|
|
/**
|
|
|
|
* Maps part of the Redux state to the props of this component.
|
|
|
|
*
|
|
|
|
* @param {Object} state - The Redux state.
|
|
|
|
* @param {Props} ownProps - The own props of the component.
|
|
|
|
* @returns {Props}
|
|
|
|
*/
|
|
|
|
function _mapStateToProps(state, ownProps: Props) {
|
|
|
|
const { disableInviteFunctions } = state['features/base/config'];
|
2020-04-29 07:35:18 +00:00
|
|
|
const flag = getFeatureFlag(state, INVITE_ENABLED, true);
|
2020-04-09 13:26:19 +00:00
|
|
|
|
|
|
|
return {
|
2020-04-29 07:35:18 +00:00
|
|
|
visible: flag && !disableInviteFunctions && ownProps.visible
|
2020-04-09 13:26:19 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2019-04-02 13:16:52 +00:00
|
|
|
|
2020-04-09 13:26:19 +00:00
|
|
|
export default translate(connect(_mapStateToProps)(InviteButton));
|