Skip to content
Snippets Groups Projects
Commit 6f9468a8 authored by Tania Fecheta's avatar Tania Fecheta
Browse files

fix(heRecommendation): change button, modal title and modal button text according to recommendation

parent d120a680
No related branches found
No related tags found
2 merge requests!110Sprint 21 Features,!84Hin restore he rec
...@@ -20,10 +20,30 @@ import { ...@@ -20,10 +20,30 @@ import {
} from 'pubsweet-component-faraday-ui/src' } from 'pubsweet-component-faraday-ui/src'
const options = [ const options = [
{ value: 'publish', label: 'Publish' }, {
{ value: 'reject', label: 'Reject' }, value: 'publish',
{ value: 'minor', label: 'Request Minor Revision' }, label: 'Publish',
{ value: 'major', label: 'Request Major Revision' }, message: 'Recommend Manuscript for Publishing',
button: 'Submit Recommendation',
},
{
value: 'reject',
label: 'Reject',
message: 'Recommend Manuscript for Rejection',
button: 'Submit Recommendation',
},
{
value: 'minor',
label: 'Request Minor Revision',
message: 'Request Minor Revision',
button: 'Request Revision',
},
{
value: 'major',
label: 'Request Major Revision',
message: 'Request Major Revision',
button: 'Request Revision',
},
] ]
const parseFormValues = ({ recommendation, ...rest }) => { const parseFormValues = ({ recommendation, ...rest }) => {
...@@ -98,7 +118,11 @@ const HERecommendation = ({ ...@@ -98,7 +118,11 @@ const HERecommendation = ({
<Row justify="flex-end" mt={2}> <Row justify="flex-end" mt={2}>
<Button onClick={handleSubmit} primary size="medium"> <Button onClick={handleSubmit} primary size="medium">
Submit recommendation {
options.find(
o => o.value === get(formValues, 'recommendation', 'publish'),
).button
}
</Button> </Button>
</Row> </Row>
</Root> </Root>
...@@ -114,17 +138,31 @@ export default compose( ...@@ -114,17 +138,31 @@ export default compose(
withProps(({ formValues }) => ({ withProps(({ formValues }) => ({
modalTitle: options.find( modalTitle: options.find(
o => o.value === get(formValues, 'recommendation', 'publish'), o => o.value === get(formValues, 'recommendation', 'publish'),
).label, ).message,
confirmMessage: options.find(
o => o.value === get(formValues, 'recommendation', 'publish'),
).button,
})), })),
reduxForm({ reduxForm({
form: 'HERecommendation', form: 'HERecommendation',
onSubmit: ( onSubmit: (
values, values,
dispatch, dispatch,
{ onRecommendationSubmit, showModal, setFetching, modalTitle }, {
onRecommendationSubmit,
showModal,
setFetching,
modalTitle,
confirmMessage,
},
) => { ) => {
showModal({ showModal({
title: `${modalTitle}?`, title: `${modalTitle}?`,
confirmText:
confirmMessage === 'Submit Recommendation'
? 'Submit'
: confirmMessage,
onConfirm: props => { onConfirm: props => {
onRecommendationSubmit(parseFormValues(values), { onRecommendationSubmit(parseFormValues(values), {
...props, ...props,
......
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