mirror of https://github.com/mastodon/mastodon
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.5 KiB
React
59 lines
1.5 KiB
React
8 years ago
|
import { connect } from 'react-redux';
|
||
|
import ComposeForm from '../components/compose_form';
|
||
|
import {
|
||
|
changeCompose,
|
||
|
submitCompose,
|
||
|
cancelReplyCompose,
|
||
|
clearComposeSuggestions,
|
||
8 years ago
|
fetchComposeSuggestions,
|
||
|
selectComposeSuggestion
|
||
8 years ago
|
} from '../../../actions/compose';
|
||
|
import { makeGetStatus } from '../../../selectors';
|
||
8 years ago
|
|
||
8 years ago
|
const makeMapStateToProps = () => {
|
||
|
const getStatus = makeGetStatus();
|
||
|
|
||
|
const mapStateToProps = function (state, props) {
|
||
|
return {
|
||
|
text: state.getIn(['compose', 'text']),
|
||
8 years ago
|
suggestion_token: state.getIn(['compose', 'suggestion_token']),
|
||
|
suggestions: state.getIn(['compose', 'suggestions']).toJS(),
|
||
8 years ago
|
is_submitting: state.getIn(['compose', 'is_submitting']),
|
||
|
is_uploading: state.getIn(['compose', 'is_uploading']),
|
||
|
in_reply_to: getStatus(state, state.getIn(['compose', 'in_reply_to']))
|
||
|
};
|
||
8 years ago
|
};
|
||
8 years ago
|
|
||
|
return mapStateToProps;
|
||
8 years ago
|
};
|
||
|
|
||
|
const mapDispatchToProps = function (dispatch) {
|
||
|
return {
|
||
8 years ago
|
onChange (text) {
|
||
8 years ago
|
dispatch(changeCompose(text));
|
||
|
},
|
||
|
|
||
8 years ago
|
onSubmit () {
|
||
8 years ago
|
dispatch(submitCompose());
|
||
8 years ago
|
},
|
||
|
|
||
8 years ago
|
onCancelReply () {
|
||
8 years ago
|
dispatch(cancelReplyCompose());
|
||
8 years ago
|
},
|
||
|
|
||
|
onClearSuggestions () {
|
||
|
dispatch(clearComposeSuggestions());
|
||
|
},
|
||
|
|
||
|
onFetchSuggestions (token) {
|
||
|
dispatch(fetchComposeSuggestions(token));
|
||
8 years ago
|
},
|
||
|
|
||
|
onSuggestionSelected (position, accountId) {
|
||
|
dispatch(selectComposeSuggestion(position, accountId));
|
||
8 years ago
|
}
|
||
|
}
|
||
|
};
|
||
|
|
||
8 years ago
|
export default connect(makeMapStateToProps, mapDispatchToProps)(ComposeForm);
|