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