2019-03-05 22:53:37 -05:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import PollForm from '../components/poll_form';
|
2019-05-09 16:10:27 -04:00
|
|
|
import {
|
2023-02-13 09:12:31 -05:00
|
|
|
addPollOption,
|
|
|
|
removePollOption,
|
|
|
|
changePollOption,
|
|
|
|
changePollSettings,
|
2019-05-09 16:10:27 -04:00
|
|
|
clearComposeSuggestions,
|
|
|
|
fetchComposeSuggestions,
|
|
|
|
selectComposeSuggestion,
|
|
|
|
} from '../../../actions/compose';
|
2019-03-05 22:53:37 -05:00
|
|
|
|
|
|
|
const mapStateToProps = state => ({
|
2019-05-09 16:10:27 -04:00
|
|
|
suggestions: state.getIn(['compose', 'suggestions']),
|
2019-03-05 22:53:37 -05:00
|
|
|
options: state.getIn(['compose', 'poll', 'options']),
|
2023-01-29 13:00:19 -05:00
|
|
|
lang: state.getIn(['compose', 'language']),
|
2019-03-05 22:53:37 -05:00
|
|
|
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));
|
|
|
|
},
|
2019-05-09 16:10:27 -04:00
|
|
|
|
|
|
|
onClearSuggestions () {
|
|
|
|
dispatch(clearComposeSuggestions());
|
|
|
|
},
|
|
|
|
|
|
|
|
onFetchSuggestions (token) {
|
|
|
|
dispatch(fetchComposeSuggestions(token));
|
|
|
|
},
|
|
|
|
|
|
|
|
onSuggestionSelected (position, token, accountId, path) {
|
|
|
|
dispatch(selectComposeSuggestion(position, token, accountId, path));
|
|
|
|
},
|
|
|
|
|
2019-03-05 22:53:37 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(PollForm);
|