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

InviteButton.js 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // @flow
  2. import type { Dispatch } from 'redux';
  3. import { translate } from '../../../../base/i18n';
  4. import { connect } from '../../../../base/redux';
  5. import { AbstractButton } from '../../../../base/toolbox';
  6. import type { AbstractButtonProps } from '../../../../base/toolbox';
  7. import { setAddPeopleDialogVisible } from '../../../actions';
  8. import { isAddPeopleEnabled, isDialOutEnabled } from '../../../functions';
  9. type Props = AbstractButtonProps & {
  10. /**
  11. * Whether or not the feature to invite people to join the
  12. * conference is available.
  13. */
  14. _addPeopleEnabled: boolean,
  15. /**
  16. * The Redux dispatch function.
  17. */
  18. dispatch: Dispatch<any>
  19. };
  20. /**
  21. * Implements an {@link AbstractButton} to enter add/invite people to the
  22. * current call/conference/meeting.
  23. */
  24. class InviteButton extends AbstractButton<Props, *> {
  25. accessibilityLabel = 'toolbar.accessibilityLabel.shareRoom';
  26. iconName = 'icon-link';
  27. label = 'toolbar.shareRoom';
  28. /**
  29. * Handles clicking / pressing the button, and opens the appropriate dialog.
  30. *
  31. * @private
  32. * @returns {void}
  33. */
  34. _handleClick() {
  35. this.props.dispatch(setAddPeopleDialogVisible(true));
  36. }
  37. /**
  38. * Returns true if none of the invite methods are available.
  39. *
  40. * @protected
  41. * @returns {boolean}
  42. */
  43. _isDisabled() {
  44. return !this.props._addPeopleEnabled;
  45. }
  46. }
  47. /**
  48. * Maps (parts of) the redux state to {@link InviteButton}'s React {@code Component}
  49. * props.
  50. *
  51. * @param {Object} state - The redux store/state.
  52. * @private
  53. * @returns {{
  54. * _addPeopleEnabled: boolean
  55. * }}
  56. */
  57. function _mapStateToProps(state) {
  58. return {
  59. _addPeopleEnabled: isAddPeopleEnabled(state) || isDialOutEnabled(state)
  60. };
  61. }
  62. export default translate(connect(_mapStateToProps)(InviteButton));