您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

InviteButton.js 1.8KB

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