Vulcan/packages/nova-base-components/lib/containers/CommentsEditFormContainer.jsx

76 lines
2.6 KiB
React
Raw Normal View History

2016-11-07 23:46:12 +09:00
// import Telescope from 'meteor/nova:lib';
// import React, { PropTypes, Component } from 'react';
// import { FormattedMessage, intlShape } from 'react-intl';
2016-11-05 18:37:46 +09:00
2016-11-07 23:46:12 +09:00
// import { bindActionCreators } from 'redux';
// import { connect } from 'react-redux';
// import { withRouter } from 'react-router'
// import { graphql } from 'react-apollo';
// import gql from 'graphql-tag';
// import update from 'immutability-helper';
2016-11-05 18:37:46 +09:00
2016-11-07 23:46:12 +09:00
// const CommentsEditFormContainer = (props, context) => {
// const Component = props.component;
2016-11-05 18:37:46 +09:00
2016-11-07 23:46:12 +09:00
// return <Component {...props} />;
// };
2016-11-05 18:37:46 +09:00
2016-11-07 23:46:12 +09:00
// CommentsEditFormContainer.propTypes = {
// flash: React.PropTypes.func,
// novaFormMutation: React.PropTypes.func,
// comment: React.PropTypes.object.isRequired,
// router: React.PropTypes.object,
// component: React.PropTypes.func,
// successCallback: React.PropTypes.func,
// cancelCallback: React.PropTypes.func,
// };
2016-11-05 18:37:46 +09:00
2016-11-07 23:46:12 +09:00
// const mapStateToProps = state => ({ messages: state.messages, });
// const mapDispatchToProps = dispatch => bindActionCreators(Telescope.actions.messages, dispatch);
2016-11-05 18:37:46 +09:00
2016-11-07 23:46:12 +09:00
// const CommentsEditFormContainerWithMutation = graphql(gql`
// mutation commentsEdit($commentId: String, $set: CommentInput, $unset: CommentUnsetModifier) {
// commentsEdit(commentId: $commentId, set: $set, unset: $unset) {
// _id
// body
// htmlBody
// }
// }
// `, {
// props: ({ownProps, mutate}) => ({
// novaFormMutation: ({documentId, set, unset}) => {
// return mutate({
// variables: {commentId: documentId, set, unset},
// // optimisticResponse: {
// // __typename: 'Mutation',
// // postsEdit: {
// // __typename: 'Post',
// // ...set
// // }
// // },
// updateQueries: {
// getPost: (prev, { mutationResult }) => {
2016-11-07 15:03:45 +09:00
2016-11-07 23:46:12 +09:00
// const editedComment = mutationResult.data.commentsEdit;
2016-11-07 15:03:45 +09:00
2016-11-07 23:46:12 +09:00
// const commentIndex = Telescope.utils.findIndex(prev.post.comments, comment => comment._id = editedComment._id);
// const newCommentList = _.clone(prev.post.comments);
// newCommentList[commentIndex] = Object.assign(newCommentList[commentIndex], editedComment);
2016-11-07 15:03:45 +09:00
2016-11-07 23:46:12 +09:00
// const newPost = update(prev, {
// post: {
// comments: {
// $set: newCommentList
// }
// }
// });
2016-11-07 15:03:45 +09:00
2016-11-07 23:46:12 +09:00
// return newPost;
// },
// }
// })
// }
// }),
// })(CommentsEditFormContainer);
2016-11-05 18:37:46 +09:00
2016-11-07 23:46:12 +09:00
// module.exports = withRouter(connect(mapStateToProps, mapDispatchToProps)(CommentsEditFormContainerWithMutation));