bigbuffet-rw/app/soapbox/features/compose/containers/search_results_container.js

24 lines
957 B
JavaScript
Raw Normal View History

2020-03-27 13:59:38 -07:00
import { connect } from 'react-redux';
import SearchResults from '../components/search_results';
import { fetchSuggestions, dismissSuggestion } from '../../../actions/suggestions';
import { expandSearch, setFilter } from '../../../actions/search';
2020-03-27 13:59:38 -07:00
const mapStateToProps = state => {
return {
value: state.getIn(['search', 'submittedValue']),
results: state.getIn(['search', 'results']),
suggestions: state.getIn(['suggestions', 'items']),
submitted: state.getIn(['search', 'submitted']),
selectedFilter: state.getIn(['search', 'filter']),
};
};
2020-03-27 13:59:38 -07:00
const mapDispatchToProps = dispatch => ({
fetchSuggestions: () => dispatch(fetchSuggestions()),
expandSearch: type => dispatch(expandSearch(type)),
2020-03-27 13:59:38 -07:00
dismissSuggestion: account => dispatch(dismissSuggestion(account.get('id'))),
selectFilter: newActiveFilter => dispatch(setFilter(newActiveFilter)),
2020-03-27 13:59:38 -07:00
});
export default connect(mapStateToProps, mapDispatchToProps)(SearchResults);