You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
872 B
30 lines
872 B
6 years ago
|
import { connect } from 'react-redux';
|
||
6 years ago
|
import PollForm from '../components/poll_form';
|
||
|
import { addPollOption, removePollOption, changePollOption, changePollSettings } from 'flavours/glitch/actions/compose';
|
||
6 years ago
|
|
||
|
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);
|