Skip to content
This repository has been archived by the owner on Jun 28, 2021. It is now read-only.

Commit

Permalink
Merge branch 'master' into settings-right
Browse files Browse the repository at this point in the history
  • Loading branch information
mmahalwy authored Apr 7, 2017
2 parents d8729a6 + c45f157 commit 928143d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
14 changes: 8 additions & 6 deletions src/containers/Search/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ class Search extends Component {
currentPage: PropTypes.number,
perPage: PropTypes.number,
query: PropTypes.string,
results: PropTypes.arrayOf(verseType), // eslint-disable-line
results: PropTypes.arrayOf(PropTypes.string),
entities: PropTypes.arrayOf(verseType),
push: PropTypes.func.isRequired,
location: PropTypes.shape({ // eslint-disable-line
q: PropTypes.string,
Expand Down Expand Up @@ -119,9 +120,9 @@ class Search extends Component {
}

renderBody() {
const { isErrored, isLoading, results, options, query } = this.props;
const { isErrored, isLoading, results, entities, options, location: { query } } = this.props;

if (!query) {
if (!query || !query.q) {
return (
<h3 className="text-center" style={{ padding: '15%' }}>
<LocaleFormattedMessage id="search.nothing" defaultMessage="No search query." />
Expand Down Expand Up @@ -151,9 +152,9 @@ class Search extends Component {

return results.map(result => (
<Verse
verse={result}
match={result.match}
key={result.verseKey}
verse={entities[result]}
match={entities[result].match}
key={entities[result].verseKey}
tooltip={options.tooltip}
isSearched
/>
Expand Down Expand Up @@ -208,6 +209,7 @@ function mapStateToProps(state) {
took: state.searchResults.took,
query: state.searchResults.query,
results: state.searchResults.results,
entities: state.searchResults.entities,
options: state.options
};
}
Expand Down
3 changes: 2 additions & 1 deletion src/redux/modules/searchResults.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ export default function reducer(state = initialState, action = {}) {
perPage: action.result.result.perPage,
took: action.result.result.took,
query: action.result.result.query,
results: action.result.result.results
results: action.result.result.results,
entities: action.result.entities.verses
};
case SEARCH_FAIL:
return {
Expand Down

0 comments on commit 928143d

Please sign in to comment.