diff --git a/packages/component-faraday-ui/src/contextualBoxes/ReviewerDetails.js b/packages/component-faraday-ui/src/contextualBoxes/ReviewerDetails.js index efa929afe32fd35476948eca48e366414aaa3c15..ec5e14dd4bd6805df1abde8f7fe69b5e2a06eda1 100644 --- a/packages/component-faraday-ui/src/contextualBoxes/ReviewerDetails.js +++ b/packages/component-faraday-ui/src/contextualBoxes/ReviewerDetails.js @@ -40,6 +40,7 @@ const ReviewerDetails = ({ highlight, canViewReviewersDetails, authorCanViewReportsDetails, + isLatestVersion, ...rest }) => ( <ContextualBox @@ -62,17 +63,18 @@ const ReviewerDetails = ({ > <H4>Reviewer Details</H4> </TabButton> - {canInviteReviewers && ( - <TabButton - data-test-id="reviewer-tab-suggestions" - ml={1} - mr={1} - onClick={() => changeTab(2)} - selected={selectedTab === 2} - > - <H4>Reviewer Suggestions</H4> - </TabButton> - )} + {canInviteReviewers && + isLatestVersion && ( + <TabButton + data-test-id="reviewer-tab-suggestions" + ml={1} + mr={1} + onClick={() => changeTab(2)} + selected={selectedTab === 2} + > + <H4>Reviewer Suggestions</H4> + </TabButton> + )} <TabButton data-test-id="reviewer-tab-reports" ml={1} @@ -87,12 +89,13 @@ const ReviewerDetails = ({ <TabContent> {selectedTab === 0 && ( <Fragment> - {canInviteReviewers && ( - <InviteReviewers - modalKey="invite-reviewers" - onInvite={onInviteReviewer} - /> - )} + {canInviteReviewers && + isLatestVersion && ( + <InviteReviewers + modalKey="invite-reviewers" + onInvite={onInviteReviewer} + /> + )} <ReviewersTable invitations={invitations} diff --git a/packages/component-manuscript/src/components/ManuscriptLayout.js b/packages/component-manuscript/src/components/ManuscriptLayout.js index ab97d296049c9240213c740f6987eb0cabd8f8ad..93cfc502ac482e74aa583827a1b18cdd087ab197 100644 --- a/packages/component-manuscript/src/components/ManuscriptLayout.js +++ b/packages/component-manuscript/src/components/ManuscriptLayout.js @@ -67,6 +67,7 @@ const ManuscriptLayout = ({ recommendationHandler, inviteHandlingEditor, versions, + isLatestVersion, }) => ( <Root pb={30}> {!isEmpty(collection) && !isEmpty(fragment) ? ( @@ -186,6 +187,7 @@ const ManuscriptLayout = ({ } invitations={invitationsWithReviewers} isFetching={isFetchingData.publonsFetching} + isLatestVersion={isLatestVersion} journal={journal} mb={2} publonReviewers={publonReviewers} diff --git a/packages/component-manuscript/src/components/ManuscriptPage.js b/packages/component-manuscript/src/components/ManuscriptPage.js index ab96f5c6b3bb159bf4e1d9f15ea20a341029e5a3..5b902498b9605887e88436f3968b1faa2e3492bc 100644 --- a/packages/component-manuscript/src/components/ManuscriptPage.js +++ b/packages/component-manuscript/src/components/ManuscriptPage.js @@ -72,6 +72,7 @@ import { redirectToError, parseSearchParams, getPublonsReviewers, + isLatestVersion, } from './utils' import { @@ -281,12 +282,15 @@ export default compose( toggleEditorialComments: toggle, editorialCommentsExpanded: expanded, })), - withProps(({ currentUser, collection, submittedOwnRecommendation }) => ({ - getSignedUrl, - shouldReview: - get(currentUser, 'isReviewer', false) && - isUndefined(submittedOwnRecommendation), - })), + withProps( + ({ currentUser, collection, submittedOwnRecommendation, fragment }) => ({ + getSignedUrl, + shouldReview: + get(currentUser, 'isReviewer', false) && + isUndefined(submittedOwnRecommendation), + isLatestVersion: isLatestVersion(collection, fragment), + }), + ), withInviteHandlingEditor, withInviteReviewer, withSubmitRevision, diff --git a/packages/component-manuscript/src/components/utils.js b/packages/component-manuscript/src/components/utils.js index e579d683636db3dfcb7917c961dd8d9f5a02eff8..5b8195f423cc3f8b9cb002e168c88ffb61630422 100644 --- a/packages/component-manuscript/src/components/utils.js +++ b/packages/component-manuscript/src/components/utils.js @@ -96,6 +96,9 @@ export const parseVersionOptions = (fragments = []) => })) .reverse() +export const isLatestVersion = (collection, fragment) => + collection.fragments.indexOf(fragment.id) === collection.fragments.length - 1 + const alreadyAnswered = `You have already answered this invitation.` export const redirectToError = redirectFn => err => { const errorText = get(JSON.parse(err.response), 'error')