|
|
@@ -1,5 +1,6 @@
|
|
1
|
1
|
// @flow
|
|
2
|
2
|
|
|
|
3
|
+import { getFeatureFlag, CLOSE_CAPTIONS_ENABLED } from '../../base/flags';
|
|
3
|
4
|
import { translate } from '../../base/i18n';
|
|
4
|
5
|
import { IconClosedCaption } from '../../base/icons';
|
|
5
|
6
|
import { connect } from '../../base/redux';
|
|
|
@@ -20,5 +21,24 @@ class ClosedCaptionButton
|
|
20
|
21
|
toggledLabel = 'transcribing.stop';
|
|
21
|
22
|
}
|
|
22
|
23
|
|
|
23
|
|
-export default translate(connect(_abstractMapStateToProps)(
|
|
24
|
|
- ClosedCaptionButton));
|
|
|
24
|
+/**
|
|
|
25
|
+ * Maps (parts of) the redux state to the associated props for this component.
|
|
|
26
|
+ *
|
|
|
27
|
+ * @param {Object} state - The redux state.
|
|
|
28
|
+ * @param {Object} ownProps - The properties explicitly passed to the component
|
|
|
29
|
+ * instance.
|
|
|
30
|
+ * @private
|
|
|
31
|
+ * @returns {Props}
|
|
|
32
|
+ */
|
|
|
33
|
+export function mapStateToProps(state: Object, ownProps: Object) {
|
|
|
34
|
+ const { transcribingEnabled } = state['features/base/config'];
|
|
|
35
|
+ const enabled = getFeatureFlag(state, CLOSE_CAPTIONS_ENABLED, true) && transcribingEnabled;
|
|
|
36
|
+ const { visible = enabled } = ownProps;
|
|
|
37
|
+
|
|
|
38
|
+ return {
|
|
|
39
|
+ ..._abstractMapStateToProps(state, ownProps),
|
|
|
40
|
+ visible
|
|
|
41
|
+ };
|
|
|
42
|
+}
|
|
|
43
|
+
|
|
|
44
|
+export default translate(connect(mapStateToProps)(ClosedCaptionButton));
|