aboutsummaryrefslogtreecommitdiff
path: root/src/client/react/components/container
diff options
context:
space:
mode:
authorNoah Loomans <noahloomans@gmail.com>2018-06-27 16:35:52 +0200
committerNoah Loomans <noahloomans@gmail.com>2018-06-27 16:37:25 +0200
commit949974e3edc11ffb144ead7f8a5f70d93e532e3c (patch)
tree2e2b4837efdcbab8a5d2b2cc7c8ca4627867aa6e /src/client/react/components/container
parentba319c58150e832a79e7474bbe78738082580c77 (diff)
Move callbacks to mapDispatchToProps
Diffstat (limited to 'src/client/react/components/container')
-rw-r--r--src/client/react/components/container/Menu.js6
-rw-r--r--src/client/react/components/container/Results.js10
-rw-r--r--src/client/react/components/container/RoomFinder.js6
-rw-r--r--src/client/react/components/container/Search.js10
-rw-r--r--src/client/react/components/container/WeekSelector.js7
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));