Vulcan/packages/nova-base-components/lib/posts/PostsCommentsThread.jsx

41 lines
1.4 KiB
React
Raw Normal View History

import React from 'react';
2016-06-09 17:42:20 +09:00
import {FormattedMessage } from 'react-intl';
import { ListContainer } from "meteor/utilities:react-list-container";
2016-05-22 15:23:30 +09:00
import { ModalTrigger } from "meteor/nova:core";
const PostsCommentsThread = ({document, currentUser}) => {
const post = document;
return (
<div className="posts-comments-thread">
2016-06-09 17:42:20 +09:00
<h4 className="posts-comments-thread-title"><FormattedMessage id="comments.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()}
component={Telescope.components.CommentsList}
listId="comments.list"
/>
{ currentUser ?
<div className="posts-comments-thread-new">
2016-06-09 17:42:20 +09:00
<h4><FormattedMessage id="comments.new"/></h4>
<Telescope.components.CommentsNew type="comment" postId={post._id} />
</div> :
<div>
2016-06-09 17:42:20 +09:00
<ModalTrigger size="small" component={<a><FormattedMessage id="comments.please_log_in"/></a>}>
<Telescope.components.UsersAccountForm/>
</ModalTrigger>
</div> }
</div>
)
};
PostsCommentsThread.displayName = "PostsCommentsThread";
module.exports = PostsCommentsThread;
export default PostsCommentsThread;