From 21c1e4abc4fbaed71ff9adeb71148fc49c5fdde2 Mon Sep 17 00:00:00 2001 From: Lyubo Marinov Date: Fri, 18 May 2018 08:19:25 -0500 Subject: [PATCH] Coding style: formatting, comments --- .../components/Conference.native.js | 27 ++++++++++--------- react/features/toolbox/reducer.js | 7 ++--- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/react/features/conference/components/Conference.native.js b/react/features/conference/components/Conference.native.js index 6d516bbe7..095a71d5b 100644 --- a/react/features/conference/components/Conference.native.js +++ b/react/features/conference/components/Conference.native.js @@ -61,7 +61,7 @@ type Props = { _onHardwareBackPress: Function, /** - * Number of participants in the conference. + * The number of participants in the conference. * * @private */ @@ -129,12 +129,10 @@ class Conference extends Component { this._onHardwareBackPress); } - // Show the toolbar if we are the only participant. + // Show the toolbox if we are the only participant. const { _participantCount, _setToolboxVisible } = this.props; - if (_participantCount === 1) { - _setToolboxVisible(true); - } + _participantCount === 1 && _setToolboxVisible(true); } /** @@ -159,14 +157,16 @@ class Conference extends Component { * that this instance will receive. * @returns {void} */ - componentWillReceiveProps(nextProps) { - const oldParticipantCount = this.props._participantCount; - const newParticipantCount = nextProps._participantCount; + componentWillReceiveProps({ _participantCount: newParticipantCount }) { + const { + _participantCount: oldParticipantCount, + _setToolboxVisible + } = this.props; - if (oldParticipantCount === 1 && newParticipantCount > 1) { - this.props._setToolboxVisible(false); - } else if (oldParticipantCount > 1 && newParticipantCount === 1) { - this.props._setToolboxVisible(true); + if (oldParticipantCount === 1) { + newParticipantCount > 1 && _setToolboxVisible(false); + } else if (oldParticipantCount > 1) { + newParticipantCount === 1 && _setToolboxVisible(true); } } @@ -373,6 +373,7 @@ function _mapDispatchToProps(dispatch) { * @private * @returns {{ * _connecting: boolean, + * _participantCount: number, * _reducedUI: boolean, * _toolboxVisible: boolean * }} @@ -408,7 +409,7 @@ function _mapStateToProps(state) { _connecting: Boolean(connecting_), /** - * Number of participants in the conference. + * The number of participants in the conference. * * @private * @type {number} diff --git a/react/features/toolbox/reducer.js b/react/features/toolbox/reducer.js index 88c9f1dc1..ab981fca7 100644 --- a/react/features/toolbox/reducer.js +++ b/react/features/toolbox/reducer.js @@ -1,6 +1,6 @@ // @flow -import { ReducerRegistry } from '../base/redux'; +import { ReducerRegistry, set } from '../base/redux'; import { CLEAR_TOOLBOX_TIMEOUT, @@ -149,10 +149,7 @@ ReducerRegistry.register( }; case SET_TOOLBOX_VISIBLE: - return { - ...state, - visible: action.visible - }; + return set(state, 'visible', action.visible); } return state;