選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

MuteEveryonesVideoDialog.js 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. // @flow
  2. import React from 'react';
  3. import { Switch, Text, View } from 'react-native';
  4. import { Divider } from 'react-native-paper';
  5. import { ColorSchemeRegistry } from '../../../base/color-scheme';
  6. import { ConfirmDialog } from '../../../base/dialog';
  7. import { translate } from '../../../base/i18n';
  8. import { connect } from '../../../base/redux';
  9. import { StyleType } from '../../../base/styles';
  10. import AbstractMuteEveryonesVideoDialog, {
  11. abstractMapStateToProps,
  12. type Props as AbstractProps } from '../AbstractMuteEveryonesVideoDialog';
  13. import styles from './styles';
  14. type Props = AbstractProps & {
  15. /**
  16. * The color-schemed stylesheet of the base/dialog feature.
  17. */
  18. _dialogStyles: StyleType
  19. }
  20. /**
  21. * A React Component with the contents for a dialog that asks for confirmation
  22. * from the user before muting all remote participants.
  23. *
  24. * @extends AbstractMuteEveryonesVideoDialog
  25. */
  26. class MuteEveryonesVideoDialog extends AbstractMuteEveryonesVideoDialog<Props> {
  27. /**
  28. * Toggles advanced moderation switch.
  29. *
  30. * @returns {void}
  31. */
  32. _onToggleModeration() {
  33. this.setState(state => {
  34. return {
  35. moderationEnabled: !state.moderationEnabled,
  36. content: this.props.t(state.moderationEnabled
  37. ? 'dialog.muteEveryonesVideoDialog' : 'dialog.muteEveryonesVideoDialogModerationOn'
  38. )
  39. };
  40. });
  41. }
  42. /**
  43. * Implements {@code Component#render}.
  44. *
  45. * @inheritdoc
  46. */
  47. render() {
  48. return (
  49. <ConfirmDialog
  50. okKey = 'dialog.muteEveryonesVideoDialogOk'
  51. onSubmit = { this._onSubmit } >
  52. <Text style = { this.props._dialogStyles.text }>
  53. { `${this.props.title} \n\n ${this.state.content}` }
  54. </Text>
  55. {this.props.exclude.length === 0 && <>
  56. <Divider style = { styles.dividerWithSpacing } />
  57. <View style = { styles.toggleContainer }>
  58. <Text
  59. style = {{ ...this.props._dialogStyles.text,
  60. ...styles.toggleLabel }}>
  61. {this.props.t('dialog.moderationVideoLabel')}
  62. </Text>
  63. <Switch
  64. onValueChange = { this._onToggleModeration }
  65. value = { !this.state.moderationEnabled } />
  66. </View>
  67. </>}
  68. </ConfirmDialog>
  69. );
  70. }
  71. _onSubmit: () => boolean;
  72. }
  73. /**
  74. * Maps part of the Redux state to the props of this component.
  75. *
  76. * @param {Object} state - The Redux state.
  77. * @param {Props} ownProps - The own props of the component.
  78. * @returns {{
  79. * _dialogStyles: StyleType
  80. * }}
  81. */
  82. function _mapStateToProps(state: Object, ownProps: Props) {
  83. return {
  84. ...abstractMapStateToProps(state, ownProps),
  85. _dialogStyles: ColorSchemeRegistry.get(state, 'Dialog')
  86. };
  87. }
  88. export default translate(connect(_mapStateToProps)(MuteEveryonesVideoDialog));