Skip to content
Snippets Groups Projects
Commit ded2866f authored by Iosif Boanca's avatar Iosif Boanca
Browse files

feat(HIN-1054-HE-make editorial recommendation options in different manuscript):

parent 8ce7740e
No related branches found
No related tags found
3 merge requests!160Update staging with master features,!150Develop,!139Hin 1054
......@@ -18,6 +18,7 @@ import {
ItemOverrideAlert,
withFetching,
} from 'pubsweet-component-faraday-ui/src'
import { inviteReviewer } from 'pubsweet-components-faraday/src/redux/reviewers'
const options = [
{
......@@ -52,12 +53,15 @@ const optionsWhereHECanOnlyReject = {
revisionRequested: 'revisionRequested',
}
const showHEOptions = (collection, hasReviewerReports) => {
const showHEOptions = (collection, hasReviewerReports, fragment) => {
const { status, fragments } = collection
const { invitations } = fragment
if (findKey(optionsWhereHECanOnlyReject, sts => sts === status)) {
return [options[1]]
} else if (!hasReviewerReports && fragments.length === 1) {
return tail(options)
} else if (invitations === []) {
return [options[1]]
}
return options
}
......@@ -82,6 +86,7 @@ const HERecommendation = ({
hasReviewerReports,
highlight,
collection,
fragment,
}) => (
<ContextualBox
highlight={highlight}
......@@ -99,7 +104,11 @@ const HERecommendation = ({
<ValidatedField
component={input => (
<Menu
options={showHEOptions(collection, hasReviewerReports)}
options={showHEOptions(
collection,
hasReviewerReports,
fragment,
)}
{...input}
/>
)}
......
......@@ -224,6 +224,7 @@ const ManuscriptLayout = ({
<HERecommendation
collection={collection}
formValues={get(formValues, 'editorialRecommendation', {})}
fragment={fragment}
hasReviewerReports={reviewerRecommendations.length > 0}
highlight={reviewerRecommendations.length > 0}
modalKey="heRecommendation"
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment