diff --git a/src/components/IntegrationAutosuggest.js b/src/components/IntegrationAutosuggest.js index 3c31893aa718a34f3c4735461c96f4e6933e477b..b3745099b30052cbc634fb139496903d9a1a9ea5 100644 --- a/src/components/IntegrationAutosuggest.js +++ b/src/components/IntegrationAutosuggest.js @@ -41,7 +41,7 @@ function renderSuggestionsContainer(options) { } function getSuggestionValue(suggestion) { - return suggestion.label; + return suggestion; } const styles = theme => ({ diff --git a/src/components/SuggestionItem.js b/src/components/SuggestionItem.js index 723d486f483b65df7461d16597befb6b97828deb..cff15c11e1c8024e4f83d86355799f90aa1cacd9 100644 --- a/src/components/SuggestionItem.js +++ b/src/components/SuggestionItem.js @@ -8,17 +8,19 @@ const styles = { fontWeight: 300, height: 10 }; +// +// const getCounts = (suggestion) => suggestion.datasets.map((dataset, index) => ( +// <span key={dataset.datasetId}> +// {index > 0 ? ', ' : ''} +// {`${dataset.shortTitle}: ${dataset.count.value}`} +// </span> +// )); -const getCounts = (suggestion) => suggestion.datasets.map((dataset, index) => ( - <span key={dataset.datasetId}> - {index > 0 ? ', ' : ''} - {`${dataset.shortTitle}: ${dataset.count.value}`} - </span> -)); +// <span> ({getCounts(suggestion)})</span> const SuggestionItem = ({ suggestion, query, isHighlighted }) => { - const matches = match(suggestion.label, query); - const parts = parse(suggestion.label, matches); + const matches = match(suggestion, query); + const parts = parse(suggestion, matches); return ( <MenuItem @@ -39,14 +41,13 @@ const SuggestionItem = ({ suggestion, query, isHighlighted }) => { </span> ); })} - <span> ({getCounts(suggestion)})</span> </div> </MenuItem> ); }; SuggestionItem.propTypes = { - suggestion: PropTypes.object.isRequired, + suggestion: PropTypes.string.isRequired, query: PropTypes.string.isRequired, isHighlighted: PropTypes.bool.isRequired, }; diff --git a/src/reducers/search.js b/src/reducers/search.js index d9d4523c3d0456a5671451052d19af533c73d5ef..b5c9a6a1fef677a30fb044cf8232b1e8abbbc757 100644 --- a/src/reducers/search.js +++ b/src/reducers/search.js @@ -8,7 +8,7 @@ import { UPDATE_RESULTS, CLEAR_RESULTS } from '../actions'; -import suggestions from './suggestions'; +//import suggestions from './suggestions'; import results from './results'; export const INITIAL_STATE = { @@ -42,7 +42,7 @@ const search = (state = INITIAL_STATE, action) => { case UPDATE_SUGGESTIONS: return { ...state, - suggestions: suggestions(state.suggestions, action), + suggestions: action.suggestions, suggestionsQuery: state.query, fetchingSuggestions: false };