bigbuffet-rw/app/soapbox/features/compose/containers/search_results_container.js
marcin mikołajczak 7a35aa727b import from 'soapbox/…
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2022-05-30 20:23:55 +02:00

33 lines
1.3 KiB
JavaScript

import { connect } from 'react-redux';
import { expandSearch, setFilter } from 'soapbox/actions/search';
import { fetchSuggestions, dismissSuggestion } from 'soapbox/actions/suggestions';
import { fetchTrendingStatuses } from 'soapbox/actions/trending_statuses';
import { getFeatures } from 'soapbox/utils/features';
import SearchResults from '../components/search_results';
const mapStateToProps = state => {
const instance = state.get('instance');
return {
value: state.getIn(['search', 'submittedValue']),
results: state.getIn(['search', 'results']),
suggestions: state.getIn(['suggestions', 'items']),
trendingStatuses: state.getIn(['trending_statuses', 'items']),
trends: state.getIn(['trends', 'items']),
submitted: state.getIn(['search', 'submitted']),
selectedFilter: state.getIn(['search', 'filter']),
features: getFeatures(instance),
};
};
const mapDispatchToProps = dispatch => ({
fetchSuggestions: () => dispatch(fetchSuggestions()),
fetchTrendingStatuses: () => dispatch(fetchTrendingStatuses()),
expandSearch: type => dispatch(expandSearch(type)),
dismissSuggestion: account => dispatch(dismissSuggestion(account.get('id'))),
selectFilter: newActiveFilter => dispatch(setFilter(newActiveFilter)),
});
export default connect(mapStateToProps, mapDispatchToProps)(SearchResults);