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.

MuteRemoteParticipantDialog.js 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. // @flow
  2. import React, { Component } from 'react';
  3. import { connect } from 'react-redux';
  4. import {
  5. createRemoteMuteConfirmedEvent,
  6. sendAnalytics
  7. } from '../../../analytics';
  8. import { ConfirmDialog } from '../../../base/dialog';
  9. import { translate } from '../../../base/i18n';
  10. import { muteRemoteParticipant } from '../../../base/participants';
  11. type Props = {
  12. /**
  13. * The Redux dispatch function.
  14. */
  15. dispatch: Function,
  16. /**
  17. * The remote participant to be muted.
  18. */
  19. participant: Object,
  20. /**
  21. * Function to translate i18n labels.
  22. */
  23. t: Function
  24. };
  25. /**
  26. * Dialog to confirm a remote participant mute action.
  27. */
  28. class MuteRemoteParticipantDialog extends Component<Props> {
  29. /**
  30. * Initializes a new {@code MuteRemoteParticipantDialog} instance.
  31. *
  32. * @inheritdoc
  33. */
  34. constructor(props: Props) {
  35. super(props);
  36. this._onSubmit = this._onSubmit.bind(this);
  37. }
  38. /**
  39. * Implements React's {@link Component#render()}.
  40. *
  41. * @inheritdoc
  42. * @returns {ReactElement}
  43. */
  44. render() {
  45. return (
  46. <ConfirmDialog
  47. contentKey = 'dialog.muteParticipantDialog'
  48. onSubmit = { this._onSubmit } />
  49. );
  50. }
  51. _onSubmit: () => boolean;
  52. /**
  53. * Callback for the confirm button.
  54. *
  55. * @private
  56. * @returns {boolean} - True (to note that the modal should be closed).
  57. */
  58. _onSubmit() {
  59. const { dispatch, participant } = this.props;
  60. sendAnalytics(createRemoteMuteConfirmedEvent(participant.id));
  61. dispatch(muteRemoteParticipant(participant.id));
  62. return true;
  63. }
  64. }
  65. export default translate(connect()(MuteRemoteParticipantDialog));