about summary refs log tree commit diff
path: root/app/javascript/mastodon/features/compose/containers/search_container.js
blob: 3ee55fae598a552f6add468ad41dbedcd67ba829 (plain) (blame)
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
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']),
});

const mapDispatchToProps = dispatch => ({

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

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

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

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

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

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

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

});

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