about summary refs log tree commit diff
path: root/app/assets/javascripts/components/containers/compose_form_container.jsx
blob: 534830c278cf1a2ab0c349a3ede7b4d4bb07bdbd (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
import { connect }                                          from 'react-redux';
import ComposeForm                                          from '../components/compose_form';
import { changeCompose, submitCompose, cancelReplyCompose } from '../actions/compose';

const mapStateToProps = function (state, props) {
  return {
    text: state.getIn(['compose', 'text']),
    is_submitting: state.getIn(['compose', 'is_submitting']),
    in_reply_to: state.getIn(['compose', 'in_reply_to'])
  };
};

const mapDispatchToProps = function (dispatch) {
  return {
    onChange: function (text) {
      dispatch(changeCompose(text));
    },

    onSubmit: function () {
      dispatch(submitCompose());
    },

    onCancelReply: function () {
      dispatch(cancelReplyCompose());
    }
  }
};

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