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

ModeratorTab.js 5.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. // @flow
  2. import { Checkbox } from '@atlaskit/checkbox';
  3. import React from 'react';
  4. import { AbstractDialogTab } from '../../../base/dialog';
  5. import type { Props as AbstractDialogTabProps } from '../../../base/dialog';
  6. import { translate } from '../../../base/i18n';
  7. /**
  8. * The type of the React {@code Component} props of {@link MoreTab}.
  9. */
  10. export type Props = {
  11. ...$Exact<AbstractDialogTabProps>,
  12. /**
  13. * If set hides the reactions moderation setting.
  14. */
  15. disableReactionsModeration: boolean,
  16. /**
  17. * Whether or not follow me is currently active (enabled by some other participant).
  18. */
  19. followMeActive: boolean,
  20. /**
  21. * Whether or not the user has selected the Follow Me feature to be enabled.
  22. */
  23. followMeEnabled: boolean,
  24. /**
  25. * Whether or not the user has selected the Start Audio Muted feature to be
  26. * enabled.
  27. */
  28. startAudioMuted: boolean,
  29. /**
  30. * Whether or not the user has selected the Start Video Muted feature to be
  31. * enabled.
  32. */
  33. startVideoMuted: boolean,
  34. /**
  35. * Whether or not the user has selected the Start Reactions Muted feature to be
  36. * enabled.
  37. */
  38. startReactionsMuted: boolean,
  39. /**
  40. * Invoked to obtain translated strings.
  41. */
  42. t: Function
  43. };
  44. /**
  45. * React {@code Component} for modifying language and moderator settings.
  46. *
  47. * @augments Component
  48. */
  49. class ModeratorTab extends AbstractDialogTab<Props> {
  50. /**
  51. * Initializes a new {@code MoreTab} instance.
  52. *
  53. * @param {Object} props - The read-only properties with which the new
  54. * instance is to be initialized.
  55. */
  56. constructor(props: Props) {
  57. super(props);
  58. // Bind event handler so it is only bound once for every instance.
  59. this._onStartAudioMutedChanged = this._onStartAudioMutedChanged.bind(this);
  60. this._onStartVideoMutedChanged = this._onStartVideoMutedChanged.bind(this);
  61. this._onStartReactionsMutedChanged = this._onStartReactionsMutedChanged.bind(this);
  62. this._onFollowMeEnabledChanged = this._onFollowMeEnabledChanged.bind(this);
  63. }
  64. /**
  65. * Implements React's {@link Component#render()}.
  66. *
  67. * @inheritdoc
  68. * @returns {ReactElement}
  69. */
  70. render() {
  71. return <div className = 'moderator-tab box'>{ this._renderModeratorSettings() }</div>;
  72. }
  73. _onStartAudioMutedChanged: (Object) => void;
  74. /**
  75. * Callback invoked to select if conferences should start
  76. * with audio muted.
  77. *
  78. * @param {Object} e - The key event to handle.
  79. *
  80. * @returns {void}
  81. */
  82. _onStartAudioMutedChanged({ target: { checked } }) {
  83. super._onChange({ startAudioMuted: checked });
  84. }
  85. _onStartVideoMutedChanged: (Object) => void;
  86. /**
  87. * Callback invoked to select if conferences should start
  88. * with video disabled.
  89. *
  90. * @param {Object} e - The key event to handle.
  91. *
  92. * @returns {void}
  93. */
  94. _onStartVideoMutedChanged({ target: { checked } }) {
  95. super._onChange({ startVideoMuted: checked });
  96. }
  97. _onStartReactionsMutedChanged: (Object) => void;
  98. /**
  99. * Callback invoked to select if conferences should start
  100. * with reactions muted.
  101. *
  102. * @param {Object} e - The key event to handle.
  103. *
  104. * @returns {void}
  105. */
  106. _onStartReactionsMutedChanged({ target: { checked } }) {
  107. super._onChange({ startReactionsMuted: checked });
  108. }
  109. _onFollowMeEnabledChanged: (Object) => void;
  110. /**
  111. * Callback invoked to select if follow-me mode
  112. * should be activated.
  113. *
  114. * @param {Object} e - The key event to handle.
  115. *
  116. * @returns {void}
  117. */
  118. _onFollowMeEnabledChanged({ target: { checked } }) {
  119. super._onChange({ followMeEnabled: checked });
  120. }
  121. /**
  122. * Returns the React Element for modifying conference-wide settings.
  123. *
  124. * @private
  125. * @returns {ReactElement}
  126. */
  127. _renderModeratorSettings() {
  128. const {
  129. disableReactionsModeration,
  130. followMeActive,
  131. followMeEnabled,
  132. startAudioMuted,
  133. startVideoMuted,
  134. startReactionsMuted,
  135. t
  136. } = this.props;
  137. return (
  138. <div
  139. className = 'settings-sub-pane-element'
  140. key = 'moderator'>
  141. <div className = 'moderator-settings-wrapper'>
  142. <Checkbox
  143. isChecked = { startAudioMuted }
  144. label = { t('settings.startAudioMuted') }
  145. name = 'start-audio-muted'
  146. onChange = { this._onStartAudioMutedChanged } />
  147. <Checkbox
  148. isChecked = { startVideoMuted }
  149. label = { t('settings.startVideoMuted') }
  150. name = 'start-video-muted'
  151. onChange = { this._onStartVideoMutedChanged } />
  152. <Checkbox
  153. isChecked = { followMeEnabled && !followMeActive }
  154. isDisabled = { followMeActive }
  155. label = { t('settings.followMe') }
  156. name = 'follow-me'
  157. onChange = { this._onFollowMeEnabledChanged } />
  158. { !disableReactionsModeration
  159. && <Checkbox
  160. isChecked = { startReactionsMuted }
  161. label = { t('settings.startReactionsMuted') }
  162. name = 'start-reactions-muted'
  163. onChange = { this._onStartReactionsMutedChanged } /> }
  164. </div>
  165. </div>
  166. );
  167. }
  168. }
  169. export default translate(ModeratorTab);