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.

AbstractMuteRemoteParticipantsVideoDialog.js 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // @flow
  2. import { Component } from 'react';
  3. import { rejectParticipantVideo } from '../../av-moderation/actions';
  4. import { MEDIA_TYPE } from '../../base/media';
  5. import { muteRemote } from '../actions';
  6. /**
  7. * The type of the React {@code Component} props of
  8. * {@link AbstractMuteRemoteParticipantsVideoDialog}.
  9. */
  10. export type Props = {
  11. /**
  12. * The Redux dispatch function.
  13. */
  14. dispatch: Function,
  15. /**
  16. * The ID of the remote participant to be muted.
  17. */
  18. participantID: string,
  19. /**
  20. * Function to translate i18n labels.
  21. */
  22. t: Function
  23. };
  24. /**
  25. * Abstract dialog to confirm a remote participant video ute action.
  26. *
  27. * @extends Component
  28. */
  29. export default class AbstractMuteRemoteParticipantsVideoDialog<P:Props = Props, State=void>
  30. extends Component<P, State> {
  31. /**
  32. * Initializes a new {@code AbstractMuteRemoteParticipantsVideoDialog} instance.
  33. *
  34. * @param {Object} props - The read-only properties with which the new
  35. * instance is to be initialized.
  36. */
  37. constructor(props: P) {
  38. super(props);
  39. // Bind event handlers so they are only bound once per instance.
  40. this._onSubmit = this._onSubmit.bind(this);
  41. }
  42. _onSubmit: () => boolean;
  43. /**
  44. * Handles the submit button action.
  45. *
  46. * @private
  47. * @returns {boolean} - True (to note that the modal should be closed).
  48. */
  49. _onSubmit() {
  50. const { dispatch, participantID } = this.props;
  51. dispatch(muteRemote(participantID, MEDIA_TYPE.VIDEO));
  52. dispatch(rejectParticipantVideo(participantID));
  53. return true;
  54. }
  55. }