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

InviteButton.js 2.0KB

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