From 5be066cc2714ca6cbd75d8786c859d8767df0ccb Mon Sep 17 00:00:00 2001 From: Noah Loomans Date: Mon, 19 Feb 2018 22:49:26 +0100 Subject: Merge reducers into single file --- src/client/react/components/container/HelpBox.js | 2 +- src/client/react/components/container/Results.js | 4 ++-- src/client/react/components/container/Search.js | 13 ++++++------- src/client/react/components/container/View.js | 2 +- 4 files changed, 10 insertions(+), 11 deletions(-) (limited to 'src/client/react/components') diff --git a/src/client/react/components/container/HelpBox.js b/src/client/react/components/container/HelpBox.js index 37b5c7e..31624db 100644 --- a/src/client/react/components/container/HelpBox.js +++ b/src/client/react/components/container/HelpBox.js @@ -47,7 +47,7 @@ class HelpBox extends React.Component { const mapStateToProps = state => ({ results: state.search.results, - searchText: state.search.searchText, + searchText: state.search.text, }); export default connect(mapStateToProps)(HelpBox); diff --git a/src/client/react/components/container/Results.js b/src/client/react/components/container/Results.js index 0f08d7a..5434eb4 100644 --- a/src/client/react/components/container/Results.js +++ b/src/client/react/components/container/Results.js @@ -86,8 +86,8 @@ class Results extends React.Component { const mapStateToProps = state => ({ results: state.search.results, - searchText: state.search.searchText, - selectedResult: state.search.selectedResult, + searchText: state.search.text, + selectedResult: state.search.result, }); export default withRouter(connect(mapStateToProps)(Results)); diff --git a/src/client/react/components/container/Search.js b/src/client/react/components/container/Search.js index 1c4ca4f..30ccad8 100644 --- a/src/client/react/components/container/Search.js +++ b/src/client/react/components/container/Search.js @@ -64,13 +64,13 @@ class Search extends React.Component { componentDidMount() { const urlUser = userFromMatch(this.props.match); - this.props.dispatch({ type: 'SEARCH/SET_USERS', urlUser }); + this.props.dispatch({ type: 'SEARCH/SET_USER', user: urlUser }); } componentWillReceiveProps(nextProps) { if (nextProps.match !== this.props.match) { const urlUser = userFromMatch(nextProps.match); - this.props.dispatch({ type: 'SEARCH/SET_USERS', urlUser }); + this.props.dispatch({ type: 'SEARCH/SET_USER', user: urlUser }); } } @@ -103,7 +103,7 @@ class Search extends React.Component { case 'Escape': event.preventDefault(); - this.props.dispatch({ type: 'SEARCH/SET_USERS', urlUser }); + this.props.dispatch({ type: 'SEARCH/SET_USER', user: urlUser }); break; case 'Enter': @@ -112,7 +112,7 @@ class Search extends React.Component { // EDGE CASE: The user is set if the user changes, but it doesn't // change if the result is already the one we are viewing. // Therefor, we need to dispatch the SET_USER command manually. - this.props.dispatch({ type: 'SEARCH/SET_USERS', urlUser }); + this.props.dispatch({ type: 'SEARCH/SET_USER', user: urlUser }); } else if (result) { this.props.history.push(`/${result}`); } @@ -170,9 +170,8 @@ class Search extends React.Component { const mapStateToProps = state => ({ results: state.search.results, - searchText: state.search.searchText, - selectedResult: state.search.selectedResult, - isExactMatch: state.search.isExactMatch, + searchText: state.search.text, + selectedResult: state.search.selected, }); export default withRouter(connect(mapStateToProps)(Search)); diff --git a/src/client/react/components/container/View.js b/src/client/react/components/container/View.js index 28aaad3..b374300 100644 --- a/src/client/react/components/container/View.js +++ b/src/client/react/components/container/View.js @@ -114,7 +114,7 @@ class View extends React.Component { } const mapStateToProps = state => ({ - schedules: state.view.schedules, + schedules: state.schedules, }); export default withRouter(connect(mapStateToProps)(View)); -- cgit v1.1