2019-01-05 16:49:21 +00:00
|
|
|
import { Component } from 'react';
|
|
|
|
|
2022-10-10 09:12:02 +00:00
|
|
|
import { MEDIA_TYPE } from '../../base/media/constants';
|
2020-02-24 12:47:37 +00:00
|
|
|
import { muteRemote } from '../actions';
|
2019-01-05 16:49:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The type of the React {@code Component} props of
|
|
|
|
* {@link AbstractMuteRemoteParticipantDialog}.
|
|
|
|
*/
|
2020-02-24 12:47:37 +00:00
|
|
|
export type Props = {
|
2019-01-05 16:49:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The Redux dispatch function.
|
|
|
|
*/
|
2022-10-10 09:12:02 +00:00
|
|
|
dispatch: Function;
|
2019-01-05 16:49:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The ID of the remote participant to be muted.
|
|
|
|
*/
|
2022-10-10 09:12:02 +00:00
|
|
|
participantID: string;
|
2019-01-05 16:49:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function to translate i18n labels.
|
|
|
|
*/
|
2022-10-10 09:12:02 +00:00
|
|
|
t: Function;
|
2019-01-05 16:49:21 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Abstract dialog to confirm a remote participant mute action.
|
|
|
|
*
|
2021-11-04 21:10:43 +00:00
|
|
|
* @augments Component
|
2019-01-05 16:49:21 +00:00
|
|
|
*/
|
2022-10-10 09:12:02 +00:00
|
|
|
export default class AbstractMuteRemoteParticipantDialog<P extends Props = Props, State=void>
|
2021-09-10 11:05:16 +00:00
|
|
|
extends Component<P, State> {
|
2019-01-05 16:49:21 +00:00
|
|
|
/**
|
|
|
|
* Initializes a new {@code AbstractMuteRemoteParticipantDialog} instance.
|
|
|
|
*
|
|
|
|
* @param {Object} props - The read-only properties with which the new
|
|
|
|
* instance is to be initialized.
|
|
|
|
*/
|
2020-02-24 12:47:37 +00:00
|
|
|
constructor(props: P) {
|
2019-01-05 16:49:21 +00:00
|
|
|
super(props);
|
|
|
|
|
|
|
|
// Bind event handlers so they are only bound once per instance.
|
|
|
|
this._onSubmit = this._onSubmit.bind(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handles the submit button action.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {boolean} - True (to note that the modal should be closed).
|
|
|
|
*/
|
|
|
|
_onSubmit() {
|
|
|
|
const { dispatch, participantID } = this.props;
|
|
|
|
|
2021-02-24 21:45:07 +00:00
|
|
|
dispatch(muteRemote(participantID, MEDIA_TYPE.AUDIO));
|
2019-01-05 16:49:21 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|