2016-10-31 04:13:05 +11:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import ComposeForm from '../components/compose_form';
|
2017-03-01 21:56:15 +11:00
|
|
|
import { uploadCompose } from '../../../actions/compose';
|
2016-10-31 04:13:05 +11:00
|
|
|
import {
|
|
|
|
changeCompose,
|
|
|
|
submitCompose,
|
|
|
|
clearComposeSuggestions,
|
2016-11-13 00:33:21 +11:00
|
|
|
fetchComposeSuggestions,
|
2016-11-24 04:53:23 +11:00
|
|
|
selectComposeSuggestion,
|
2017-01-13 15:54:26 +11:00
|
|
|
changeComposeSpoilerText,
|
2017-05-21 01:31:47 +10:00
|
|
|
insertEmojiCompose,
|
2016-10-31 04:13:05 +11:00
|
|
|
} from '../../../actions/compose';
|
2016-09-06 00:56:43 +10:00
|
|
|
|
2017-04-24 08:38:37 +10:00
|
|
|
const mapStateToProps = state => ({
|
|
|
|
text: state.getIn(['compose', 'text']),
|
|
|
|
suggestion_token: state.getIn(['compose', 'suggestion_token']),
|
|
|
|
suggestions: state.getIn(['compose', 'suggestions']),
|
|
|
|
spoiler: state.getIn(['compose', 'spoiler']),
|
|
|
|
spoiler_text: state.getIn(['compose', 'spoiler_text']),
|
|
|
|
privacy: state.getIn(['compose', 'privacy']),
|
|
|
|
focusDate: state.getIn(['compose', 'focusDate']),
|
|
|
|
preselectDate: state.getIn(['compose', 'preselectDate']),
|
|
|
|
is_submitting: state.getIn(['compose', 'is_submitting']),
|
|
|
|
is_uploading: state.getIn(['compose', 'is_uploading']),
|
2017-05-10 10:51:43 +10:00
|
|
|
me: state.getIn(['compose', 'me']),
|
2017-05-21 01:31:47 +10:00
|
|
|
showSearch: state.getIn(['search', 'submitted']) && !state.getIn(['search', 'hidden']),
|
2017-02-26 11:23:44 +11:00
|
|
|
});
|
|
|
|
|
2017-02-23 01:43:07 +11:00
|
|
|
const mapDispatchToProps = (dispatch) => ({
|
2016-09-01 00:15:12 +10:00
|
|
|
|
2017-02-23 01:43:07 +11:00
|
|
|
onChange (text) {
|
|
|
|
dispatch(changeCompose(text));
|
|
|
|
},
|
2016-09-01 06:58:10 +10:00
|
|
|
|
2017-02-23 01:43:07 +11:00
|
|
|
onSubmit () {
|
|
|
|
dispatch(submitCompose());
|
|
|
|
},
|
2016-10-31 04:13:05 +11:00
|
|
|
|
2017-02-23 01:43:07 +11:00
|
|
|
onClearSuggestions () {
|
|
|
|
dispatch(clearComposeSuggestions());
|
|
|
|
},
|
2016-10-31 04:13:05 +11:00
|
|
|
|
2017-02-23 01:43:07 +11:00
|
|
|
onFetchSuggestions (token) {
|
|
|
|
dispatch(fetchComposeSuggestions(token));
|
|
|
|
},
|
2016-11-13 00:33:21 +11:00
|
|
|
|
2017-02-23 01:43:07 +11:00
|
|
|
onSuggestionSelected (position, token, accountId) {
|
|
|
|
dispatch(selectComposeSuggestion(position, token, accountId));
|
|
|
|
},
|
2016-11-24 04:53:23 +11:00
|
|
|
|
2017-02-23 01:43:07 +11:00
|
|
|
onChangeSpoilerText (checked) {
|
|
|
|
dispatch(changeComposeSpoilerText(checked));
|
|
|
|
},
|
2017-01-13 15:54:26 +11:00
|
|
|
|
2017-03-01 21:56:15 +11:00
|
|
|
onPaste (files) {
|
|
|
|
dispatch(uploadCompose(files));
|
|
|
|
},
|
|
|
|
|
2017-03-02 10:57:55 +11:00
|
|
|
onPickEmoji (position, data) {
|
|
|
|
dispatch(insertEmojiCompose(position, data));
|
|
|
|
},
|
|
|
|
|
2017-02-23 01:43:07 +11:00
|
|
|
});
|
2016-08-26 03:52:55 +10:00
|
|
|
|
2017-02-23 01:43:07 +11:00
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(ComposeForm);
|