logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

compose_form_container.js (1869B)


  1. import { connect } from 'react-redux';
  2. import ComposeForm from '../components/compose_form';
  3. import { uploadCompose } from '../../../actions/compose';
  4. import {
  5. changeCompose,
  6. submitCompose,
  7. clearComposeSuggestions,
  8. fetchComposeSuggestions,
  9. selectComposeSuggestion,
  10. changeComposeSpoilerText,
  11. insertEmojiCompose,
  12. } from '../../../actions/compose';
  13. const mapStateToProps = state => ({
  14. text: state.getIn(['compose', 'text']),
  15. suggestion_token: state.getIn(['compose', 'suggestion_token']),
  16. suggestions: state.getIn(['compose', 'suggestions']),
  17. spoiler: state.getIn(['compose', 'spoiler']),
  18. spoiler_text: state.getIn(['compose', 'spoiler_text']),
  19. privacy: state.getIn(['compose', 'privacy']),
  20. focusDate: state.getIn(['compose', 'focusDate']),
  21. preselectDate: state.getIn(['compose', 'preselectDate']),
  22. is_submitting: state.getIn(['compose', 'is_submitting']),
  23. is_uploading: state.getIn(['compose', 'is_uploading']),
  24. showSearch: state.getIn(['search', 'submitted']) && !state.getIn(['search', 'hidden']),
  25. anyMedia: state.getIn(['compose', 'media_attachments']).size > 0,
  26. });
  27. const mapDispatchToProps = (dispatch) => ({
  28. onChange (text) {
  29. dispatch(changeCompose(text));
  30. },
  31. onSubmit () {
  32. dispatch(submitCompose());
  33. },
  34. onClearSuggestions () {
  35. dispatch(clearComposeSuggestions());
  36. },
  37. onFetchSuggestions (token) {
  38. dispatch(fetchComposeSuggestions(token));
  39. },
  40. onSuggestionSelected (position, token, accountId) {
  41. dispatch(selectComposeSuggestion(position, token, accountId));
  42. },
  43. onChangeSpoilerText (checked) {
  44. dispatch(changeComposeSpoilerText(checked));
  45. },
  46. onPaste (files) {
  47. dispatch(uploadCompose(files));
  48. },
  49. onPickEmoji (position, data) {
  50. dispatch(insertEmojiCompose(position, data));
  51. },
  52. });
  53. export default connect(mapStateToProps, mapDispatchToProps)(ComposeForm);