Refactor in preparation for focal points modal

This commit is contained in:
Thibaut Girka 2018-08-18 10:32:45 +02:00 committed by ThibG
parent 69d4fa3bc5
commit 9782ac017b
1 changed files with 62 additions and 22 deletions

View File

@ -95,28 +95,68 @@ function mapStateToProps (state) {
}; };
// Dispatch mapping. // Dispatch mapping.
const mapDispatchToProps = { const mapDispatchToProps = (dispatch) => ({
onCancelReply: cancelReplyCompose, onCancelReply() {
onChangeAdvancedOption: changeComposeAdvancedOption, dispatch(cancelReplyCompose());
onChangeDescription: changeUploadCompose, },
onChangeSensitivity: changeComposeSensitivity, onChangeAdvancedOption(option, value) {
onChangeSpoilerText: changeComposeSpoilerText, dispatch(changeComposeAdvancedOption(option, value));
onChangeSpoilerness: changeComposeSpoilerness, },
onChangeText: changeCompose, onChangeDescription(id, description) {
onChangeVisibility: changeComposeVisibility, dispatch(changeUploadCompose(id, description));
onClearSuggestions: clearComposeSuggestions, },
onCloseModal: closeModal, onChangeSensitivity() {
onFetchSuggestions: fetchComposeSuggestions, dispatch(changeComposeSensitivity());
onInsertEmoji: insertEmojiCompose, },
onMount: mountCompose, onChangeSpoilerText(text) {
onOpenActionsModal: openModal.bind(null, 'ACTIONS'), dispatch(changeComposeSpoilerText(text));
onOpenDoodleModal: openModal.bind(null, 'DOODLE', { noEsc: true }), },
onSelectSuggestion: selectComposeSuggestion, onChangeSpoilerness() {
onSubmit: submitCompose, dispatch(changeComposeSpoilerness());
onUndoUpload: undoUploadCompose, },
onUnmount: unmountCompose, onChangeText(text) {
onUpload: uploadCompose, dispatch(changeCompose(text));
}; },
onChangeVisibility(value) {
dispatch(changeComposeVisibility(value));
},
onClearSuggestions() {
dispatch(clearComposeSuggestions());
},
onCloseModal() {
dispatch(closeModal());
},
onFetchSuggestions(token) {
dispatch(fetchComposeSuggestions(token));
},
onInsertEmoji(position, emoji) {
dispatch(insertEmojiCompose(position, emoji));
},
onMount() {
dispatch(mountCompose());
},
onOpenActionModal(props) {
dispatch(openModal('ACTIONS', props));
},
onOpenDoodleModal() {
dispatch(openModal('DOODLE', { noEsc: true }));
},
onSelectSuggestion(position, token, suggestion) {
dispatch(selectComposeSuggestion(position, token, suggestion));
},
onSubmit() {
dispatch(submitCompose());
},
onUndoUpload(id) {
dispatch(undoUploadCompose(id));
},
onUnmount() {
dispatch(unmountCompose());
},
onUpload(files) {
dispatch(uploadCompose(files));
},
});
// Handlers. // Handlers.
const handlers = { const handlers = {