]> cat aescling's git repositories - mastodon.git/blob - app/javascript/mastodon/features/compose/containers/compose_form_container.js
Make secondary toot button work nicer with file attachments & revert to the original...
[mastodon.git] / app / javascript / mastodon / features / compose / containers / compose_form_container.js
1 import { connect } from 'react-redux';
2 import ComposeForm from '../components/compose_form';
3 import { changeComposeVisibility, 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
14 const mapStateToProps = state => ({
15 text: state.getIn(['compose', 'text']),
16 suggestion_token: state.getIn(['compose', 'suggestion_token']),
17 suggestions: state.getIn(['compose', 'suggestions']),
18 advanced_options: state.getIn(['compose', 'advanced_options']),
19 spoiler: state.getIn(['compose', 'spoiler']),
20 spoiler_text: state.getIn(['compose', 'spoiler_text']),
21 privacy: state.getIn(['compose', 'privacy']),
22 focusDate: state.getIn(['compose', 'focusDate']),
23 preselectDate: state.getIn(['compose', 'preselectDate']),
24 is_submitting: state.getIn(['compose', 'is_submitting']),
25 is_uploading: state.getIn(['compose', 'is_uploading']),
26 me: state.getIn(['compose', 'me']),
27 showSearch: state.getIn(['search', 'submitted']) && !state.getIn(['search', 'hidden']),
28 settings: state.get('local_settings'),
29 filesAttached: state.getIn(['compose', 'media_attachments']).size > 0,
30 });
31
32 const mapDispatchToProps = (dispatch) => ({
33
34 onChange (text) {
35 dispatch(changeCompose(text));
36 },
37
38 onPrivacyChange (value) {
39 dispatch(changeComposeVisibility(value));
40 },
41
42 onSubmit () {
43 dispatch(submitCompose());
44 },
45
46 onClearSuggestions () {
47 dispatch(clearComposeSuggestions());
48 },
49
50 onFetchSuggestions (token) {
51 dispatch(fetchComposeSuggestions(token));
52 },
53
54 onSuggestionSelected (position, token, accountId) {
55 dispatch(selectComposeSuggestion(position, token, accountId));
56 },
57
58 onChangeSpoilerText (checked) {
59 dispatch(changeComposeSpoilerText(checked));
60 },
61
62 onPaste (files) {
63 dispatch(uploadCompose(files));
64 },
65
66 onPickEmoji (position, data) {
67 dispatch(insertEmojiCompose(position, data));
68 },
69
70 });
71
72 export default connect(mapStateToProps, mapDispatchToProps)(ComposeForm);
This page took 0.084727 seconds and 5 git commands to generate.