chinwagsocial/app/assets/javascripts/components/features/ui/containers/compose_form_container.jsx
Eugen Rochko f8f40f15da Move status components inside individual containers. We still need to select
all statuses/accounts to assemble, but at least lists don't have to be
re-rendered all the time now. Also add "mention" dropdown option
2016-10-24 18:08:23 +02:00

38 lines
1.1 KiB
JavaScript

import { connect } from 'react-redux';
import ComposeForm from '../components/compose_form';
import { changeCompose, submitCompose, cancelReplyCompose } from '../../../actions/compose';
import { makeGetStatus } from '../../../selectors';
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']))
};
};
return mapStateToProps;
};
const mapDispatchToProps = function (dispatch) {
return {
onChange: function (text) {
dispatch(changeCompose(text));
},
onSubmit: function () {
dispatch(submitCompose());
},
onCancelReply: function () {
dispatch(cancelReplyCompose());
}
}
};
export default connect(makeMapStateToProps, mapDispatchToProps)(ComposeForm);