You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

MuteEveryonesVideoDialog.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 AbstractMuteEveryonesVideoDialog, { abstractMapStateToProps, type Props }
  8. from '../AbstractMuteEveryonesVideoDialog';
  9. /**
  10. * A React Component with the contents for a dialog that asks for confirmation
  11. * from the user before disabling all remote participants cameras.
  12. *
  13. * @extends AbstractMuteEveryonesVideoDialog
  14. */
  15. class MuteEveryonesVideoDialog extends AbstractMuteEveryonesVideoDialog<Props> {
  16. /**
  17. * Toggles advanced moderation switch.
  18. *
  19. * @returns {void}
  20. */
  21. _onToggleModeration() {
  22. this.setState(state => {
  23. return {
  24. moderationEnabled: !state.moderationEnabled,
  25. content: this.props.t(state.moderationEnabled
  26. ? 'dialog.muteEveryonesVideoDialog' : 'dialog.muteEveryonesVideoDialogModerationOn'
  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.muteParticipantsVideoButton'
  41. onSubmit = { this._onSubmit }
  42. titleString = { this.props.title }
  43. width = 'small'>
  44. <div className = 'mute-dialog'>
  45. {this.state.content}
  46. {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.moderationVideoLabel')}
  52. </label>
  53. <Switch
  54. id = 'moderation-switch'
  55. onValueChange = { this._onToggleModeration }
  56. value = { !this.state.moderationEnabled } />
  57. </div>
  58. </>
  59. )}
  60. </div>
  61. </Dialog>
  62. );
  63. }
  64. _onSubmit: () => boolean;
  65. }
  66. export default translate(connect(abstractMapStateToProps)(MuteEveryonesVideoDialog));