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

InviteDialog.js 3.1KB

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