2016-11-13 07:04:18 -05:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import {
|
|
|
|
changeSearch,
|
2017-03-31 13:59:54 -04:00
|
|
|
clearSearch,
|
|
|
|
submitSearch,
|
2017-05-20 11:31:47 -04:00
|
|
|
showSearch,
|
2023-04-01 03:59:10 -04:00
|
|
|
openURL,
|
|
|
|
clickSearchResult,
|
|
|
|
forgetSearchResult,
|
|
|
|
} from 'mastodon/actions/search';
|
2016-11-13 07:04:18 -05:00
|
|
|
import Search from '../components/search';
|
|
|
|
|
|
|
|
const mapStateToProps = state => ({
|
2017-03-31 16:44:12 -04:00
|
|
|
value: state.getIn(['search', 'value']),
|
2017-05-20 11:31:47 -04:00
|
|
|
submitted: state.getIn(['search', 'submitted']),
|
2023-04-01 03:59:10 -04:00
|
|
|
recent: state.getIn(['search', 'recent']),
|
2016-11-13 07:04:18 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
const mapDispatchToProps = dispatch => ({
|
|
|
|
|
|
|
|
onChange (value) {
|
|
|
|
dispatch(changeSearch(value));
|
|
|
|
},
|
|
|
|
|
|
|
|
onClear () {
|
2017-03-31 13:59:54 -04:00
|
|
|
dispatch(clearSearch());
|
2016-11-13 07:04:18 -05:00
|
|
|
},
|
|
|
|
|
2023-04-01 03:59:10 -04:00
|
|
|
onSubmit (type) {
|
|
|
|
dispatch(submitSearch(type));
|
2016-11-13 07:04:18 -05:00
|
|
|
},
|
|
|
|
|
2017-03-31 13:59:54 -04:00
|
|
|
onShow () {
|
|
|
|
dispatch(showSearch());
|
2017-05-20 11:31:47 -04:00
|
|
|
},
|
2016-11-13 07:04:18 -05:00
|
|
|
|
2023-04-01 03:59:10 -04:00
|
|
|
onOpenURL (routerHistory) {
|
|
|
|
dispatch(openURL(routerHistory));
|
|
|
|
},
|
|
|
|
|
|
|
|
onClickSearchResult (q, type) {
|
|
|
|
dispatch(clickSearchResult(q, type));
|
|
|
|
},
|
|
|
|
|
|
|
|
onForgetSearchResult (q) {
|
|
|
|
dispatch(forgetSearchResult(q));
|
|
|
|
},
|
|
|
|
|
2016-11-13 07:04:18 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(Search);
|