2016-04-19 15:45:36 +09:00
|
|
|
import React from 'react';
|
|
|
|
import SmartContainers from "meteor/utilities:react-list-container";
|
|
|
|
const ListContainer = SmartContainers.ListContainer;
|
|
|
|
|
2016-05-22 15:23:30 +09:00
|
|
|
import { ModalTrigger } from "meteor/nova:core";
|
2016-04-19 15:45:36 +09:00
|
|
|
|
|
|
|
const PostsCommentsThread = ({document, currentUser}) => {
|
|
|
|
|
|
|
|
const post = document;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="posts-comments-thread">
|
|
|
|
<h4 className="posts-comments-thread-title">Comments</h4>
|
|
|
|
<ListContainer
|
|
|
|
collection={Comments}
|
|
|
|
publication="comments.list"
|
|
|
|
selector={{postId: post._id}}
|
|
|
|
terms={{postId: post._id, view: "postComments"}}
|
|
|
|
limit={0}
|
|
|
|
parentProperty="parentCommentId"
|
|
|
|
joins={Comments.getJoins()}
|
2016-05-22 16:42:24 +09:00
|
|
|
component={Telescope.components.CommentsList}
|
2016-04-19 15:45:36 +09:00
|
|
|
/>
|
|
|
|
{ currentUser ?
|
|
|
|
<div className="posts-comments-thread-new">
|
|
|
|
<h4>New Comment:</h4>
|
2016-05-22 16:42:24 +09:00
|
|
|
<Telescope.components.CommentsNew type="comment" postId={post._id} />
|
2016-04-19 15:45:36 +09:00
|
|
|
</div> :
|
|
|
|
<div>
|
|
|
|
<ModalTrigger size="small" component={<a>Please log in to comment</a>}>
|
2016-05-22 16:42:24 +09:00
|
|
|
<Telescope.components.UsersAccountForm/>
|
2016-04-19 15:45:36 +09:00
|
|
|
</ModalTrigger>
|
|
|
|
</div> }
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
};
|
|
|
|
|
2016-05-22 16:42:24 +09:00
|
|
|
PostsCommentsThread.displayName = "PostsCommentsThread";
|
|
|
|
|
2016-04-19 15:45:36 +09:00
|
|
|
module.exports = PostsCommentsThread;
|
|
|
|
export default PostsCommentsThread;
|