From d0e2733f63a7bd9601e73adee1107da804f85c41 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sat, 3 Sep 2016 14:01:10 +0200 Subject: Fix reblogs of reblogs in UI, add follow form in UI --- .../containers/compose_form_container.jsx | 29 ++++++++++++++++++++++ .../containers/composer_drawer_container.jsx | 29 ---------------------- .../containers/follow_form_container.jsx | 24 ++++++++++++++++++ 3 files changed, 53 insertions(+), 29 deletions(-) create mode 100644 app/assets/javascripts/components/containers/compose_form_container.jsx delete mode 100644 app/assets/javascripts/components/containers/composer_drawer_container.jsx create mode 100644 app/assets/javascripts/components/containers/follow_form_container.jsx (limited to 'app/assets/javascripts/components/containers') diff --git a/app/assets/javascripts/components/containers/compose_form_container.jsx b/app/assets/javascripts/components/containers/compose_form_container.jsx new file mode 100644 index 000000000..534830c27 --- /dev/null +++ b/app/assets/javascripts/components/containers/compose_form_container.jsx @@ -0,0 +1,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); diff --git a/app/assets/javascripts/components/containers/composer_drawer_container.jsx b/app/assets/javascripts/components/containers/composer_drawer_container.jsx deleted file mode 100644 index e9cef99b2..000000000 --- a/app/assets/javascripts/components/containers/composer_drawer_container.jsx +++ /dev/null @@ -1,29 +0,0 @@ -import { connect } from 'react-redux'; -import ComposerDrawer from '../components/composer_drawer'; -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)(ComposerDrawer); diff --git a/app/assets/javascripts/components/containers/follow_form_container.jsx b/app/assets/javascripts/components/containers/follow_form_container.jsx new file mode 100644 index 000000000..b5f787aba --- /dev/null +++ b/app/assets/javascripts/components/containers/follow_form_container.jsx @@ -0,0 +1,24 @@ +import { connect } from 'react-redux'; +import FollowForm from '../components/follow_form'; +import { changeFollow, submitFollow } from '../actions/follow'; + +const mapStateToProps = function (state, props) { + return { + text: state.getIn(['follow', 'text']), + is_submitting: state.getIn(['follow', 'is_submitting']) + }; +}; + +const mapDispatchToProps = function (dispatch) { + return { + onChange: function (text) { + dispatch(changeFollow(text)); + }, + + onSubmit: function () { + dispatch(submitFollow()); + } + } +}; + +export default connect(mapStateToProps, mapDispatchToProps)(FollowForm); -- cgit