Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

MuteEveryoneDialog.js 2.4KB

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