2018-08-24 18:12:12 +00:00
|
|
|
// @flow
|
|
|
|
|
2020-04-01 11:08:02 +00:00
|
|
|
import { getFeatureFlag, CLOSE_CAPTIONS_ENABLED } from '../../base/flags';
|
2018-08-24 18:12:12 +00:00
|
|
|
import { translate } from '../../base/i18n';
|
2019-08-30 16:39:06 +00:00
|
|
|
import { IconClosedCaption } from '../../base/icons';
|
2019-03-21 16:38:29 +00:00
|
|
|
import { connect } from '../../base/redux';
|
2018-08-24 18:12:12 +00:00
|
|
|
|
|
|
|
import {
|
|
|
|
AbstractClosedCaptionButton,
|
|
|
|
_abstractMapStateToProps
|
|
|
|
} from './AbstractClosedCaptionButton';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A button which starts/stops the transcriptions.
|
|
|
|
*/
|
|
|
|
class ClosedCaptionButton
|
|
|
|
extends AbstractClosedCaptionButton {
|
|
|
|
accessibilityLabel = 'toolbar.accessibilityLabel.cc';
|
2019-08-30 16:39:06 +00:00
|
|
|
icon = IconClosedCaption;
|
2018-08-24 18:12:12 +00:00
|
|
|
label = 'transcribing.start';
|
|
|
|
toggledLabel = 'transcribing.stop';
|
|
|
|
}
|
|
|
|
|
2020-04-01 11:08:02 +00:00
|
|
|
/**
|
|
|
|
* Maps (parts of) the redux state to the associated props for this component.
|
|
|
|
*
|
|
|
|
* @param {Object} state - The redux state.
|
|
|
|
* @param {Object} ownProps - The properties explicitly passed to the component
|
|
|
|
* instance.
|
|
|
|
* @private
|
|
|
|
* @returns {Props}
|
|
|
|
*/
|
|
|
|
export function mapStateToProps(state: Object, ownProps: Object) {
|
|
|
|
const { transcribingEnabled } = state['features/base/config'];
|
|
|
|
const enabled = getFeatureFlag(state, CLOSE_CAPTIONS_ENABLED, true) && transcribingEnabled;
|
|
|
|
const { visible = enabled } = ownProps;
|
|
|
|
|
|
|
|
return {
|
|
|
|
..._abstractMapStateToProps(state, ownProps),
|
|
|
|
visible
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export default translate(connect(mapStateToProps)(ClosedCaptionButton));
|