Refactor stateActions for better overview.
This commit is contained in:
@@ -6,7 +6,7 @@ import {
|
||||
import * as appPropTypes from '../../appPropTypes';
|
||||
import { withStyles } from '@material-ui/core/styles';
|
||||
import { withRoomContext } from '../../../RoomContext';
|
||||
import * as stateActions from '../../../actions/stateActions';
|
||||
import * as roomActions from '../../../actions/roomActions';
|
||||
import PropTypes from 'prop-types';
|
||||
import Dialog from '@material-ui/core/Dialog';
|
||||
import DialogTitle from '@material-ui/core/DialogTitle';
|
||||
@@ -175,8 +175,8 @@ const mapStateToProps = (state) =>
|
||||
};
|
||||
|
||||
const mapDispatchToProps = {
|
||||
handleCloseLockDialog : stateActions.setLockDialogOpen,
|
||||
handleAccessCode : stateActions.setAccessCode
|
||||
handleCloseLockDialog : roomActions.setLockDialogOpen,
|
||||
handleAccessCode : roomActions.setAccessCode
|
||||
};
|
||||
|
||||
export default withRoomContext(connect(
|
||||
|
||||
@@ -3,7 +3,7 @@ import { connect } from 'react-redux';
|
||||
import PropTypes from 'prop-types';
|
||||
import classnames from 'classnames';
|
||||
import { withStyles } from '@material-ui/core/styles';
|
||||
import * as stateActions from '../../actions/stateActions';
|
||||
import * as toolareaActions from '../../actions/toolareaActions';
|
||||
import BuddyImage from '../../images/buddy.svg';
|
||||
|
||||
const styles = () =>
|
||||
@@ -115,8 +115,8 @@ const mapDispatchToProps = (dispatch) =>
|
||||
return {
|
||||
openUsersTab : () =>
|
||||
{
|
||||
dispatch(stateActions.openToolArea());
|
||||
dispatch(stateActions.setToolTab('users'));
|
||||
dispatch(toolareaActions.openToolArea());
|
||||
dispatch(toolareaActions.setToolTab('users'));
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -7,7 +7,7 @@ import * as appPropTypes from '../appPropTypes';
|
||||
import { withRoomContext } from '../../RoomContext';
|
||||
import { withStyles } from '@material-ui/core/styles';
|
||||
import useMediaQuery from '@material-ui/core/useMediaQuery';
|
||||
import * as stateActions from '../../actions/stateActions';
|
||||
import * as roomActions from '../../actions/roomActions';
|
||||
import VideoView from '../VideoContainers/VideoView';
|
||||
import Fab from '@material-ui/core/Fab';
|
||||
import MicIcon from '@material-ui/icons/Mic';
|
||||
@@ -432,12 +432,12 @@ const mapDispatchToProps = (dispatch) =>
|
||||
toggleConsumerFullscreen : (consumer) =>
|
||||
{
|
||||
if (consumer)
|
||||
dispatch(stateActions.toggleConsumerFullscreen(consumer.id));
|
||||
dispatch(roomActions.toggleConsumerFullscreen(consumer.id));
|
||||
},
|
||||
toggleConsumerWindow : (consumer) =>
|
||||
{
|
||||
if (consumer)
|
||||
dispatch(stateActions.toggleConsumerWindow(consumer.id));
|
||||
dispatch(roomActions.toggleConsumerWindow(consumer.id));
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { withStyles } from '@material-ui/core/styles';
|
||||
import { withRoomContext } from '../RoomContext';
|
||||
import * as stateActions from '../actions/stateActions';
|
||||
import * as settingsActions from '../actions/settingsActions';
|
||||
import PropTypes from 'prop-types';
|
||||
import Dialog from '@material-ui/core/Dialog';
|
||||
import DialogContentText from '@material-ui/core/DialogContentText';
|
||||
@@ -329,7 +329,7 @@ const mapDispatchToProps = (dispatch) =>
|
||||
return {
|
||||
changeDisplayName : (displayName) =>
|
||||
{
|
||||
dispatch(stateActions.setDisplayName(displayName));
|
||||
dispatch(settingsActions.setDisplayName(displayName));
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -33,7 +33,7 @@ class MessageList extends React.Component
|
||||
|
||||
shouldComponentUpdate(nextProps)
|
||||
{
|
||||
if (nextProps.chatmessages.length !== this.props.chatmessages.length)
|
||||
if (nextProps.chat.length !== this.props.chat.length)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -55,7 +55,7 @@ class MessageList extends React.Component
|
||||
render()
|
||||
{
|
||||
const {
|
||||
chatmessages,
|
||||
chat,
|
||||
myPicture,
|
||||
classes
|
||||
} = this.props;
|
||||
@@ -63,7 +63,7 @@ class MessageList extends React.Component
|
||||
return (
|
||||
<div className={classes.root} ref={(node) => { this.node = node; }}>
|
||||
{
|
||||
chatmessages.map((message, index) =>
|
||||
chat.map((message, index) =>
|
||||
{
|
||||
const messageTime = new Date(message.time);
|
||||
|
||||
@@ -89,15 +89,15 @@ class MessageList extends React.Component
|
||||
|
||||
MessageList.propTypes =
|
||||
{
|
||||
chatmessages : PropTypes.array,
|
||||
chat : PropTypes.array,
|
||||
myPicture : PropTypes.string,
|
||||
classes : PropTypes.object.isRequired
|
||||
};
|
||||
|
||||
const mapStateToProps = (state) =>
|
||||
({
|
||||
chatmessages : state.chatmessages,
|
||||
myPicture : state.me.picture
|
||||
chat : state.chat,
|
||||
myPicture : state.me.picture
|
||||
});
|
||||
|
||||
export default connect(
|
||||
@@ -108,7 +108,7 @@ export default connect(
|
||||
areStatesEqual : (next, prev) =>
|
||||
{
|
||||
return (
|
||||
prev.chatmessages === next.chatmessages &&
|
||||
prev.chat === next.chat &&
|
||||
prev.me.picture === next.me.picture
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import PropTypes from 'prop-types';
|
||||
import { withStyles } from '@material-ui/core/styles';
|
||||
import * as stateActions from '../../actions/stateActions';
|
||||
import * as toolareaActions from '../../actions/toolareaActions';
|
||||
import AppBar from '@material-ui/core/AppBar';
|
||||
import Tabs from '@material-ui/core/Tabs';
|
||||
import Tab from '@material-ui/core/Tab';
|
||||
@@ -114,7 +114,7 @@ const mapStateToProps = (state) => ({
|
||||
});
|
||||
|
||||
const mapDispatchToProps = {
|
||||
setToolTab : stateActions.setToolTab
|
||||
setToolTab : toolareaActions.setToolTab
|
||||
};
|
||||
|
||||
export default connect(
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Component } from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import PropTypes from 'prop-types';
|
||||
import { withSnackbar } from 'notistack';
|
||||
import * as stateActions from '../../actions/stateActions';
|
||||
import * as notificationActions from '../../actions/notificationActions';
|
||||
|
||||
class Notifications extends Component
|
||||
{
|
||||
@@ -77,7 +77,7 @@ const mapStateToProps = (state) =>
|
||||
const mapDispatchToProps = (dispatch) =>
|
||||
({
|
||||
removeNotification : (notificationId) =>
|
||||
dispatch(stateActions.removeNotification({ notificationId }))
|
||||
dispatch(notificationActions.removeNotification({ notificationId }))
|
||||
});
|
||||
|
||||
export default withSnackbar(
|
||||
|
||||
@@ -7,7 +7,8 @@ import {
|
||||
import * as appPropTypes from './appPropTypes';
|
||||
import { withRoomContext } from '../RoomContext';
|
||||
import { withStyles } from '@material-ui/core/styles';
|
||||
import * as stateActions from '../actions/stateActions';
|
||||
import * as roomActions from '../actions/roomActions';
|
||||
import * as toolareaActions from '../actions/toolareaActions';
|
||||
import { idle } from '../utils';
|
||||
import FullScreen from './FullScreen';
|
||||
import CookieConsent from 'react-cookie-consent';
|
||||
@@ -488,19 +489,19 @@ const mapDispatchToProps = (dispatch) =>
|
||||
({
|
||||
setToolbarsVisible : (visible) =>
|
||||
{
|
||||
dispatch(stateActions.setToolbarsVisible(visible));
|
||||
dispatch(roomActions.setToolbarsVisible(visible));
|
||||
},
|
||||
setSettingsOpen : (settingsOpen) =>
|
||||
{
|
||||
dispatch(stateActions.setSettingsOpen({ settingsOpen }));
|
||||
dispatch(roomActions.setSettingsOpen({ settingsOpen }));
|
||||
},
|
||||
setLockDialogOpen : (lockDialogOpen) =>
|
||||
{
|
||||
dispatch(stateActions.setLockDialogOpen({ lockDialogOpen }));
|
||||
dispatch(roomActions.setLockDialogOpen({ lockDialogOpen }));
|
||||
},
|
||||
toggleToolArea : () =>
|
||||
{
|
||||
dispatch(stateActions.toggleToolArea());
|
||||
dispatch(toolareaActions.toggleToolArea());
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -3,7 +3,8 @@ import { connect } from 'react-redux';
|
||||
import * as appPropTypes from '../appPropTypes';
|
||||
import { withStyles } from '@material-ui/core/styles';
|
||||
import { withRoomContext } from '../../RoomContext';
|
||||
import * as stateActions from '../../actions/stateActions';
|
||||
import * as roomActions from '../../actions/roomActions';
|
||||
import * as settingsActions from '../../actions/settingsActions';
|
||||
import PropTypes from 'prop-types';
|
||||
import Dialog from '@material-ui/core/Dialog';
|
||||
import DialogTitle from '@material-ui/core/DialogTitle';
|
||||
@@ -267,9 +268,9 @@ const mapStateToProps = (state) =>
|
||||
};
|
||||
|
||||
const mapDispatchToProps = {
|
||||
onToggleAdvancedMode : stateActions.toggleAdvancedMode,
|
||||
handleChangeMode : stateActions.setDisplayMode,
|
||||
handleCloseSettings : stateActions.setSettingsOpen,
|
||||
onToggleAdvancedMode : settingsActions.toggleAdvancedMode,
|
||||
handleChangeMode : roomActions.setDisplayMode,
|
||||
handleCloseSettings : roomActions.setSettingsOpen
|
||||
};
|
||||
|
||||
export default withRoomContext(connect(
|
||||
|
||||
@@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
|
||||
import classnames from 'classnames';
|
||||
import { withStyles } from '@material-ui/core/styles';
|
||||
import * as appPropTypes from '../appPropTypes';
|
||||
import * as stateActions from '../../actions/stateActions';
|
||||
import * as roomActions from '../../actions/roomActions';
|
||||
import FullScreenExitIcon from '@material-ui/icons/FullscreenExit';
|
||||
import VideoView from './VideoView';
|
||||
|
||||
@@ -148,7 +148,7 @@ const mapDispatchToProps = (dispatch) =>
|
||||
toggleConsumerFullscreen : (consumer) =>
|
||||
{
|
||||
if (consumer)
|
||||
dispatch(stateActions.toggleConsumerFullscreen(consumer.id));
|
||||
dispatch(roomActions.toggleConsumerFullscreen(consumer.id));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { connect } from 'react-redux';
|
||||
import NewWindow from './NewWindow';
|
||||
import PropTypes from 'prop-types';
|
||||
import * as appPropTypes from '../appPropTypes';
|
||||
import * as stateActions from '../../actions/stateActions';
|
||||
import * as roomActions from '../../actions/roomActions';
|
||||
import FullView from '../VideoContainers/FullView';
|
||||
|
||||
const VideoWindow = (props) =>
|
||||
@@ -59,7 +59,7 @@ const mapDispatchToProps = (dispatch) =>
|
||||
return {
|
||||
toggleConsumerWindow : () =>
|
||||
{
|
||||
dispatch(stateActions.toggleConsumerWindow());
|
||||
dispatch(roomActions.toggleConsumerWindow());
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user