diff --git a/packages/component-faraday-ui/src/ManuscriptCard.js b/packages/component-faraday-ui/src/ManuscriptCard.js index eb945229f9b95c6a40c807cc07301661dafb8555..4c71c77f4190a961d472b0c9f96e921933ff5fd2 100644 --- a/packages/component-faraday-ui/src/ManuscriptCard.js +++ b/packages/component-faraday-ui/src/ManuscriptCard.js @@ -25,6 +25,7 @@ const ManuscriptCard = ({ onDelete, canDelete, onCardClick, + canSeeReviewersReports, fragment = {}, manuscriptType = {}, collection: { visibleStatus = 'Draft', handlingEditor, customId, id: collId }, @@ -76,7 +77,7 @@ const ManuscriptCard = ({ <Text ml={1} mr={3} whiteSpace="nowrap"> {get(handlingEditor, 'name', 'Unassigned')} </Text> - {handlingEditor && ( + {canSeeReviewersReports && ( <Fragment> <Label mr={1}>Reviewers Reports</Label> <ReviewerBreakdown fragment={fragment} label="Reviewer Reports" /> diff --git a/packages/components-faraday/src/components/Dashboard/DashboardItems.js b/packages/components-faraday/src/components/Dashboard/DashboardItems.js index c97ff0b1f3e81280da163e41e7ac67287f75719b..aad166bb291c64506465e89e1e1b306a578f427f 100644 --- a/packages/components-faraday/src/components/Dashboard/DashboardItems.js +++ b/packages/components-faraday/src/components/Dashboard/DashboardItems.js @@ -1,17 +1,32 @@ import React from 'react' import { H3 } from '@pubsweet/ui' import { get, has } from 'lodash' +import { connect } from 'react-redux' import styled from 'styled-components' import { th } from '@pubsweet/ui-toolkit' import { withRouter } from 'react-router-dom' -import { ManuscriptCard, Row } from 'pubsweet-component-faraday-ui' import { compose, setDisplayName, withHandlers } from 'recompose' +import { ManuscriptCard, Row } from 'pubsweet-component-faraday-ui' +import { canSeeReviewersReports } from 'pubsweet-component-faraday-selectors' import withVersion from './withVersion' -const DashboardItem = withVersion(ManuscriptCard) +const DashboardItem = compose( + withVersion, + connect((state, { collection }) => ({ + canSeeReviewersReports: canSeeReviewersReports( + state, + get(collection, 'id', ''), + ), + })), +)(ManuscriptCard) -const DashboardItems = ({ onClick, list, deleteProject }) => ( +const DashboardItems = ({ + list, + onClick, + deleteProject, + canSeeReviewersReports, +}) => ( <Root> {!list.length ? ( <Row justify="center" mt={4}>