Browse Source

fix(RN): show the CC button only when transcribing is available

j8
paweldomas 6 years ago
parent
commit
ee9f304345

+ 12
- 3
react/features/subtitles/components/AbstractClosedCaptionButton.js View File

74
  * {@code AbstractClosedCaptionButton} component.
74
  * {@code AbstractClosedCaptionButton} component.
75
  *
75
  *
76
  * @param {Object} state - The redux state.
76
  * @param {Object} state - The redux state.
77
+ * @param {Object} ownProps - The properties explicitly passed to the component
78
+ * instance.
77
  * @private
79
  * @private
78
  * @returns {{
80
  * @returns {{
79
- *     __requestingSubtitles: boolean
81
+ *     _requestingSubtitles: boolean,
82
+ *     visible: boolean
80
  * }}
83
  * }}
81
  */
84
  */
82
-export function _abstractMapStateToProps(state: Object) {
85
+export function _abstractMapStateToProps(state: Object, ownProps: Object) {
83
     const { _requestingSubtitles } = state['features/subtitles'];
86
     const { _requestingSubtitles } = state['features/subtitles'];
87
+    const { transcribingEnabled } = state['features/base/config'];
88
+
89
+    // Default 'visible' to 'transcribingEnabled' if not explicitly specified
90
+    // in the component's properties.
91
+    const { visible = transcribingEnabled } = ownProps;
84
 
92
 
85
     return {
93
     return {
86
-        _requestingSubtitles
94
+        _requestingSubtitles,
95
+        visible
87
     };
96
     };
88
 }
97
 }

+ 2
- 14
react/features/toolbox/components/web/Toolbox.js View File

157
      */
157
      */
158
     _sharingVideo: boolean,
158
     _sharingVideo: boolean,
159
 
159
 
160
-    /**
161
-     * Whether or not transcribing is enabled.
162
-     */
163
-    _transcribingEnabled: boolean,
164
-
165
     /**
160
     /**
166
      * Flag showing whether toolbar is visible.
161
      * Flag showing whether toolbar is visible.
167
      */
162
      */
168
     _visible: boolean,
163
     _visible: boolean,
169
 
164
 
170
-
171
     /**
165
     /**
172
      * Set with the buttons which this Toolbox should display.
166
      * Set with the buttons which this Toolbox should display.
173
      */
167
      */
323
             _chatOpen,
317
             _chatOpen,
324
             _hideInviteButton,
318
             _hideInviteButton,
325
             _overflowMenuVisible,
319
             _overflowMenuVisible,
326
-            _transcribingEnabled,
327
             _raisedHand,
320
             _raisedHand,
328
             _visible,
321
             _visible,
329
             _visibleButtons,
322
             _visibleButtons,
367
                             <ChatCounter />
360
                             <ChatCounter />
368
                         </div> }
361
                         </div> }
369
                     {
362
                     {
370
-                        _transcribingEnabled
371
-                        && this._shouldShowButton('closedcaptions')
372
-                        && <ClosedCaptionButton />
363
+                        this._shouldShowButton('closedcaptions')
364
+                            && <ClosedCaptionButton />
373
                     }
365
                     }
374
                 </div>
366
                 </div>
375
                 <div className = 'button-group-center'>
367
                 <div className = 'button-group-center'>
1039
         callStatsID,
1031
         callStatsID,
1040
         iAmRecorder
1032
         iAmRecorder
1041
     } = state['features/base/config'];
1033
     } = state['features/base/config'];
1042
-    const {
1043
-        transcribingEnabled
1044
-    } = state['features/base/config'];
1045
     const sharedVideoStatus = state['features/shared-video'].status;
1034
     const sharedVideoStatus = state['features/shared-video'].status;
1046
     const { current } = state['features/side-panel'];
1035
     const { current } = state['features/side-panel'];
1047
     const {
1036
     const {
1094
         _overflowMenuVisible: overflowMenuVisible,
1083
         _overflowMenuVisible: overflowMenuVisible,
1095
         _raisedHand: localParticipant.raisedHand,
1084
         _raisedHand: localParticipant.raisedHand,
1096
         _screensharing: localVideo && localVideo.videoType === 'desktop',
1085
         _screensharing: localVideo && localVideo.videoType === 'desktop',
1097
-        _transcribingEnabled: transcribingEnabled,
1098
         _sharingVideo: sharedVideoStatus === 'playing'
1086
         _sharingVideo: sharedVideoStatus === 'playing'
1099
             || sharedVideoStatus === 'start'
1087
             || sharedVideoStatus === 'start'
1100
             || sharedVideoStatus === 'pause',
1088
             || sharedVideoStatus === 'pause',

Loading…
Cancel
Save