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

MuteEveryonesVideoDialog.js 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. import React from 'react';
  2. import Dialog from 'react-native-dialog';
  3. import { Divider } from 'react-native-paper';
  4. import { ConfirmDialog } from '../../../base/dialog';
  5. import { translate } from '../../../base/i18n';
  6. import { connect } from '../../../base/redux';
  7. import AbstractMuteEveryonesVideoDialog, {
  8. abstractMapStateToProps as _mapStateToProps,
  9. type Props } from '../AbstractMuteEveryonesVideoDialog';
  10. import styles from './styles';
  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 AbstractMuteEveryonesVideoDialog
  16. */
  17. class MuteEveryonesVideoDialog extends AbstractMuteEveryonesVideoDialog<Props> {
  18. /**
  19. * Renders the dialog switch.
  20. *
  21. * @returns {React$Component}
  22. */
  23. _renderSwitch() {
  24. return (
  25. this.props.exclude.length === 0
  26. && <Dialog.Switch
  27. label = { this.props.t('dialog.moderationVideoLabel') }
  28. onValueChange = { this._onToggleModeration }
  29. value = { !this.state.moderationEnabled } />
  30. );
  31. }
  32. /**
  33. * Toggles advanced moderation switch.
  34. *
  35. * @returns {void}
  36. */
  37. _onToggleModeration() {
  38. this.setState(state => {
  39. return {
  40. moderationEnabled: !state.moderationEnabled,
  41. content: this.props.t(state.moderationEnabled
  42. ? 'dialog.muteEveryonesVideoDialog' : 'dialog.muteEveryonesVideoDialogModerationOn'
  43. )
  44. };
  45. });
  46. }
  47. /**
  48. * Implements {@code Component#render}.
  49. *
  50. * @inheritdoc
  51. */
  52. render() {
  53. return (
  54. <ConfirmDialog
  55. confirmLabel = 'dialog.muteEveryonesVideoDialogOk'
  56. descriptionKey = { this.state.content }
  57. onSubmit = { this._onSubmit }
  58. title = { this.props.title }>
  59. <Divider style = { styles.dividerDialog } />
  60. { this._renderSwitch() }
  61. </ConfirmDialog>
  62. );
  63. }
  64. }
  65. export default translate(connect(_mapStateToProps)(MuteEveryonesVideoDialog));