]>
cat aescling's git repositories - mastodon.git/blob - 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';
7 clearComposeSuggestions
,
8 fetchComposeSuggestions
,
9 selectComposeSuggestion
,
10 changeComposeSpoilerText
,
12 } from '../../../actions/compose';
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,
32 const mapDispatchToProps
= (dispatch
) => ({
35 dispatch(changeCompose(text
));
38 onPrivacyChange (value
) {
39 dispatch(changeComposeVisibility(value
));
43 dispatch(submitCompose());
46 onClearSuggestions () {
47 dispatch(clearComposeSuggestions());
50 onFetchSuggestions (token
) {
51 dispatch(fetchComposeSuggestions(token
));
54 onSuggestionSelected (position
, token
, accountId
) {
55 dispatch(selectComposeSuggestion(position
, token
, accountId
));
58 onChangeSpoilerText (checked
) {
59 dispatch(changeComposeSpoilerText(checked
));
63 dispatch(uploadCompose(files
));
66 onPickEmoji (position
, data
) {
67 dispatch(insertEmojiCompose(position
, data
));
72 export default connect(mapStateToProps
, mapDispatchToProps
)(ComposeForm
);
This page took 0.084727 seconds and 5 git commands to generate.