import React from 'react'; import PropTypes from 'prop-types'; import templateChecker from '@commons/util/template-checker'; export default class PageListMeta extends React.Component { isPortalPath(path) { if (path.match(/.*\/$/)) { return true; } return false; } render() { // TODO isPortal() const page = this.props.page; // portal check let portalLabel; if (this.isPortalPath(page.path)) { portalLabel = PORTAL; } // template check let templateLabel; if (templateChecker(page.path)) { templateLabel = TMPL; } let commentCount; if (page.commentCount > 0) { commentCount = {page.commentCount}; } let likerCount; if (page.liker.length > 0) { likerCount = {page.liker.length}; } let locked; if (page.grant !== 1) { locked = ; } return ( {portalLabel} {templateLabel} {commentCount} {likerCount} {locked} ); } } PageListMeta.propTypes = { page: PropTypes.object.isRequired, }; PageListMeta.defaultProps = { };