ソースを参照

feat(toolbox): move visibleButtons to redux

Technically we still depend on interfaceConfig, but this paves the way for when
that is no longer the case.
master
Saúl Ibarra Corretgé 7年前
コミット
9ca7ca9515
1個のファイルの変更13行の追加7行の削除
  1. 13
    7
      react/features/toolbox/components/Toolbox.web.js

+ 13
- 7
react/features/toolbox/components/Toolbox.web.js ファイルの表示

@@ -158,6 +158,11 @@ type Props = {
158 158
      */
159 159
     _visible: boolean,
160 160
 
161
+    /**
162
+     * Set with the buttons which this Toolbox should display.
163
+     */
164
+    _visibleButtons: Set<string>,
165
+
161 166
     /**
162 167
      * Invoked to active other features of the app.
163 168
      */
@@ -178,8 +183,6 @@ declare var interfaceConfig: Object;
178 183
  * @extends Component
179 184
  */
180 185
 class Toolbox extends Component<Props> {
181
-    _visibleButtons: Object;
182
-
183 186
     /**
184 187
      * Initializes a new {@code Toolbox} instance.
185 188
      *
@@ -189,8 +192,6 @@ class Toolbox extends Component<Props> {
189 192
     constructor(props: Props) {
190 193
         super(props);
191 194
 
192
-        this._visibleButtons = new Set(interfaceConfig.TOOLBAR_BUTTONS);
193
-
194 195
         // Bind event handlers so they are only bound once per instance.
195 196
         this._onMouseOut = this._onMouseOut.bind(this);
196 197
         this._onMouseOver = this._onMouseOver.bind(this);
@@ -315,10 +316,11 @@ class Toolbox extends Component<Props> {
315 316
             _overflowMenuVisible,
316 317
             _raisedHand,
317 318
             _visible,
319
+            _visibleButtons,
318 320
             t
319 321
         } = this.props;
320 322
         const rootClassNames = `new-toolbox ${_visible ? 'visible' : ''} ${
321
-            this._visibleButtons.size ? '' : 'no-buttons'}`;
323
+            _visibleButtons.size ? '' : 'no-buttons'}`;
322 324
         const overflowMenuContent = this._renderOverflowMenuContent();
323 325
         const overflowHasItems = Boolean(overflowMenuContent.filter(
324 326
             child => child).length);
@@ -1030,7 +1032,7 @@ class Toolbox extends Component<Props> {
1030 1032
      * @returns {boolean} True if the button should be displayed.
1031 1033
      */
1032 1034
     _shouldShowButton(buttonName) {
1033
-        return this._visibleButtons.has(buttonName);
1035
+        return this.props._visibleButtons.has(buttonName);
1034 1036
     }
1035 1037
 }
1036 1038
 
@@ -1093,7 +1095,11 @@ function _mapStateToProps(state) {
1093 1095
         _sharingVideo: sharedVideoStatus === 'playing'
1094 1096
             || sharedVideoStatus === 'start'
1095 1097
             || sharedVideoStatus === 'pause',
1096
-        _visible: Boolean(timeoutID || visible || alwaysVisible)
1098
+        _visible: Boolean(timeoutID || visible || alwaysVisible),
1099
+
1100
+        // XXX: We are not currently using state here, but in the future, when
1101
+        // interfaceConfig is part of redux we will.
1102
+        _visibleButtons: new Set(interfaceConfig.TOOLBAR_BUTTONS)
1097 1103
     };
1098 1104
 }
1099 1105
 

読み込み中…
キャンセル
保存