import React from 'react'; import PropTypes from 'prop-types'; import Slot from 'coral-framework/components/Slot'; import { Link } from 'react-router'; import { Icon } from 'coral-ui'; import CommentDetails from './CommentDetails'; import styles from './UserDetailComment.css'; import AdminCommentContent from 'coral-framework/components/AdminCommentContent'; import IfHasLink from 'coral-admin/src/components/IfHasLink'; import cn from 'classnames'; import CommentAnimatedEdit from './CommentAnimatedEdit'; import CommentLabels from '../containers/CommentLabels'; import ApproveButton from './ApproveButton'; import RejectButton from 'coral-admin/src/components/RejectButton'; import t, { timeago } from 'coral-framework/services/i18n'; class UserDetailComment extends React.Component { approve = () => this.props.comment.status === 'ACCEPTED' ? null : this.props.acceptComment({ commentId: this.props.comment.id }); reject = () => this.props.comment.status === 'REJECTED' ? null : this.props.rejectComment({ commentId: this.props.comment.id }); render() { const { comment, selected, toggleSelect, className, root: { settings }, } = this.props; const slotPassthrough = { root, comment, suspectWords: settings.wordlist.suspect, bannedWords: settings.wordlist.banned, body: comment.body, }; return (
  • toggleSelect(e.target.value, e.target.checked)} /> {timeago(comment.created_at)} {comment.editing && comment.editing.edited ? (   ({t('comment.edited')}) ) : null}
    {t('common.story')}:{' '} {comment.asset.title ? comment.asset.title : comment.asset.url} { {t('modqueue.moderate')} }
    {t('comment.view_context')}
    {/* TODO: translate string */} Contains Link
  • ); } } UserDetailComment.propTypes = { selected: PropTypes.bool, user: PropTypes.object.isRequired, viewUserDetail: PropTypes.func.isRequired, acceptComment: PropTypes.func.isRequired, rejectComment: PropTypes.func.isRequired, className: PropTypes.string, toggleSelect: PropTypes.func, root: PropTypes.shape({ settings: PropTypes.shape({ wordlist: PropTypes.shape({ suspect: PropTypes.arrayOf(PropTypes.string).isRequired, banned: PropTypes.arrayOf(PropTypes.string).isRequired, }), }), }), comment: PropTypes.shape({ id: PropTypes.string.isRequired, status: PropTypes.string.isRequired, body: PropTypes.string.isRequired, actions: PropTypes.array, created_at: PropTypes.string.isRequired, asset: PropTypes.shape({ title: PropTypes.string, url: PropTypes.string, id: PropTypes.string, }), }), }; export default UserDetailComment;