diff --git a/packages/components-faraday/src/components/Dashboard/DashboardCard.js b/packages/components-faraday/src/components/Dashboard/DashboardCard.js index 3352e82c36853014f72626052296fe4842e09610..d9ce0788938903cc7732e95dbed205ef96c921e8 100644 --- a/packages/components-faraday/src/components/Dashboard/DashboardCard.js +++ b/packages/components-faraday/src/components/Dashboard/DashboardCard.js @@ -38,6 +38,7 @@ const DashboardCard = ({ const { submitted, title, type } = parseVersion(version) const metadata = get(version, 'metadata') const files = get(version, 'files') + const invitations = get(project, 'invitations') || [] const customId = project.customId || project.id.split('-')[0] const hasFiles = files ? Object.values(files).some(f => f.length > 0) : false const journalIssueType = parseJournalIssue(journal, metadata) @@ -159,7 +160,9 @@ const DashboardCard = ({ </LeftDetails> {canInviteReviewers() && ( <RightDetails flex={4}> - <ReviewerReports project={project} /> + <ReviewerReports + invitations={invitations.filter(i => i.role === 'reviewer')} + /> <InviteReviewers modalKey={`invite-reviewers-${project.id}`} project={project} diff --git a/packages/components-faraday/src/components/Dashboard/ReviewerReports.js b/packages/components-faraday/src/components/Dashboard/ReviewerReports.js index ae3b7cdf08344bbcaccf1c9d9e454a2e1d6a36ab..b7adb7ede2d92e302d5222ebff7ba8c93f9151ec 100644 --- a/packages/components-faraday/src/components/Dashboard/ReviewerReports.js +++ b/packages/components-faraday/src/components/Dashboard/ReviewerReports.js @@ -2,7 +2,7 @@ import React from 'react' import { th } from '@pubsweet/ui' import styled, { css } from 'styled-components' -const ReviewerReports = ({ project: { invitations = [] } }) => { +const ReviewerReports = ({ invitations }) => { const accepted = invitations.filter(i => i.isAccepted).length return ( <ReviewerText>{`Reviewer reports (${accepted}/${ diff --git a/packages/components-faraday/src/components/Reviewers/InviteReviewers.js b/packages/components-faraday/src/components/Reviewers/InviteReviewers.js index e245a2906ecd77ff7051777087e0032451bae008..15895bc3c355b724807e4c577fdf9fd84a9b104c 100644 --- a/packages/components-faraday/src/components/Reviewers/InviteReviewers.js +++ b/packages/components-faraday/src/components/Reviewers/InviteReviewers.js @@ -13,7 +13,7 @@ import { getCollectionReviewers, selectReviewers, selectFetchingReviewers, - selectFechingInvite, + selectFetchingInvite, } from '../../redux/reviewers' const InviteReviewers = ({ showInviteModal }) => ( @@ -26,7 +26,7 @@ const InviteReviewersModal = compose( state => ({ reviewers: selectReviewers(state), fetchingReviewers: selectFetchingReviewers(state), - fetchingInvite: selectFechingInvite(state), + fetchingInvite: selectFetchingInvite(state), }), { getCollectionReviewers }, ), @@ -86,7 +86,7 @@ const InviteReviewersModal = compose( const ModalSwitcher = compose( connect(state => ({ - fetchingInvite: selectFechingInvite(state), + fetchingInvite: selectFetchingInvite(state), })), )(({ type, fetchingInvite, ...rest }) => { switch (type) { diff --git a/packages/components-faraday/src/components/Reviewers/ReviewerList.js b/packages/components-faraday/src/components/Reviewers/ReviewerList.js index 13c092285db6d5e76d82a537667192021990dc21..4dcf29933a27a91ebbea68b29c7ce8b69f71518d 100644 --- a/packages/components-faraday/src/components/Reviewers/ReviewerList.js +++ b/packages/components-faraday/src/components/Reviewers/ReviewerList.js @@ -47,12 +47,14 @@ const ReviewersList = ({ <StatusText>{r.status}</StatusText> <DateText>{renderTimestamp(r.timestamp)}</DateText> </Column> - {r.status !== 'accepted' && ( + {r.status !== 'accepted' ? ( <ResendRevoke showConfirmResend={showConfirmResend(r)} showConfirmRevoke={showConfirmRevoke(r.invitationId)} status={r.status} /> + ) : ( + <Column /> )} </ReviewerItem> ))} diff --git a/packages/components-faraday/src/redux/reviewers.js b/packages/components-faraday/src/redux/reviewers.js index 1be269eacea031a90cf8008a23745e728c9224b1..1a7cd50047480605f1e5f38995f98d1acad7c9b8 100644 --- a/packages/components-faraday/src/redux/reviewers.js +++ b/packages/components-faraday/src/redux/reviewers.js @@ -69,7 +69,7 @@ const initialState = { export const selectReviewers = state => get(state, 'reviewers.reviewers') || [] export const selectFetchingReviewers = state => get(state, 'reviewers.fetching.reviewers') || false -export const selectFechingInvite = state => +export const selectFetchingInvite = state => get(state, 'reviewers.fetching.invite') || false export const selectFetchingDecision = state => get(state, 'reviewers.fetching.decision') || false @@ -146,6 +146,7 @@ export default (state = initialState, action = {}) => { ...state.fetching, reviewers: true, }, + reviewers: [], } case GET_REVIEWERS_ERROR: return {