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

31 lines
1.1 KiB
JavaScript
Raw Normal View History

2020-03-27 13:59:38 -07:00
import { connect } from 'react-redux';
2022-01-10 14:01:24 -08:00
import { getFeatures } from 'soapbox/utils/features';
import { expandSearch, setFilter } from '../../../actions/search';
import { fetchSuggestions, dismissSuggestion } from '../../../actions/suggestions';
import SearchResults from '../components/search_results';
2020-03-27 13:59:38 -07:00
const mapStateToProps = state => {
const instance = state.get('instance');
return {
value: state.getIn(['search', 'submittedValue']),
results: state.getIn(['search', 'results']),
suggestions: state.getIn(['suggestions', 'items']),
trends: state.getIn(['trends', 'items']),
submitted: state.getIn(['search', 'submitted']),
selectedFilter: state.getIn(['search', 'filter']),
features: getFeatures(instance),
};
};
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);