You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ClosedCaptionButton.native.js 1.2KB

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