You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

InviteDialog.js 3.1KB

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