~cytrogen/masto-fe

ref: 53f5b27bd10e5f471b59cd0597d67ea12587c95a masto-fe/app/javascript/mastodon/features/compose/containers/search_container.js -rw-r--r-- 1004 bytes
53f5b27b — Claire Merge commit '640421f661ee4d7e76a2aab607e7b15687940b6f' into glitch-soc/merge-upstream 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import { connect } from 'react-redux';

import {
  changeSearch,
  clearSearch,
  submitSearch,
  showSearch,
  openURL,
  clickSearchResult,
  forgetSearchResult,
} from 'mastodon/actions/search';

import Search from '../components/search';

const mapStateToProps = state => ({
  value: state.getIn(['search', 'value']),
  submitted: state.getIn(['search', 'submitted']),
  recent: state.getIn(['search', 'recent']).reverse(),
});

const mapDispatchToProps = dispatch => ({

  onChange (value) {
    dispatch(changeSearch(value));
  },

  onClear () {
    dispatch(clearSearch());
  },

  onSubmit (type) {
    dispatch(submitSearch(type));
  },

  onShow () {
    dispatch(showSearch());
  },

  onOpenURL (q, routerHistory) {
    dispatch(openURL(q, routerHistory));
  },

  onClickSearchResult (q, type) {
    dispatch(clickSearchResult(q, type));
  },

  onForgetSearchResult (q) {
    dispatch(forgetSearchResult(q));
  },

});

export default connect(mapStateToProps, mapDispatchToProps)(Search);