diff options
Diffstat (limited to 'src/client/react')
-rw-r--r-- | src/client/react/components/container/Menu.js | 6 | ||||
-rw-r--r-- | src/client/react/components/container/Results.js | 10 | ||||
-rw-r--r-- | src/client/react/components/container/RoomFinder.js | 6 | ||||
-rw-r--r-- | src/client/react/components/container/Search.js | 10 | ||||
-rw-r--r-- | src/client/react/components/container/WeekSelector.js | 7 |
5 files changed, 25 insertions, 14 deletions
diff --git a/src/client/react/components/container/Menu.js b/src/client/react/components/container/Menu.js index 7e5abd0..5a18a8d 100644 --- a/src/client/react/components/container/Menu.js +++ b/src/client/react/components/container/Menu.js @@ -24,12 +24,12 @@ import { makeSetUser, userFromMatch } from '../../lib/url'; import Menu from '../presentational/Menu'; -const mapStateToProps = (state, { match, location, history }) => ({ +const mapStateToProps = (state, { match }) => ({ user: userFromMatch(match), - setUser: makeSetUser(location, history), }); -const mapDispatchToProps = dispatch => ({ +const mapDispatchToProps = (dispatch, { location, history }) => ({ + setUser: makeSetUser(location, history), showRoomFinder: () => dispatch({ type: 'ROOM_FINDER/SHOW' }), }); diff --git a/src/client/react/components/container/Results.js b/src/client/react/components/container/Results.js index c52e43e..773e469 100644 --- a/src/client/react/components/container/Results.js +++ b/src/client/react/components/container/Results.js @@ -94,12 +94,16 @@ class Results extends React.Component { } } -const mapStateToProps = (state, { match, location, history }) => ({ +const mapStateToProps = (state, { match }) => ({ user: userFromMatch(match), - setUser: makeSetUser(location, history), results: state.search.results, searchText: state.search.text, selectedResult: state.search.result, }); -export default withRouter(connect(mapStateToProps)(Results)); +const mapDispatchToProps = (dispatch, { location, history }) => ({ + setUser: makeSetUser(location, history), + dispatch, +}); + +export default withRouter(connect(mapStateToProps, mapDispatchToProps)(Results)); diff --git a/src/client/react/components/container/RoomFinder.js b/src/client/react/components/container/RoomFinder.js index f6e7ac6..c8c506b 100644 --- a/src/client/react/components/container/RoomFinder.js +++ b/src/client/react/components/container/RoomFinder.js @@ -100,13 +100,13 @@ class RoomFinder extends React.Component { } } -const mapStateToProps = (state, { match, location, history }) => ({ +const mapStateToProps = (state, { match }) => ({ user: userFromMatch(match), - setUser: makeSetUser(location, history), isVisible: state.isRoomFinderVisible, }); -const mapDispatchToProps = dispatch => ({ +const mapDispatchToProps = (dispatch, { location, history }) => ({ + setUser: makeSetUser(location, history), onHide: () => dispatch({ type: 'ROOM_FINDER/HIDE' }), }); diff --git a/src/client/react/components/container/Search.js b/src/client/react/components/container/Search.js index 65b2933..fc741c6 100644 --- a/src/client/react/components/container/Search.js +++ b/src/client/react/components/container/Search.js @@ -183,11 +183,15 @@ class Search extends React.Component { } } -const mapStateToProps = (state, { location, history }) => ({ - setUser: makeSetUser(location, history), +const mapStateToProps = state => ({ results: state.search.results, searchText: state.search.text, selectedResult: state.search.selected, }); -export default withRouter(connect(mapStateToProps)(Search)); +const mapDispatchToProps = (dispatch, { location, history }) => ({ + setUser: makeSetUser(location, history), + dispatch, +}); + +export default withRouter(connect(mapStateToProps, mapDispatchToProps)(Search)); diff --git a/src/client/react/components/container/WeekSelector.js b/src/client/react/components/container/WeekSelector.js index 19a3947..f927117 100644 --- a/src/client/react/components/container/WeekSelector.js +++ b/src/client/react/components/container/WeekSelector.js @@ -81,9 +81,12 @@ class WeekSelector extends React.Component { } } -const mapStateToProps = (state, { location, history }) => ({ +const mapStateToProps = (state, { location }) => ({ week: weekFromLocation(location), +}); + +const mapDispatchToProps = (dispatch, { location, history }) => ({ setWeek: makeSetWeek(location, history), }); -export default withRouter(connect(mapStateToProps)(WeekSelector)); +export default withRouter(connect(mapStateToProps, mapDispatchToProps)(WeekSelector)); |