diff options
author | Thibaut Girka <thib@sitedethib.com> | 2018-08-18 10:32:45 +0200 |
---|---|---|
committer | ThibG <thib@sitedethib.com> | 2018-08-18 17:53:20 +0200 |
commit | 9782ac017bbee51f443378350480c864a268ac08 (patch) | |
tree | 41fb85c5b00a26b40aa0c6ce9946507e62852e32 | |
parent | 69d4fa3bc5be51dfdc480875ec7105b6a2935587 (diff) |
Refactor in preparation for focal points modal
-rw-r--r-- | app/javascript/flavours/glitch/features/composer/index.js | 84 |
1 files changed, 62 insertions, 22 deletions
diff --git a/app/javascript/flavours/glitch/features/composer/index.js b/app/javascript/flavours/glitch/features/composer/index.js index 2678ffd53..771c5d0e3 100644 --- a/app/javascript/flavours/glitch/features/composer/index.js +++ b/app/javascript/flavours/glitch/features/composer/index.js @@ -95,28 +95,68 @@ function mapStateToProps (state) { }; // Dispatch mapping. -const mapDispatchToProps = { - onCancelReply: cancelReplyCompose, - onChangeAdvancedOption: changeComposeAdvancedOption, - onChangeDescription: changeUploadCompose, - onChangeSensitivity: changeComposeSensitivity, - onChangeSpoilerText: changeComposeSpoilerText, - onChangeSpoilerness: changeComposeSpoilerness, - onChangeText: changeCompose, - onChangeVisibility: changeComposeVisibility, - onClearSuggestions: clearComposeSuggestions, - onCloseModal: closeModal, - onFetchSuggestions: fetchComposeSuggestions, - onInsertEmoji: insertEmojiCompose, - onMount: mountCompose, - onOpenActionsModal: openModal.bind(null, 'ACTIONS'), - onOpenDoodleModal: openModal.bind(null, 'DOODLE', { noEsc: true }), - onSelectSuggestion: selectComposeSuggestion, - onSubmit: submitCompose, - onUndoUpload: undoUploadCompose, - onUnmount: unmountCompose, - onUpload: uploadCompose, -}; +const mapDispatchToProps = (dispatch) => ({ + onCancelReply() { + dispatch(cancelReplyCompose()); + }, + onChangeAdvancedOption(option, value) { + dispatch(changeComposeAdvancedOption(option, value)); + }, + onChangeDescription(id, description) { + dispatch(changeUploadCompose(id, description)); + }, + onChangeSensitivity() { + dispatch(changeComposeSensitivity()); + }, + onChangeSpoilerText(text) { + dispatch(changeComposeSpoilerText(text)); + }, + onChangeSpoilerness() { + dispatch(changeComposeSpoilerness()); + }, + onChangeText(text) { + 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. const handlers = { |