Consistent naming of react-redux's mapStateToProps

Until we make a decision on access modifier hints and adopt a respective
coding style, consistency is king.
This commit is contained in:
Lyubomir Marinov 2017-01-28 17:34:57 -06:00
parent 349c04d8d1
commit 2189ab7ee6
11 changed files with 28 additions and 20 deletions

View File

@ -229,11 +229,12 @@ class Conference extends Component {
* Maps (parts of) the Redux state to the associated Conference's props.
*
* @param {Object} state - The Redux state.
* @private
* @returns {{
* _passwordRequired: boolean
* }}
*/
function mapStateToProps(state) {
function _mapStateToProps(state) {
return {
/**
* The indicator which determines whether a password is required to join
@ -255,4 +256,4 @@ function mapStateToProps(state) {
};
}
export default reactReduxConnect(mapStateToProps)(Conference);
export default reactReduxConnect(_mapStateToProps)(Conference);

View File

@ -155,12 +155,13 @@ function _toBoolean(value, undefinedValue) {
* @param {Object} state - The Redux state.
* @param {Object} ownProps - The React Component props passed to the associated
* (instance of) ParticipantView.
* @private
* @returns {{
* _avatar: string,
* _videoTrack: Track
* }}
*/
function mapStateToProps(state, ownProps) {
function _mapStateToProps(state, ownProps) {
const participantId = ownProps.participantId;
const participant
= getParticipantById(
@ -177,4 +178,4 @@ function mapStateToProps(state, ownProps) {
};
}
export default connect(mapStateToProps)(ParticipantView);
export default connect(_mapStateToProps)(ParticipantView);

View File

@ -99,11 +99,12 @@ class FilmStrip extends Component {
* Function that maps parts of Redux state tree into component props.
*
* @param {Object} state - Redux state.
* @private
* @returns {{
* _participants: Participant[],
* }}
*/
function mapStateToProps(state) {
function _mapStateToProps(state) {
return {
/**
* The participants in the conference.
@ -115,4 +116,4 @@ function mapStateToProps(state) {
};
}
export default connect(mapStateToProps)(FilmStrip);
export default connect(_mapStateToProps)(FilmStrip);

View File

@ -133,13 +133,14 @@ class Thumbnail extends Component {
*
* @param {Object} state - Redux state.
* @param {Object} ownProps - Properties of component.
* @private
* @returns {{
* _audioTrack: Track,
* _largeVideo: Object,
* _videoTrack: Track
* }}
*/
function mapStateToProps(state, ownProps) {
function _mapStateToProps(state, ownProps) {
// We need read-only access to the state of features/large-video so that the
// film strip doesn't render the video of the participant who is rendered on
// the stage i.e. as a large video.
@ -158,4 +159,4 @@ function mapStateToProps(state, ownProps) {
};
}
export default connect(mapStateToProps)(Thumbnail);
export default connect(_mapStateToProps)(Thumbnail);

View File

@ -46,14 +46,15 @@ class LargeVideo extends Component {
* Maps (parts of) the Redux state to the associated LargeVideo's props.
*
* @param {Object} state - Redux state.
* @private
* @returns {{
* _participantId: string
* }}
*/
function mapStateToProps(state) {
function _mapStateToProps(state) {
return {
_participantId: state['features/large-video'].participantId
};
}
export default connect(mapStateToProps)(LargeVideo);
export default connect(_mapStateToProps)(LargeVideo);

View File

@ -138,13 +138,14 @@ export class AbstractToolbar extends Component {
* Maps parts of media state to component props.
*
* @param {Object} state - Redux state.
* @protected
* @returns {{
* _audioMuted: boolean,
* _locked: boolean,
* _videoMuted: boolean
* }}
*/
export function mapStateToProps(state) {
export function _mapStateToProps(state) {
const conference = state['features/base/conference'];
const media = state['features/base/media'];

View File

@ -6,7 +6,7 @@ import { MEDIA_TYPE, toggleCameraFacingMode } from '../../base/media';
import { Container } from '../../base/react';
import { ColorPalette } from '../../base/styles';
import { AbstractToolbar, mapStateToProps } from './AbstractToolbar';
import { AbstractToolbar, _mapStateToProps } from './AbstractToolbar';
import { styles } from './styles';
import ToolbarButton from './ToolbarButton';
@ -160,4 +160,4 @@ Object.assign(Toolbar.prototype, {
videoMutedIcon: 'camera-disabled'
});
export default connect(mapStateToProps)(Toolbar);
export default connect(_mapStateToProps)(Toolbar);

View File

@ -124,11 +124,12 @@ class UnsupportedMobileBrowser extends Component {
* props.
*
* @param {Object} state - Redux state.
* @private
* @returns {{
* _room: string
* }}
*/
function mapStateToProps(state) {
function _mapStateToProps(state) {
return {
/**
* The name of the conference room to be joined upon clicking the
@ -141,4 +142,4 @@ function mapStateToProps(state) {
};
}
export default connect(mapStateToProps)(UnsupportedMobileBrowser);
export default connect(_mapStateToProps)(UnsupportedMobileBrowser);

View File

@ -201,12 +201,13 @@ export class AbstractWelcomePage extends Component {
* to be used in child classes for 'connect'.
*
* @param {Object} state - Redux state.
* @protected
* @returns {{
* _localVideoTrack: (Track|undefined),
* _room: string
* }}
*/
export function mapStateToProps(state) {
export function _mapStateToProps(state) {
const conference = state['features/base/conference'];
const tracks = state['features/base/tracks'];

View File

@ -5,7 +5,7 @@ import { connect } from 'react-redux';
import { Link } from '../../base/react';
import { ColorPalette } from '../../base/styles';
import { AbstractWelcomePage, mapStateToProps } from './AbstractWelcomePage';
import { AbstractWelcomePage, _mapStateToProps } from './AbstractWelcomePage';
import { styles } from './styles';
/**
@ -125,4 +125,4 @@ class WelcomePage extends AbstractWelcomePage {
}
}
export default connect(mapStateToProps)(WelcomePage);
export default connect(_mapStateToProps)(WelcomePage);

View File

@ -5,7 +5,7 @@ import { connect } from 'react-redux';
import { Watermarks } from '../../base/react';
import { AbstractWelcomePage, mapStateToProps } from './AbstractWelcomePage';
import { AbstractWelcomePage, _mapStateToProps } from './AbstractWelcomePage';
/* eslint-disable require-jsdoc */
@ -267,4 +267,4 @@ class WelcomePage extends AbstractWelcomePage {
}
}
export default connect(mapStateToProps)(WelcomePage);
export default connect(_mapStateToProps)(WelcomePage);