Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

feat(toolbox): move visibleButtons to redux

Saúl Ibarra Corretgé9ca7ca951598
diff --git a/react/features/toolbox/components/Toolbox.web.js b/react/features/toolbox/components/Toolbox.web.js
index 130208b56c..def0d67052 100644
--- a/react/features/toolbox/components/Toolbox.web.js
+++ b/react/features/toolbox/components/Toolbox.web.js
@@ -158,6 +158,11 @@ type Props = {
*/
_visible: boolean,
+ /**
+ * Set with the buttons which this Toolbox should display.
+ */
+ _visibleButtons: Set<string>,
+
/**
* Invoked to active other features of the app.
*/
@@ -178,8 +183,6 @@ declare var interfaceConfig: Object;
* @extends Component
*/
class Toolbox extends Component<Props> {
- _visibleButtons: Object;
-
/**
* Initializes a new {@code Toolbox} instance.
*
@@ -189,8 +192,6 @@ class Toolbox extends Component<Props> {
constructor(props: Props) {
super(props);
- this._visibleButtons = new Set(interfaceConfig.TOOLBAR_BUTTONS);
-
// Bind event handlers so they are only bound once per instance.
this._onMouseOut = this._onMouseOut.bind(this);
this._onMouseOver = this._onMouseOver.bind(this);
@@ -315,10 +316,11 @@ class Toolbox extends Component<Props> {
_overflowMenuVisible,
_raisedHand,
_visible,
+ _visibleButtons,
t
} = this.props;
const rootClassNames = `new-toolbox ${_visible ? 'visible' : ''} ${
- this._visibleButtons.size ? '' : 'no-buttons'}`;
+ _visibleButtons.size ? '' : 'no-buttons'}`;
const overflowMenuContent = this._renderOverflowMenuContent();
const overflowHasItems = Boolean(overflowMenuContent.filter(
child => child).length);
@@ -1030,7 +1032,7 @@ class Toolbox extends Component<Props> {
* @returns {boolean} True if the button should be displayed.
*/
_shouldShowButton(buttonName) {
- return this._visibleButtons.has(buttonName);
+ return this.props._visibleButtons.has(buttonName);
}
}
@@ -1093,7 +1095,11 @@ function _mapStateToProps(state) {
_sharingVideo: sharedVideoStatus === 'playing'
|| sharedVideoStatus === 'start'
|| sharedVideoStatus === 'pause',
- _visible: Boolean(timeoutID || visible || alwaysVisible)
+ _visible: Boolean(timeoutID || visible || alwaysVisible),
+
+ // XXX: We are not currently using state here, but in the future, when
+ // interfaceConfig is part of redux we will.
+ _visibleButtons: new Set(interfaceConfig.TOOLBAR_BUTTONS)
};
}