jiti-meet/react/features/subtitles/components/ClosedCaptionButton.native.js

44 lines
1.2 KiB
JavaScript
Raw Normal View History

// @flow
import { CLOSE_CAPTIONS_ENABLED, getFeatureFlag } from '../../base/flags';
import { translate } from '../../base/i18n';
import { IconSubtitles } from '../../base/icons';
2019-03-21 16:38:29 +00:00
import { connect } from '../../base/redux';
import {
AbstractClosedCaptionButton,
_abstractMapStateToProps
} from './AbstractClosedCaptionButton';
/**
* A button which starts/stops the transcriptions.
*/
class ClosedCaptionButton
extends AbstractClosedCaptionButton {
accessibilityLabel = 'toolbar.accessibilityLabel.cc';
icon = IconSubtitles;
label = 'transcribing.start';
toggledLabel = 'transcribing.stop';
}
/**
* 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 enabled = getFeatureFlag(state, CLOSE_CAPTIONS_ENABLED, true);
const abstractProps = _abstractMapStateToProps(state, ownProps);
return {
...abstractProps,
visible: abstractProps.visible && enabled
};
}
export default translate(connect(mapStateToProps)(ClosedCaptionButton));