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.4KB

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