You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

InviteButton.js 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // @flow
  2. import type { Dispatch } from 'redux';
  3. import { translate } from '../../../../base/i18n';
  4. import { IconAddPeople } from '../../../../base/icons';
  5. import { connect } from '../../../../base/redux';
  6. import { AbstractButton } from '../../../../base/toolbox';
  7. import type { AbstractButtonProps } from '../../../../base/toolbox';
  8. import { setAddPeopleDialogVisible } from '../../../actions';
  9. import { isAddPeopleEnabled, isDialOutEnabled } from '../../../functions';
  10. type Props = AbstractButtonProps & {
  11. /**
  12. * The Redux dispatch function.
  13. */
  14. dispatch: Dispatch<any>
  15. };
  16. /**
  17. * Implements an {@link AbstractButton} to enter add/invite people to the
  18. * current call/conference/meeting.
  19. */
  20. class InviteButton extends AbstractButton<Props, *> {
  21. accessibilityLabel = 'toolbar.accessibilityLabel.shareRoom';
  22. icon = IconAddPeople;
  23. label = 'toolbar.shareRoom';
  24. /**
  25. * Handles clicking / pressing the button, and opens the appropriate dialog.
  26. *
  27. * @private
  28. * @returns {void}
  29. */
  30. _handleClick() {
  31. this.props.dispatch(setAddPeopleDialogVisible(true));
  32. }
  33. }
  34. /**
  35. * Maps (parts of) the redux state to {@link InviteButton}'s React {@code Component}
  36. * props.
  37. *
  38. * @param {Object} state - The redux store/state.
  39. * @param {Object} ownProps - The properties explicitly passed to the component
  40. * instance.
  41. * @private
  42. * @returns {Object}
  43. */
  44. function _mapStateToProps(state: Object, ownProps: Object) {
  45. const addPeopleEnabled = isAddPeopleEnabled(state) || isDialOutEnabled(state);
  46. const { visible = Boolean(addPeopleEnabled) } = ownProps;
  47. return {
  48. visible
  49. };
  50. }
  51. export default translate(connect(_mapStateToProps)(InviteButton));