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

SoundsTab.js 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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. declare var APP: Object;
  8. /**
  9. * The type of the React {@code Component} props of {@link SoundsTab}.
  10. */
  11. export type Props = {
  12. ...$Exact<AbstractDialogTabProps>,
  13. /**
  14. * Whether or not the reactions feature is enabled.
  15. */
  16. enableReactions: Boolean,
  17. /**
  18. * Whether or not the sound for the incoming message should play.
  19. */
  20. soundsIncomingMessage: Boolean,
  21. /**
  22. * Whether or not the sound for the participant joined should play.
  23. */
  24. soundsParticipantJoined: Boolean,
  25. /**
  26. * Whether or not the sound for the participant left should play.
  27. */
  28. soundsParticipantLeft: Boolean,
  29. /**
  30. * Whether or not the sound for the talk while muted notification should play.
  31. */
  32. soundsTalkWhileMuted: Boolean,
  33. /**
  34. * Whether or not the sound for reactions should play.
  35. */
  36. soundsReactions: Boolean,
  37. /**
  38. * Whether or not moderator muted the sounds.
  39. */
  40. moderatorMutedSoundsReactions: Boolean,
  41. /**
  42. * Invoked to obtain translated strings.
  43. */
  44. t: Function
  45. }
  46. /**
  47. * React {@code Component} for modifying the local user's sound settings.
  48. *
  49. * @augments Component
  50. */
  51. class SoundsTab extends AbstractDialogTab<Props> {
  52. /**
  53. * Initializes a new {@code SoundsTab} instance.
  54. *
  55. * @param {Props} props - The React {@code Component} props to initialize
  56. * the new {@code SoundsTab} instance with.
  57. */
  58. constructor(props: Props) {
  59. super(props);
  60. // Bind event handlers so they are only bound once for every instance.
  61. this._onChange = this._onChange.bind(this);
  62. }
  63. _onChange: (Object) => void;
  64. /**
  65. * Changes a sound setting state.
  66. *
  67. * @param {Object} e - The key event to handle.
  68. *
  69. * @returns {void}
  70. */
  71. _onChange({ target }) {
  72. super._onChange({ [target.name]: target.checked });
  73. }
  74. /**
  75. * Implements React's {@link Component#render()}.
  76. *
  77. * @inheritdoc
  78. * @returns {ReactElement}
  79. */
  80. render() {
  81. const {
  82. soundsIncomingMessage,
  83. soundsParticipantJoined,
  84. soundsParticipantLeft,
  85. soundsTalkWhileMuted,
  86. soundsReactions,
  87. enableReactions,
  88. moderatorMutedSoundsReactions,
  89. t
  90. } = this.props;
  91. return (
  92. <div
  93. className = 'settings-sub-pane-element'
  94. key = 'sounds'>
  95. <h2 className = 'mock-atlaskit-label'>
  96. {t('settings.playSounds')}
  97. </h2>
  98. {enableReactions && <Checkbox
  99. isChecked = { soundsReactions }
  100. isDisabled = { moderatorMutedSoundsReactions }
  101. label = { t('settings.reactions') }
  102. name = 'soundsReactions'
  103. onChange = { this._onChange } />
  104. }
  105. <Checkbox
  106. isChecked = { soundsIncomingMessage }
  107. label = { t('settings.incomingMessage') }
  108. name = 'soundsIncomingMessage'
  109. onChange = { this._onChange } />
  110. <Checkbox
  111. isChecked = { soundsParticipantJoined }
  112. label = { t('settings.participantJoined') }
  113. name = 'soundsParticipantJoined'
  114. onChange = { this._onChange } />
  115. <Checkbox
  116. isChecked = { soundsParticipantLeft }
  117. label = { t('settings.participantLeft') }
  118. name = 'soundsParticipantLeft'
  119. onChange = { this._onChange } />
  120. <Checkbox
  121. isChecked = { soundsTalkWhileMuted }
  122. label = { t('settings.talkWhileMuted') }
  123. name = 'soundsTalkWhileMuted'
  124. onChange = { this._onChange } />
  125. </div>
  126. );
  127. }
  128. }
  129. export default translate(SoundsTab);