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.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // @flow
  2. import type { Dispatch } from 'redux';
  3. import { getFeatureFlag, INVITE_ENABLED } from '../../../../base/flags';
  4. import { translate } from '../../../../base/i18n';
  5. import { IconAddPeople } from '../../../../base/icons';
  6. import { connect } from '../../../../base/redux';
  7. import { AbstractButton, type AbstractButtonProps } from '../../../../base/toolbox/components';
  8. import { doInvitePeople } from '../../../actions.native';
  9. type Props = AbstractButtonProps & {
  10. /**
  11. * The Redux dispatch function.
  12. */
  13. dispatch: Dispatch<any>
  14. };
  15. /**
  16. * Implements an {@link AbstractButton} to enter add/invite people to the
  17. * current call/conference/meeting.
  18. */
  19. class InviteButton extends AbstractButton<Props, *> {
  20. accessibilityLabel = 'toolbar.accessibilityLabel.shareRoom';
  21. icon = IconAddPeople;
  22. label = 'toolbar.shareRoom';
  23. /**
  24. * Handles clicking / pressing the button, and opens the appropriate dialog.
  25. *
  26. * @private
  27. * @returns {void}
  28. */
  29. _handleClick() {
  30. this.props.dispatch(doInvitePeople());
  31. }
  32. }
  33. /**
  34. * Maps part of the Redux state to the props of this component.
  35. *
  36. * @param {Object} state - The Redux state.
  37. * @param {Props} ownProps - The own props of the component.
  38. * @returns {Props}
  39. */
  40. function _mapStateToProps(state, ownProps: Props) {
  41. const { disableInviteFunctions } = state['features/base/config'];
  42. const flag = getFeatureFlag(state, INVITE_ENABLED, true);
  43. return {
  44. visible: flag && !disableInviteFunctions && ownProps.visible
  45. };
  46. }
  47. export default translate(connect(_mapStateToProps)(InviteButton));