2020-07-15 10:13:28 +00:00
|
|
|
import { Component } from 'react';
|
2022-10-11 08:24:11 +00:00
|
|
|
import { WithTranslation } from 'react-i18next';
|
2020-07-15 10:13:28 +00:00
|
|
|
|
2022-10-11 08:24:11 +00:00
|
|
|
import { createRemoteVideoMenuButtonEvent } from '../../analytics/AnalyticsEvents';
|
|
|
|
import { sendAnalytics } from '../../analytics/functions';
|
2022-10-20 09:11:27 +00:00
|
|
|
import { IReduxState, IStore } from '../../app/types';
|
2022-10-11 08:24:11 +00:00
|
|
|
import { grantModerator } from '../../base/participants/actions';
|
|
|
|
import { getParticipantById } from '../../base/participants/functions';
|
2020-07-15 10:13:28 +00:00
|
|
|
|
2022-10-20 09:11:27 +00:00
|
|
|
interface IProps extends WithTranslation {
|
2020-07-15 10:13:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The Redux dispatch function.
|
|
|
|
*/
|
2022-10-11 08:24:11 +00:00
|
|
|
dispatch: IStore['dispatch'];
|
2020-07-15 10:13:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The ID of the remote participant to be granted moderator rights.
|
|
|
|
*/
|
2022-10-11 08:24:11 +00:00
|
|
|
participantID: string;
|
2020-07-15 10:13:28 +00:00
|
|
|
|
2021-09-10 11:05:16 +00:00
|
|
|
/**
|
|
|
|
* The name of the remote participant to be granted moderator rights.
|
|
|
|
*/
|
2022-10-11 08:24:11 +00:00
|
|
|
participantName: string;
|
|
|
|
}
|
2020-07-15 10:13:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Abstract dialog to confirm granting moderator to a participant.
|
|
|
|
*/
|
|
|
|
export default class AbstractGrantModeratorDialog
|
2022-10-20 09:11:27 +00:00
|
|
|
extends Component<IProps> {
|
2020-07-15 10:13:28 +00:00
|
|
|
/**
|
|
|
|
* Initializes a new {@code AbstractGrantModeratorDialog} instance.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
2022-10-20 09:11:27 +00:00
|
|
|
constructor(props: IProps) {
|
2020-07-15 10:13:28 +00:00
|
|
|
super(props);
|
|
|
|
|
|
|
|
this._onSubmit = this._onSubmit.bind(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Callback for the confirm button.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {boolean} - True (to note that the modal should be closed).
|
|
|
|
*/
|
|
|
|
_onSubmit() {
|
|
|
|
const { dispatch, participantID } = this.props;
|
|
|
|
|
|
|
|
sendAnalytics(createRemoteVideoMenuButtonEvent(
|
|
|
|
'grant.moderator.button',
|
|
|
|
{
|
|
|
|
'participant_id': participantID
|
|
|
|
}));
|
|
|
|
|
|
|
|
dispatch(grantModerator(participantID));
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
2021-09-10 11:05:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Maps (parts of) the Redux state to the associated {@code AbstractMuteEveryoneDialog}'s props.
|
|
|
|
*
|
2022-10-20 09:11:27 +00:00
|
|
|
* @param {IReduxState} state - The redux state.
|
2021-09-10 11:05:16 +00:00
|
|
|
* @param {Object} ownProps - The properties explicitly passed to the component.
|
2022-10-20 09:11:27 +00:00
|
|
|
* @returns {IProps}
|
2021-09-10 11:05:16 +00:00
|
|
|
*/
|
2022-10-20 09:11:27 +00:00
|
|
|
export function abstractMapStateToProps(state: IReduxState, ownProps: IProps) {
|
2021-09-10 11:05:16 +00:00
|
|
|
|
|
|
|
return {
|
2022-10-11 08:24:11 +00:00
|
|
|
participantName: getParticipantById(state, ownProps.participantID)?.name
|
2021-09-10 11:05:16 +00:00
|
|
|
};
|
|
|
|
}
|