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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // @flow
  2. import { Component } from 'react';
  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. * @extends Component
  26. */
  27. export default class AbstractMuteRemoteParticipantDialog<P:Props = Props>
  28. extends Component<P> {
  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. _onSubmit: () => boolean;
  41. /**
  42. * Handles the submit button action.
  43. *
  44. * @private
  45. * @returns {boolean} - True (to note that the modal should be closed).
  46. */
  47. _onSubmit() {
  48. const { dispatch, participantID } = this.props;
  49. dispatch(muteRemote(participantID));
  50. return true;
  51. }
  52. }