Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

MuteRemoteParticipantDialog.web.js 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. import PropTypes from 'prop-types';
  2. import React, { Component } from 'react';
  3. import { connect } from 'react-redux';
  4. import { Dialog } from '../../base/dialog';
  5. import { translate } from '../../base/i18n';
  6. import { sendAnalyticsEvent } from '../../analytics';
  7. import { muteRemoteParticipant } from '../../base/participants';
  8. /**
  9. * A React Component with the contents for a dialog that asks for confirmation
  10. * from the user before muting a remote participant.
  11. *
  12. * @extends Component
  13. */
  14. class MuteRemoteParticipantDialog extends Component {
  15. /**
  16. * {@code MuteRemoteParticipantDialog} component's property types.
  17. *
  18. * @static
  19. */
  20. static propTypes = {
  21. /**
  22. * Invoked to send a request for muting the participant with the passed
  23. * in participantID.
  24. */
  25. dispatch: PropTypes.func,
  26. /**
  27. * The ID of the participant linked to the onClick callback.
  28. */
  29. participantID: PropTypes.string,
  30. /**
  31. * Invoked to obtain translated strings.
  32. */
  33. t: PropTypes.func
  34. };
  35. /**
  36. * Initializes a new {@code MuteRemoteParticipantDialog} instance.
  37. *
  38. * @param {Object} props - The read-only properties with which the new
  39. * instance is to be initialized.
  40. */
  41. constructor(props) {
  42. super(props);
  43. // Bind event handlers so they are only bound once per instance.
  44. this._onSubmit = this._onSubmit.bind(this);
  45. this._renderContent = this._renderContent.bind(this);
  46. }
  47. /**
  48. * Implements React's {@link Component#render()}.
  49. *
  50. * @inheritdoc
  51. * @returns {ReactElement}
  52. */
  53. render() {
  54. return (
  55. <Dialog
  56. okTitleKey = 'dialog.muteParticipantButton'
  57. onSubmit = { this._onSubmit }
  58. titleKey = 'dialog.muteParticipantTitle'
  59. width = 'small'>
  60. { this._renderContent() }
  61. </Dialog>
  62. );
  63. }
  64. /**
  65. * Handles the submit button action.
  66. *
  67. * @private
  68. * @returns {void}
  69. */
  70. _onSubmit() {
  71. const { dispatch, participantID } = this.props;
  72. sendAnalyticsEvent(
  73. 'remotevideomenu.mute.confirmed',
  74. {
  75. value: 1,
  76. label: participantID
  77. }
  78. );
  79. dispatch(muteRemoteParticipant(participantID));
  80. return true;
  81. }
  82. /**
  83. * Renders the content of the dialog.
  84. *
  85. * @returns {Component} the react component, which is the view of the dialog
  86. * content
  87. * @private
  88. */
  89. _renderContent() {
  90. const { t } = this.props;
  91. return (
  92. <div>
  93. { t('dialog.muteParticipantBody') }
  94. </div>
  95. );
  96. }
  97. }
  98. export default translate(connect()(MuteRemoteParticipantDialog));