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.

AbstractMuteRemoteParticipantDialog.ts 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import { Component } from 'react';
  2. import { MEDIA_TYPE } from '../../base/media/constants';
  3. // eslint-disable-next-line lines-around-comment
  4. // @ts-ignore
  5. import { muteRemote } from '../actions';
  6. /**
  7. * The type of the React {@code Component} props of
  8. * {@link AbstractMuteRemoteParticipantDialog}.
  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 mute action.
  26. *
  27. * @augments Component
  28. */
  29. export default class AbstractMuteRemoteParticipantDialog<P extends Props = Props, State=void>
  30. extends Component<P, State> {
  31. /**
  32. * Initializes a new {@code AbstractMuteRemoteParticipantDialog} 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. /**
  43. * Handles the submit button action.
  44. *
  45. * @private
  46. * @returns {boolean} - True (to note that the modal should be closed).
  47. */
  48. _onSubmit() {
  49. const { dispatch, participantID } = this.props;
  50. dispatch(muteRemote(participantID, MEDIA_TYPE.AUDIO));
  51. return true;
  52. }
  53. }