Browse Source

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 years ago
parent
commit
9ca7ca9515
1 changed files with 13 additions and 7 deletions
  1. 13
    7
      react/features/toolbox/components/Toolbox.web.js

+ 13
- 7
react/features/toolbox/components/Toolbox.web.js View File

158
      */
158
      */
159
     _visible: boolean,
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
      * Invoked to active other features of the app.
167
      * Invoked to active other features of the app.
163
      */
168
      */
178
  * @extends Component
183
  * @extends Component
179
  */
184
  */
180
 class Toolbox extends Component<Props> {
185
 class Toolbox extends Component<Props> {
181
-    _visibleButtons: Object;
182
-
183
     /**
186
     /**
184
      * Initializes a new {@code Toolbox} instance.
187
      * Initializes a new {@code Toolbox} instance.
185
      *
188
      *
189
     constructor(props: Props) {
192
     constructor(props: Props) {
190
         super(props);
193
         super(props);
191
 
194
 
192
-        this._visibleButtons = new Set(interfaceConfig.TOOLBAR_BUTTONS);
193
-
194
         // Bind event handlers so they are only bound once per instance.
195
         // Bind event handlers so they are only bound once per instance.
195
         this._onMouseOut = this._onMouseOut.bind(this);
196
         this._onMouseOut = this._onMouseOut.bind(this);
196
         this._onMouseOver = this._onMouseOver.bind(this);
197
         this._onMouseOver = this._onMouseOver.bind(this);
315
             _overflowMenuVisible,
316
             _overflowMenuVisible,
316
             _raisedHand,
317
             _raisedHand,
317
             _visible,
318
             _visible,
319
+            _visibleButtons,
318
             t
320
             t
319
         } = this.props;
321
         } = this.props;
320
         const rootClassNames = `new-toolbox ${_visible ? 'visible' : ''} ${
322
         const rootClassNames = `new-toolbox ${_visible ? 'visible' : ''} ${
321
-            this._visibleButtons.size ? '' : 'no-buttons'}`;
323
+            _visibleButtons.size ? '' : 'no-buttons'}`;
322
         const overflowMenuContent = this._renderOverflowMenuContent();
324
         const overflowMenuContent = this._renderOverflowMenuContent();
323
         const overflowHasItems = Boolean(overflowMenuContent.filter(
325
         const overflowHasItems = Boolean(overflowMenuContent.filter(
324
             child => child).length);
326
             child => child).length);
1030
      * @returns {boolean} True if the button should be displayed.
1032
      * @returns {boolean} True if the button should be displayed.
1031
      */
1033
      */
1032
     _shouldShowButton(buttonName) {
1034
     _shouldShowButton(buttonName) {
1033
-        return this._visibleButtons.has(buttonName);
1035
+        return this.props._visibleButtons.has(buttonName);
1034
     }
1036
     }
1035
 }
1037
 }
1036
 
1038
 
1093
         _sharingVideo: sharedVideoStatus === 'playing'
1095
         _sharingVideo: sharedVideoStatus === 'playing'
1094
             || sharedVideoStatus === 'start'
1096
             || sharedVideoStatus === 'start'
1095
             || sharedVideoStatus === 'pause',
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
 

Loading…
Cancel
Save