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.js 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // @flow
  2. import { Component } from 'react';
  3. import { MEDIA_TYPE } from '../../base/media';
  4. import { muteRemote } from '../actions';
  5. /**
  6. * The type of the React {@code Component} props of
  7. * {@link AbstractMuteRemoteParticipantDialog}.
  8. */
  9. export type Props = {
  10. /**
  11. * The Redux dispatch function.
  12. */
  13. dispatch: Function,
  14. /**
  15. * The ID of the remote participant to be muted.
  16. */
  17. participantID: string,
  18. /**
  19. * Function to translate i18n labels.
  20. */
  21. t: Function
  22. };
  23. /**
  24. * Abstract dialog to confirm a remote participant mute action.
  25. *
  26. * @extends Component
  27. */
  28. export default class AbstractMuteRemoteParticipantDialog<P:Props = Props, State=void>
  29. extends Component<P, State> {
  30. /**
  31. * Initializes a new {@code AbstractMuteRemoteParticipantDialog} instance.
  32. *
  33. * @param {Object} props - The read-only properties with which the new
  34. * instance is to be initialized.
  35. */
  36. constructor(props: P) {
  37. super(props);
  38. // Bind event handlers so they are only bound once per instance.
  39. this._onSubmit = this._onSubmit.bind(this);
  40. }
  41. _onSubmit: () => boolean;
  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. }