Sha256: a8e5d2afbde91a2c745f65a7320ae091fb4e07fb29ab32f455caeefab9f21d84
Contents?: true
Size: 1.69 KB
Versions: 2
Compression:
Stored size: 1.69 KB
Contents
import { Component, PropTypes } from 'react'; import { filter, propType } from 'graphql-anywhere'; import gql from 'graphql-tag'; import { I18n } from 'react-i18nify'; import Comment from './comment.component'; import commentThreadFragment from './comment_thread.fragment.graphql' /** * Define a collection of comments. It represents a conversation with multiple users. * @class * @augments Component * @todo It doesn't handle multiple comments yet */ class CommentThread extends Component { render() { const { comment, session, votable } = this.props; return ( <div> {this._renderTitle()} <div className="comment-thread"> <Comment comment={filter(Comment.fragments.comment, comment)} session={session} votable={votable} isRootComment /> </div> </div> ); } /** * Render conversation title if comment has replies * @private * @returns {Void|DOMElement} - The conversation's title */ _renderTitle() { const { comment: { author, hasReplies } } = this.props; if (hasReplies) { return ( <h6 className="comment-thread__title"> { I18n.t("components.comment_thread.title", { authorName: author.name }) } </h6> ); } return null; } } CommentThread.fragments = { comment: gql` ${commentThreadFragment} ${Comment.fragments.comment} ` }; CommentThread.propTypes = { session: PropTypes.shape({ user: PropTypes.any.isRequired }), comment: propType(CommentThread.fragments.comment).isRequired, votable: PropTypes.bool }; export default CommentThread;
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
decidim-comments-0.0.3 | app/frontend/comments/comment_thread.component.jsx |
decidim-0.0.3 | decidim-comments/app/frontend/comments/comment_thread.component.jsx |