Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

InviteDialog.js 2.9KB

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