您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

AudioOnlyButton.js 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. // @flow
  2. import { connect } from 'react-redux';
  3. import { toggleAudioOnly } from '../../../../base/conference';
  4. import { translate } from '../../../../base/i18n';
  5. import AbstractButton from '../AbstractButton';
  6. import type { Props as AbstractButtonProps } from '../AbstractButton';
  7. type Props = AbstractButtonProps & {
  8. /**
  9. * Whether the current conference is in audio only mode or not.
  10. */
  11. _audioOnly: boolean,
  12. /**
  13. * The redux {@code dispatch} function.
  14. */
  15. dispatch: Function
  16. }
  17. /**
  18. * An implementation of a button for toggling the audio-only mode.
  19. */
  20. class AudioOnlyButton extends AbstractButton<Props, *> {
  21. accessibilityLabel = 'Audio only mode';
  22. iconName = 'visibility';
  23. label = 'toolbar.audioonly';
  24. toggledIconName = 'visibility-off';
  25. /**
  26. * Handles clicking / pressing the button.
  27. *
  28. * @private
  29. * @returns {void}
  30. */
  31. _handleClick() {
  32. this.props.dispatch(toggleAudioOnly());
  33. }
  34. /**
  35. * Indicates whether this button is disabled or not.
  36. *
  37. * @override
  38. * @private
  39. * @returns {boolean}
  40. */
  41. _isDisabled() {
  42. return false;
  43. }
  44. /**
  45. * Indicates whether this button is in toggled state or not.
  46. *
  47. * @override
  48. * @private
  49. * @returns {boolean}
  50. */
  51. _isToggled() {
  52. return this.props._audioOnly;
  53. }
  54. }
  55. /**
  56. * Maps (parts of) the redux state to the associated props for the
  57. * {@code AudioOnlyButton} component.
  58. *
  59. * @param {Object} state - The Redux state.
  60. * @private
  61. * @returns {{
  62. * _audioOnly: boolean
  63. * }}
  64. */
  65. function _mapStateToProps(state): Object {
  66. const { audioOnly } = state['features/base/conference'];
  67. return {
  68. _audioOnly: Boolean(audioOnly)
  69. };
  70. }
  71. export default translate(connect(_mapStateToProps)(AudioOnlyButton));