// @flow import { Component } from 'react'; import { createRemoteMuteConfirmedEvent, sendAnalytics } from '../../analytics'; import { muteRemoteParticipant } from '../../base/participants'; /** * The type of the React {@code Component} props of * {@link AbstractMuteRemoteParticipantDialog}. */ type Props = { /** * The Redux dispatch function. */ dispatch: Function, /** * The ID of the remote participant to be muted. */ participantID: string, /** * Function to translate i18n labels. */ t: Function }; /** * Abstract dialog to confirm a remote participant mute action. * * @extends Component */ export default class AbstractMuteRemoteParticipantDialog extends Component { /** * Initializes a new {@code AbstractMuteRemoteParticipantDialog} instance. * * @param {Object} props - The read-only properties with which the new * instance is to be initialized. */ constructor(props: Props) { super(props); // Bind event handlers so they are only bound once per instance. this._onSubmit = this._onSubmit.bind(this); } _onSubmit: () => boolean; /** * Handles the submit button action. * * @private * @returns {boolean} - True (to note that the modal should be closed). */ _onSubmit() { const { dispatch, participantID } = this.props; sendAnalytics(createRemoteMuteConfirmedEvent(participantID)); dispatch(muteRemoteParticipant(participantID)); return true; } }