import { Components, registerComponent, ModalTrigger } from 'meteor/vulcan:core'; import React, { PureComponent } from 'react'; import PropTypes from 'prop-types'; import { FormattedMessage, FormattedRelative } from 'react-intl'; import { Link } from 'react-router'; import Posts from "meteor/vulcan:posts"; class PostsItem extends PureComponent { renderCategories() { return this.props.post.categories && this.props.post.categories.length > 0 ? : ""; } renderCommenters() { return this.props.post.commenters && this.props.post.commenters.length > 0 ? : ""; } renderActions() { return ( }> ) } render() { const {post} = this.props; let postClass = "posts-item"; if (post.sticky) postClass += " posts-sticky"; return ( {post.thumbnailUrl ? : null} {post.title} {this.renderCategories()} {post.user? : null} {post.postedAt ? : } {this.props.currentUser && this.props.currentUser.isAdmin ? : null} {Posts.options.mutations.edit.check(this.props.currentUser, post) ? this.renderActions() : null} {this.renderCommenters()} ) } } PostsItem.propTypes = { currentUser: PropTypes.object, post: PropTypes.object.isRequired, terms: PropTypes.object, }; registerComponent('PostsItem', PostsItem);