Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

ClosedCaptionButton.native.js 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 enabled = getFeatureFlag(state, CLOSE_CAPTIONS_ENABLED, true) && transcribingEnabled;
  32. const { visible = enabled } = ownProps;
  33. return {
  34. ..._abstractMapStateToProps(state, ownProps),
  35. visible
  36. };
  37. }
  38. export default translate(connect(mapStateToProps)(ClosedCaptionButton));