2022-08-03 11:24:44 +00:00
|
|
|
/* eslint-disable lines-around-comment */
|
2020-02-24 12:47:37 +00:00
|
|
|
import React from 'react';
|
|
|
|
|
2022-08-03 11:24:44 +00:00
|
|
|
// @ts-ignore
|
2020-02-24 12:47:37 +00:00
|
|
|
import { Dialog } from '../../../base/dialog';
|
2022-08-03 11:24:44 +00:00
|
|
|
import { translate } from '../../../base/i18n/functions';
|
|
|
|
import { connect } from '../../../base/redux/functions';
|
|
|
|
import Switch from '../../../base/ui/components/web/Switch';
|
2021-09-10 11:05:16 +00:00
|
|
|
import AbstractMuteEveryoneDialog, { abstractMapStateToProps, type Props }
|
2022-08-03 11:24:44 +00:00
|
|
|
// @ts-ignore
|
2021-09-10 11:05:16 +00:00
|
|
|
from '../AbstractMuteEveryoneDialog';
|
2020-02-24 12:47:37 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A React Component with the contents for a dialog that asks for confirmation
|
2020-11-10 14:49:38 +00:00
|
|
|
* from the user before muting all remote participants.
|
2020-02-24 12:47:37 +00:00
|
|
|
*
|
2021-11-04 21:10:43 +00:00
|
|
|
* @augments AbstractMuteEveryoneDialog
|
2020-02-24 12:47:37 +00:00
|
|
|
*/
|
2020-11-10 14:49:38 +00:00
|
|
|
class MuteEveryoneDialog extends AbstractMuteEveryoneDialog<Props> {
|
2021-09-10 11:05:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Toggles advanced moderation switch.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onToggleModeration() {
|
2022-08-03 11:24:44 +00:00
|
|
|
// @ts-ignore
|
2021-09-10 11:05:16 +00:00
|
|
|
this.setState(state => {
|
|
|
|
return {
|
|
|
|
audioModerationEnabled: !state.audioModerationEnabled,
|
2022-08-03 11:24:44 +00:00
|
|
|
// @ts-ignore
|
2021-09-10 11:05:16 +00:00
|
|
|
content: this.props.t(state.audioModerationEnabled
|
|
|
|
? 'dialog.muteEveryoneDialog' : 'dialog.muteEveryoneDialogModerationOn'
|
|
|
|
)
|
|
|
|
};
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-02-24 12:47:37 +00:00
|
|
|
/**
|
|
|
|
* Implements React's {@link Component#render()}.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
* @returns {ReactElement}
|
|
|
|
*/
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<Dialog
|
|
|
|
okKey = 'dialog.muteParticipantButton'
|
|
|
|
onSubmit = { this._onSubmit }
|
2022-08-03 11:24:44 +00:00
|
|
|
// @ts-ignore
|
2020-11-10 14:49:38 +00:00
|
|
|
titleString = { this.props.title }
|
2020-02-24 12:47:37 +00:00
|
|
|
width = 'small'>
|
2021-09-10 11:05:16 +00:00
|
|
|
<div className = 'mute-dialog'>
|
2022-08-03 11:24:44 +00:00
|
|
|
{/* @ts-ignore */}
|
2021-09-10 11:05:16 +00:00
|
|
|
{ this.state.content }
|
2022-08-03 11:24:44 +00:00
|
|
|
{/* @ts-ignore */}
|
2021-10-01 13:47:13 +00:00
|
|
|
{ this.props.isModerationSupported && this.props.exclude.length === 0 && (
|
2021-09-10 11:05:16 +00:00
|
|
|
<>
|
|
|
|
<div className = 'separator-line' />
|
|
|
|
<div className = 'control-row'>
|
|
|
|
<label htmlFor = 'moderation-switch'>
|
2022-08-03 11:24:44 +00:00
|
|
|
{/* @ts-ignore */}
|
2021-09-10 11:05:16 +00:00
|
|
|
{this.props.t('dialog.moderationAudioLabel')}
|
|
|
|
</label>
|
|
|
|
<Switch
|
2022-08-03 11:24:44 +00:00
|
|
|
// @ts-ignore
|
|
|
|
checked = { !this.state.audioModerationEnabled }
|
2021-09-10 11:05:16 +00:00
|
|
|
id = 'moderation-switch'
|
2022-08-03 11:24:44 +00:00
|
|
|
onChange = { this._onToggleModeration } />
|
2021-09-10 11:05:16 +00:00
|
|
|
</div>
|
|
|
|
</>
|
|
|
|
)}
|
2020-02-24 12:47:37 +00:00
|
|
|
</div>
|
|
|
|
</Dialog>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
_onSubmit: () => boolean;
|
|
|
|
}
|
|
|
|
|
2022-08-03 11:24:44 +00:00
|
|
|
// @ts-ignore
|
2020-11-10 14:49:38 +00:00
|
|
|
export default translate(connect(abstractMapStateToProps)(MuteEveryoneDialog));
|