Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

MuteEveryoneDialog.tsx 2.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /* eslint-disable lines-around-comment */
  2. import React from 'react';
  3. // @ts-ignore
  4. import { Dialog } from '../../../base/dialog';
  5. import { translate } from '../../../base/i18n/functions';
  6. import { connect } from '../../../base/redux/functions';
  7. import Switch from '../../../base/ui/components/web/Switch';
  8. import AbstractMuteEveryoneDialog, { abstractMapStateToProps, type Props }
  9. // @ts-ignore
  10. from '../AbstractMuteEveryoneDialog';
  11. /**
  12. * A React Component with the contents for a dialog that asks for confirmation
  13. * from the user before muting all remote participants.
  14. *
  15. * @augments AbstractMuteEveryoneDialog
  16. */
  17. class MuteEveryoneDialog extends AbstractMuteEveryoneDialog<Props> {
  18. /**
  19. * Toggles advanced moderation switch.
  20. *
  21. * @returns {void}
  22. */
  23. _onToggleModeration() {
  24. // @ts-ignore
  25. this.setState(state => {
  26. return {
  27. audioModerationEnabled: !state.audioModerationEnabled,
  28. // @ts-ignore
  29. content: this.props.t(state.audioModerationEnabled
  30. ? 'dialog.muteEveryoneDialog' : 'dialog.muteEveryoneDialogModerationOn'
  31. )
  32. };
  33. });
  34. }
  35. /**
  36. * Implements React's {@link Component#render()}.
  37. *
  38. * @inheritdoc
  39. * @returns {ReactElement}
  40. */
  41. render() {
  42. return (
  43. <Dialog
  44. okKey = 'dialog.muteParticipantButton'
  45. onSubmit = { this._onSubmit }
  46. // @ts-ignore
  47. titleString = { this.props.title }
  48. width = 'small'>
  49. <div className = 'mute-dialog'>
  50. {/* @ts-ignore */}
  51. { this.state.content }
  52. {/* @ts-ignore */}
  53. { this.props.isModerationSupported && this.props.exclude.length === 0 && (
  54. <>
  55. <div className = 'separator-line' />
  56. <div className = 'control-row'>
  57. <label htmlFor = 'moderation-switch'>
  58. {/* @ts-ignore */}
  59. {this.props.t('dialog.moderationAudioLabel')}
  60. </label>
  61. <Switch
  62. // @ts-ignore
  63. checked = { !this.state.audioModerationEnabled }
  64. id = 'moderation-switch'
  65. onChange = { this._onToggleModeration } />
  66. </div>
  67. </>
  68. )}
  69. </div>
  70. </Dialog>
  71. );
  72. }
  73. _onSubmit: () => boolean;
  74. }
  75. // @ts-ignore
  76. export default translate(connect(abstractMapStateToProps)(MuteEveryoneDialog));