You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.0 KiB
35 lines
1.0 KiB
4 years ago
|
import { connect } from 'react-redux';
|
||
|
import { changeAccountNoteComment, submitAccountNote, initEditAccountNote, cancelAccountNote } from 'mastodon/actions/account_notes';
|
||
|
import AccountNote from '../components/account_note';
|
||
|
|
||
|
const mapStateToProps = (state, { account }) => {
|
||
|
const isEditing = state.getIn(['account_notes', 'edit', 'account_id']) === account.get('id');
|
||
|
|
||
|
return {
|
||
|
isSubmitting: state.getIn(['account_notes', 'edit', 'isSubmitting']),
|
||
|
accountNote: isEditing ? state.getIn(['account_notes', 'edit', 'comment']) : account.getIn(['relationship', 'note']),
|
||
|
isEditing,
|
||
|
};
|
||
|
};
|
||
|
|
||
|
const mapDispatchToProps = (dispatch, { account }) => ({
|
||
|
|
||
|
onEditAccountNote() {
|
||
|
dispatch(initEditAccountNote(account));
|
||
|
},
|
||
|
|
||
|
onSaveAccountNote() {
|
||
|
dispatch(submitAccountNote());
|
||
|
},
|
||
|
|
||
|
onCancelAccountNote() {
|
||
|
dispatch(cancelAccountNote());
|
||
|
},
|
||
|
|
||
|
onChangeAccountNote(comment) {
|
||
|
dispatch(changeAccountNoteComment(comment));
|
||
|
},
|
||
|
});
|
||
|
|
||
|
export default connect(mapStateToProps, mapDispatchToProps)(AccountNote);
|