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

40 lines
1.3 KiB
React
Raw Normal View History

2016-08-08 11:18:21 +09:00
import Telescope from 'meteor/nova:lib';
import React from 'react';
2016-06-09 17:42:20 +09:00
import {FormattedMessage } from 'react-intl';
2016-05-22 15:23:30 +09:00
import { ModalTrigger } from "meteor/nova:core";
2016-06-23 12:17:39 +09:00
import Comments from "meteor/nova:comments";
const PostsCommentsThread = ({document, refetchQuery}, {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>
2016-10-19 11:07:21 +02:00
<Telescope.components.CommentsList comments={post.comments} commentCount={post.commentCount} />
{ currentUser ?
<div className="posts-comments-thread-new">
2016-06-09 17:42:20 +09:00
<h4><FormattedMessage id="comments.new"/></h4>
2016-11-05 18:37:46 +09:00
<Telescope.components.CommentsNewFormContainer
component={Telescope.components.CommentsNewForm}
postId={post._id}
type="comment"
/>
</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";
PostsCommentsThread.contextTypes = {
currentUser: React.PropTypes.object
};
module.exports = PostsCommentsThread;
export default PostsCommentsThread;