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

InviteDialog.web.js 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. import PropTypes from 'prop-types';
  2. import React, { Component } from 'react';
  3. import { connect } from 'react-redux';
  4. import { getInviteURL } from '../../base/connection';
  5. import { Dialog } from '../../base/dialog';
  6. import { translate } from '../../base/i18n';
  7. import JitsiMeetJS from '../../base/lib-jitsi-meet';
  8. import { getLocalParticipant, PARTICIPANT_ROLE } from '../../base/participants';
  9. import DialInNumbersForm from './DialInNumbersForm';
  10. import PasswordContainer from './PasswordContainer';
  11. import ShareLinkForm from './ShareLinkForm';
  12. /**
  13. * A React {@code Component} for displaying other components responsible for
  14. * copying the current conference url and for setting or removing a conference
  15. * password.
  16. */
  17. class InviteDialog extends Component {
  18. /**
  19. * {@code InviteDialog} component's property types.
  20. *
  21. * @static
  22. */
  23. static propTypes = {
  24. /**
  25. * The redux store representation of the JitsiConference.
  26. */
  27. _conference: PropTypes.object,
  28. /**
  29. * The url for the JitsiConference.
  30. */
  31. _inviteURL: PropTypes.string,
  32. /**
  33. * Whether or not the current user is a conference moderator.
  34. */
  35. _isModerator: PropTypes.bool,
  36. /**
  37. * Invoked to obtain translated strings.
  38. */
  39. t: PropTypes.func
  40. };
  41. /**
  42. * Reports an analytics event for the invite modal being closed.
  43. *
  44. * @inheritdoc
  45. */
  46. componentWillUnmount() {
  47. JitsiMeetJS.analytics.sendEvent('toolbar.invite.close');
  48. }
  49. /**
  50. * Implements React's {@link Component#render()}.
  51. *
  52. * @inheritdoc
  53. * @returns {ReactElement}
  54. */
  55. render() {
  56. const { _conference, _inviteURL, t } = this.props;
  57. const titleString
  58. = t('invite.inviteTo', { conferenceName: _conference.room });
  59. return (
  60. <Dialog
  61. cancelDisabled = { true }
  62. okTitleKey = 'dialog.done'
  63. titleString = { titleString }>
  64. <div className = 'invite-dialog'>
  65. <ShareLinkForm toCopy = { _inviteURL } />
  66. <DialInNumbersForm inviteURL = { _inviteURL } />
  67. <PasswordContainer
  68. conference = { _conference.conference }
  69. locked = { _conference.locked }
  70. password = { _conference.password }
  71. showPasswordEdit = { this.props._isModerator } />
  72. </div>
  73. </Dialog>
  74. );
  75. }
  76. }
  77. /**
  78. * Maps (parts of) the Redux state to the associated {@code InviteDialog}'s
  79. * props.
  80. *
  81. * @param {Object} state - The Redux state.
  82. * @private
  83. * @returns {{
  84. * _conference: Object,
  85. * _inviteURL: string,
  86. * _isModerator: boolean
  87. * }}
  88. */
  89. function _mapStateToProps(state) {
  90. return {
  91. _conference: state['features/base/conference'],
  92. _inviteURL: getInviteURL(state),
  93. _isModerator:
  94. getLocalParticipant(state).role === PARTICIPANT_ROLE.MODERATOR
  95. };
  96. }
  97. export default translate(connect(_mapStateToProps)(InviteDialog));