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 { ...@@ -18,6 +18,7 @@ import {
ItemOverrideAlert, ItemOverrideAlert,
withFetching, withFetching,
} from 'pubsweet-component-faraday-ui/src' } from 'pubsweet-component-faraday-ui/src'
import { inviteReviewer } from 'pubsweet-components-faraday/src/redux/reviewers'
const options = [ const options = [
{ {
...@@ -52,12 +53,15 @@ const optionsWhereHECanOnlyReject = { ...@@ -52,12 +53,15 @@ const optionsWhereHECanOnlyReject = {
revisionRequested: 'revisionRequested', revisionRequested: 'revisionRequested',
} }
const showHEOptions = (collection, hasReviewerReports) => { const showHEOptions = (collection, hasReviewerReports, fragment) => {
const { status, fragments } = collection const { status, fragments } = collection
const { invitations } = fragment
if (findKey(optionsWhereHECanOnlyReject, sts => sts === status)) { if (findKey(optionsWhereHECanOnlyReject, sts => sts === status)) {
return [options[1]] return [options[1]]
} else if (!hasReviewerReports && fragments.length === 1) { } else if (!hasReviewerReports && fragments.length === 1) {
return tail(options) return tail(options)
} else if (invitations === []) {
return [options[1]]
} }
return options return options
} }
...@@ -82,6 +86,7 @@ const HERecommendation = ({ ...@@ -82,6 +86,7 @@ const HERecommendation = ({
hasReviewerReports, hasReviewerReports,
highlight, highlight,
collection, collection,
fragment,
}) => ( }) => (
<ContextualBox <ContextualBox
highlight={highlight} highlight={highlight}
...@@ -99,7 +104,11 @@ const HERecommendation = ({ ...@@ -99,7 +104,11 @@ const HERecommendation = ({
<ValidatedField <ValidatedField
component={input => ( component={input => (
<Menu <Menu
options={showHEOptions(collection, hasReviewerReports)} options={showHEOptions(
collection,
hasReviewerReports,
fragment,
)}
{...input} {...input}
/> />
)} )}
......
...@@ -224,6 +224,7 @@ const ManuscriptLayout = ({ ...@@ -224,6 +224,7 @@ const ManuscriptLayout = ({
<HERecommendation <HERecommendation
collection={collection} collection={collection}
formValues={get(formValues, 'editorialRecommendation', {})} formValues={get(formValues, 'editorialRecommendation', {})}
fragment={fragment}
hasReviewerReports={reviewerRecommendations.length > 0} hasReviewerReports={reviewerRecommendations.length > 0}
highlight={reviewerRecommendations.length > 0} highlight={reviewerRecommendations.length > 0}
modalKey="heRecommendation" 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