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 2.1KB

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