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

ClosedCaptionButton.native.js 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // @flow
  2. import { getFeatureFlag, CLOSE_CAPTIONS_ENABLED } from '../../base/flags';
  3. import { translate } from '../../base/i18n';
  4. import { IconClosedCaption } from '../../base/icons';
  5. import { connect } from '../../base/redux';
  6. import {
  7. AbstractClosedCaptionButton,
  8. _abstractMapStateToProps
  9. } from './AbstractClosedCaptionButton';
  10. /**
  11. * A button which starts/stops the transcriptions.
  12. */
  13. class ClosedCaptionButton
  14. extends AbstractClosedCaptionButton {
  15. accessibilityLabel = 'toolbar.accessibilityLabel.cc';
  16. icon = IconClosedCaption;
  17. label = 'transcribing.start';
  18. toggledLabel = 'transcribing.stop';
  19. }
  20. /**
  21. * Maps (parts of) the redux state to the associated props for this component.
  22. *
  23. * @param {Object} state - The redux state.
  24. * @param {Object} ownProps - The properties explicitly passed to the component
  25. * instance.
  26. * @private
  27. * @returns {Props}
  28. */
  29. export function mapStateToProps(state: Object, ownProps: Object) {
  30. const { transcribingEnabled } = state['features/base/config'];
  31. const { isGuest = true } = state['features/base/jwt'];
  32. const enabled = getFeatureFlag(state, CLOSE_CAPTIONS_ENABLED, true) && transcribingEnabled && !isGuest;
  33. const { visible = enabled } = ownProps;
  34. return {
  35. ..._abstractMapStateToProps(state, ownProps),
  36. visible
  37. };
  38. }
  39. export default translate(connect(mapStateToProps)(ClosedCaptionButton));