diff --git a/packages/component-faraday-ui/src/RadioWithComments.js b/packages/component-faraday-ui/src/RadioWithComments.js index 00b1e65315be5a5fbde61159cf0aeb1f3aff047e..c4417ac47cf43681735c45bf6bf42c0a6d631c6e 100644 --- a/packages/component-faraday-ui/src/RadioWithComments.js +++ b/packages/component-faraday-ui/src/RadioWithComments.js @@ -2,20 +2,32 @@ import React from 'react' import { get } from 'lodash' import { Field } from 'redux-form' import styled from 'styled-components' -import { required as requiredValidator } from 'xpub-validators' import { ValidatedField, YesOrNo } from '@pubsweet/ui' +import { required as requiredValidator } from 'xpub-validators' -import { Label, Item, IconTooltip, Row, Textarea, marginHelper } from './' +import { + Row, + Item, + Text, + Label, + Textarea, + ActionLink, + IconTooltip, + marginHelper, + RowOverrideAlert, +} from './' const RadioWithComments = ({ required, + subtitle, radioLabel, formValues, commentsOn, - commentsLabel, radioFieldName, tooltipContent, + commentsSubtitle, commentsFieldName, + commentsPlaceholder, ...rest }) => ( <Root {...rest}> @@ -36,16 +48,24 @@ const RadioWithComments = ({ </Row> {get(formValues, radioFieldName, '') === commentsOn && ( - <Row alignItems="center" justify="flex-start"> + <RowOverrideAlert alignItems="center" justify="flex-start"> <Item data-test="submission-conflicts-text" vertical> - <Label required={required}>{commentsLabel}</Label> + {commentsSubtitle && ( + <Text secondary> + {commentsSubtitle} + {subtitle && ( + <ActionLink to={subtitle.link}>{subtitle.label}</ActionLink> + )} + </Text> + )} <ValidatedField component={Textarea} name={commentsFieldName} + placeholder={commentsPlaceholder} validate={required ? [requiredValidator] : []} /> </Item> - </Row> + </RowOverrideAlert> )} </Root> ) diff --git a/packages/component-wizard/src/components/StepTwo.js b/packages/component-wizard/src/components/StepTwo.js index f3995d16281bc8be30a963ba2b6410f02a6bf459..d81dc87e313e5a6c185fe305a98e63200d5faa67 100644 --- a/packages/component-wizard/src/components/StepTwo.js +++ b/packages/component-wizard/src/components/StepTwo.js @@ -2,6 +2,7 @@ import React, { Fragment } from 'react' import { get } from 'lodash' import { Field } from 'redux-form' import { required } from 'xpub-validators' +import { withHandlers } from 'recompose' import { Row, Text, @@ -27,6 +28,8 @@ const StepTwo = ({ formValues, authorsError, manuscriptTypes, + getTooltipContent, + journal: { submission: { questions = [] } }, ...rest }) => ( <Fragment> @@ -89,38 +92,31 @@ const StepTwo = ({ version={version} /> - <RadioWithComments - commentsFieldName="conflicts.message" - commentsLabel="Conflict of interest details" - commentsOn="yes" - formValues={formValues} - radioFieldName="conflicts.hasConflicts" - radioLabel="Do any authors have conflicts of interest to declare?" - required - tooltipContent={ConflictsTooltip} - /> - <RadioWithComments - commentsFieldName="conflicts.dataAvailabilityMessage" - commentsLabel="Data availability statement" - commentsOn="no" - formValues={formValues} - radioFieldName="conflicts.hasDataAvailability" - radioLabel="Have you included a data availability statement in your manuscript?" - tooltipContent={DataAvailabilityTooltip} - /> - <RadioWithComments - commentsFieldName="conflicts.fundingMessage" - commentsLabel="Funding statement" - commentsOn="no" - formValues={formValues} - radioFieldName="conflicts.hasFunding" - radioLabel="Have you provided a funding statement in your manuscript?" - tooltipContent={FundingTooltip} - /> + {questions.map(q => ( + <RadioWithComments + formValues={formValues} + key={q.id} + tooltipContent={getTooltipContent(q.id)} + {...q} + /> + ))} </Fragment> ) -export default StepTwo +export default withHandlers({ + getTooltipContent: () => questionId => () => { + switch (questionId) { + case 'conflictsOfInterest': + return <ConflictsTooltip /> + case 'dataAvailability': + return <DataAvailabilityTooltip /> + case 'funding': + return <FundingTooltip /> + default: + return null + } + }, +})(StepTwo) const ConflictsTooltip = () => ( <Text secondary> diff --git a/packages/component-wizard/src/components/SubmissionWizard.js b/packages/component-wizard/src/components/SubmissionWizard.js index d3b6de029b96c553ddf044c55f3083837b5fa429..d956a9bddfcbf5ca9e64b4484f4dba913b4599fc 100644 --- a/packages/component-wizard/src/components/SubmissionWizard.js +++ b/packages/component-wizard/src/components/SubmissionWizard.js @@ -69,7 +69,11 @@ const Wizard = ({ </Steps> <StepRoot className="wizard-step" step={step}> - {wizardSteps[step].component({ manuscriptTypes, journal, ...rest })} + {React.createElement(wizardSteps[step].component, { + manuscriptTypes, + journal, + ...rest, + })} <Row justify="center" mt={2}> {(isAuthorsFetching || isFilesFetching) && isLastStep ? ( <Spinner /> diff --git a/packages/xpub-faraday/app/config/journal/index.js b/packages/xpub-faraday/app/config/journal/index.js index 036b421ea20328566a7a875a23b59c978f9cc294..4afc96ed8ecddfe3cd7e4a94d8b15baab3499d27 100644 --- a/packages/xpub-faraday/app/config/journal/index.js +++ b/packages/xpub-faraday/app/config/journal/index.js @@ -11,3 +11,4 @@ export { default as articleSections } from './article-sections-tbrm' export { default as manuscriptTypes } from './manuscript-types' export { default as title } from './title' export { default as wizard } from './wizard' +export { default as submission } from './submission' diff --git a/packages/xpub-faraday/app/config/journal/metadata.js b/packages/xpub-faraday/app/config/journal/metadata.js index c01df20fbf88e1478f284e6c957ed7108ef2f3b6..21a6d76d89b54f4701fc3e4e0cfa3ca95bedc19c 100644 --- a/packages/xpub-faraday/app/config/journal/metadata.js +++ b/packages/xpub-faraday/app/config/journal/metadata.js @@ -1,7 +1,7 @@ export default { issn: '2474-7394', logo: '/assets/logo-hindawi@2x.png', - nameText: 'Faraday Journal', + nameText: 'Bioinorganic Chemistry and Applications', email: 'faraday@hindawi.com', mts: { doctype: 'article SYSTEM "JATS-archivearticle1-mathml3.dtd"', diff --git a/packages/xpub-faraday/app/config/journal/submission.js b/packages/xpub-faraday/app/config/journal/submission.js new file mode 100644 index 0000000000000000000000000000000000000000..e838c49edc1d09a6e0d1e2ff37805faec9af79fc --- /dev/null +++ b/packages/xpub-faraday/app/config/journal/submission.js @@ -0,0 +1,44 @@ +export default { + questions: [ + { + id: 'conflictsOfInterest', + commentsFieldName: 'conflicts.message', + commentsSubtitle: '', + subtitle: null, + commentsPlaceholder: 'Please provide the conflicts of interest', + commentsOn: 'yes', + radioFieldName: 'conflicts.hasConflicts', + radioLabel: 'Do any authors have conflicts of interest to declare?', + required: true, + }, + { + id: 'dataAvailability', + commentsFieldName: 'conflicts.dataAvailabilityMessage', + commentsSubtitle: + 'For more information about the data availability statement, please ', + subtitle: { + link: 'https://www.hindawi.com/journals/bca/guidelines/', + label: 'click here', + }, + commentsPlaceholder: + 'Please provide a statement describing the availability of the underlying data related to your submission', + commentsOn: 'no', + radioFieldName: 'conflicts.hasDataAvailability', + radioLabel: + 'Have you included a data availability statement in your manuscript?', + required: false, + }, + { + id: 'funding', + commentsFieldName: 'conflicts.fundingMessage', + commentsSubtitle: '', + commentsPlaceholder: + 'Please provide a statement describing how the research and publication of your article is funded', + subtitle: null, + commentsOn: 'no', + radioFieldName: 'conflicts.hasFunding', + radioLabel: 'Have you provided a funding statement in your manuscript?', + required: false, + }, + ], +}