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.web.js 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. import React, { Component } from 'react';
  2. import { connect } from 'react-redux';
  3. import { getInviteURL } from '../../base/connection';
  4. import { Dialog } from '../../base/dialog';
  5. import { translate } from '../../base/i18n';
  6. import JitsiMeetJS from '../../base/lib-jitsi-meet';
  7. import { getLocalParticipant, PARTICIPANT_ROLE } from '../../base/participants';
  8. import DialInNumbersForm from './DialInNumbersForm';
  9. import PasswordContainer from './PasswordContainer';
  10. import ShareLinkForm from './ShareLinkForm';
  11. /**
  12. * A React {@code Component} for displaying other components responsible for
  13. * copying the current conference url and for setting or removing a conference
  14. * password.
  15. */
  16. class InviteDialog extends Component {
  17. /**
  18. * {@code InviteDialog} component's property types.
  19. *
  20. * @static
  21. */
  22. static propTypes = {
  23. /**
  24. * The redux store representation of the JitsiConference.
  25. */
  26. _conference: React.PropTypes.object,
  27. /**
  28. * The url for the JitsiConference.
  29. */
  30. _inviteURL: React.PropTypes.string,
  31. /**
  32. * Whether or not the current user is a conference moderator.
  33. */
  34. _isModerator: React.PropTypes.bool,
  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, _inviteURL, t } = this.props;
  56. const titleString
  57. = t('invite.inviteTo', { conferenceName: _conference.room });
  58. return (
  59. <Dialog
  60. cancelDisabled = { true }
  61. okTitleKey = 'dialog.done'
  62. titleString = { titleString }>
  63. <div className = 'invite-dialog'>
  64. <ShareLinkForm toCopy = { _inviteURL } />
  65. <DialInNumbersForm inviteURL = { _inviteURL } />
  66. <PasswordContainer
  67. conference = { _conference.conference }
  68. locked = { _conference.locked }
  69. password = { _conference.password }
  70. showPasswordEdit = { this.props._isModerator } />
  71. </div>
  72. </Dialog>
  73. );
  74. }
  75. }
  76. /**
  77. * Maps (parts of) the Redux state to the associated {@code InviteDialog}'s
  78. * props.
  79. *
  80. * @param {Object} state - The Redux state.
  81. * @private
  82. * @returns {{
  83. * _conference: Object,
  84. * _inviteURL: string,
  85. * _isModerator: boolean
  86. * }}
  87. */
  88. function _mapStateToProps(state) {
  89. return {
  90. _conference: state['features/base/conference'],
  91. _inviteURL: getInviteURL(state),
  92. _isModerator:
  93. getLocalParticipant(state).role === PARTICIPANT_ROLE.MODERATOR
  94. };
  95. }
  96. export default translate(connect(_mapStateToProps)(InviteDialog));