2016-08-31 20:58:10 +00:00
|
|
|
import { connect } from 'react-redux';
|
2016-09-03 12:01:10 +00:00
|
|
|
import ComposeForm from '../components/compose_form';
|
2016-09-19 21:25:59 +00:00
|
|
|
import { changeCompose, submitCompose, cancelReplyCompose } from '../../../actions/compose';
|
2016-10-07 22:01:22 +00:00
|
|
|
import { getStatus } from '../../../selectors';
|
2016-09-05 14:56:43 +00:00
|
|
|
|
2016-08-25 17:52:55 +00:00
|
|
|
const mapStateToProps = function (state, props) {
|
2016-08-31 14:15:12 +00:00
|
|
|
return {
|
|
|
|
text: state.getIn(['compose', 'text']),
|
2016-08-31 20:58:10 +00:00
|
|
|
is_submitting: state.getIn(['compose', 'is_submitting']),
|
2016-09-27 15:02:30 +00:00
|
|
|
is_uploading: state.getIn(['compose', 'is_uploading']),
|
2016-10-07 22:01:22 +00:00
|
|
|
in_reply_to: getStatus(state, state.getIn(['compose', 'in_reply_to']))
|
2016-08-31 14:15:12 +00:00
|
|
|
};
|
2016-08-25 17:52:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const mapDispatchToProps = function (dispatch) {
|
|
|
|
return {
|
2016-08-31 14:15:12 +00:00
|
|
|
onChange: function (text) {
|
|
|
|
dispatch(changeCompose(text));
|
|
|
|
},
|
|
|
|
|
|
|
|
onSubmit: function () {
|
|
|
|
dispatch(submitCompose());
|
2016-08-31 20:58:10 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
onCancelReply: function () {
|
|
|
|
dispatch(cancelReplyCompose());
|
2016-08-25 17:52:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2016-09-03 12:01:10 +00:00
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(ComposeForm);
|