* Refactor selectComposeSuggestion so that different paths can be updated * Add suggestions in CW field * Add emoji suggestion to poll options * Attempt to fix CSS * Hide suggestions by default They will be enabled if the input has focus
48 lines
1.3 KiB
JavaScript
48 lines
1.3 KiB
JavaScript
import { connect } from 'react-redux';
|
|
import PollForm from '../components/poll_form';
|
|
import { addPollOption, removePollOption, changePollOption, changePollSettings } from '../../../actions/compose';
|
|
import {
|
|
clearComposeSuggestions,
|
|
fetchComposeSuggestions,
|
|
selectComposeSuggestion,
|
|
} from '../../../actions/compose';
|
|
|
|
const mapStateToProps = state => ({
|
|
suggestions: state.getIn(['compose', 'suggestions']),
|
|
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));
|
|
},
|
|
|
|
onClearSuggestions () {
|
|
dispatch(clearComposeSuggestions());
|
|
},
|
|
|
|
onFetchSuggestions (token) {
|
|
dispatch(fetchComposeSuggestions(token));
|
|
},
|
|
|
|
onSuggestionSelected (position, token, accountId, path) {
|
|
dispatch(selectComposeSuggestion(position, token, accountId, path));
|
|
},
|
|
|
|
});
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(PollForm);
|