about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/features/compose/containers/poll_form_container.js
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2019-04-20 23:27:20 +0200
committerThibG <thib@sitedethib.com>2019-04-22 20:15:47 +0200
commitc5f49a92dce9157debf3a68487dd30b6f0af6c4a (patch)
tree8f51562944e81efe7c97997fe8955b539cf65e49 /app/javascript/flavours/glitch/features/compose/containers/poll_form_container.js
parentf1a22e33e26f124cb1b3131e56678001b9e43bc3 (diff)
Move PollForm from features/composer to features/compose
Diffstat (limited to 'app/javascript/flavours/glitch/features/compose/containers/poll_form_container.js')
-rw-r--r--app/javascript/flavours/glitch/features/compose/containers/poll_form_container.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/app/javascript/flavours/glitch/features/compose/containers/poll_form_container.js b/app/javascript/flavours/glitch/features/compose/containers/poll_form_container.js
new file mode 100644
index 000000000..01df024c8
--- /dev/null
+++ b/app/javascript/flavours/glitch/features/compose/containers/poll_form_container.js
@@ -0,0 +1,29 @@
+import { connect } from 'react-redux';
+import PollForm from '../components/poll_form';
+import { addPollOption, removePollOption, changePollOption, changePollSettings } from 'flavours/glitch/actions/compose';
+
+const mapStateToProps = state => ({
+  options: state.getIn(['compose', 'poll', 'options']),
+  expiresIn: state.getIn(['compose', 'poll', 'expires_in']),
+  isMultiple: state.getIn(['compose', 'poll', 'multiple']),
+});
+
+const mapDispatchToProps = dispatch => ({
+  onAddOption(title) {
+    dispatch(addPollOption(title));
+  },
+
+  onRemoveOption(index) {
+    dispatch(removePollOption(index));
+  },
+
+  onChangeOption(index, title) {
+    dispatch(changePollOption(index, title));
+  },
+
+  onChangeSettings(expiresIn, isMultiple) {
+    dispatch(changePollSettings(expiresIn, isMultiple));
+  },
+});
+
+export default connect(mapStateToProps, mapDispatchToProps)(PollForm);