Skip to content
Snippets Groups Projects
Commit b41eee1f authored by Bogdan Cochior's avatar Bogdan Cochior
Browse files

Merge branch 'hindawi-theme' of https://gitlab.coko.foundation/xpub/xpub-faraday into hindawi-theme

parents eb3bea2b 8972079b
No related branches found
No related tags found
1 merge request!43Sprint #19
...@@ -2,20 +2,32 @@ import React from 'react' ...@@ -2,20 +2,32 @@ import React from 'react'
import { get } from 'lodash' import { get } from 'lodash'
import { Field } from 'redux-form' import { Field } from 'redux-form'
import styled from 'styled-components' import styled from 'styled-components'
import { required as requiredValidator } from 'xpub-validators'
import { ValidatedField, YesOrNo } from '@pubsweet/ui' 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 = ({ const RadioWithComments = ({
required, required,
subtitle,
radioLabel, radioLabel,
formValues, formValues,
commentsOn, commentsOn,
commentsLabel,
radioFieldName, radioFieldName,
tooltipContent, tooltipContent,
commentsSubtitle,
commentsFieldName, commentsFieldName,
commentsPlaceholder,
...rest ...rest
}) => ( }) => (
<Root {...rest}> <Root {...rest}>
...@@ -36,16 +48,24 @@ const RadioWithComments = ({ ...@@ -36,16 +48,24 @@ const RadioWithComments = ({
</Row> </Row>
{get(formValues, radioFieldName, '') === commentsOn && ( {get(formValues, radioFieldName, '') === commentsOn && (
<Row alignItems="center" justify="flex-start"> <RowOverrideAlert alignItems="center" justify="flex-start">
<Item data-test="submission-conflicts-text" vertical> <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 <ValidatedField
component={Textarea} component={Textarea}
name={commentsFieldName} name={commentsFieldName}
placeholder={commentsPlaceholder}
validate={required ? [requiredValidator] : []} validate={required ? [requiredValidator] : []}
/> />
</Item> </Item>
</Row> </RowOverrideAlert>
)} )}
</Root> </Root>
) )
......
...@@ -2,6 +2,7 @@ import React, { Fragment } from 'react' ...@@ -2,6 +2,7 @@ import React, { Fragment } from 'react'
import { get } from 'lodash' import { get } from 'lodash'
import { Field } from 'redux-form' import { Field } from 'redux-form'
import { required } from 'xpub-validators' import { required } from 'xpub-validators'
import { withHandlers } from 'recompose'
import { import {
Row, Row,
Text, Text,
...@@ -27,6 +28,8 @@ const StepTwo = ({ ...@@ -27,6 +28,8 @@ const StepTwo = ({
formValues, formValues,
authorsError, authorsError,
manuscriptTypes, manuscriptTypes,
getTooltipContent,
journal: { submission: { questions = [] } },
...rest ...rest
}) => ( }) => (
<Fragment> <Fragment>
...@@ -89,38 +92,31 @@ const StepTwo = ({ ...@@ -89,38 +92,31 @@ const StepTwo = ({
version={version} version={version}
/> />
<RadioWithComments {questions.map(q => (
commentsFieldName="conflicts.message" <RadioWithComments
commentsLabel="Conflict of interest details" formValues={formValues}
commentsOn="yes" key={q.id}
formValues={formValues} tooltipContent={getTooltipContent(q.id)}
radioFieldName="conflicts.hasConflicts" {...q}
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}
/>
</Fragment> </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 = () => ( const ConflictsTooltip = () => (
<Text secondary> <Text secondary>
......
...@@ -69,7 +69,11 @@ const Wizard = ({ ...@@ -69,7 +69,11 @@ const Wizard = ({
</Steps> </Steps>
<StepRoot className="wizard-step" step={step}> <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}> <Row justify="center" mt={2}>
{(isAuthorsFetching || isFilesFetching) && isLastStep ? ( {(isAuthorsFetching || isFilesFetching) && isLastStep ? (
<Spinner /> <Spinner />
......
...@@ -11,3 +11,4 @@ export { default as articleSections } from './article-sections-tbrm' ...@@ -11,3 +11,4 @@ export { default as articleSections } from './article-sections-tbrm'
export { default as manuscriptTypes } from './manuscript-types' export { default as manuscriptTypes } from './manuscript-types'
export { default as title } from './title' export { default as title } from './title'
export { default as wizard } from './wizard' export { default as wizard } from './wizard'
export { default as submission } from './submission'
export default { export default {
issn: '2474-7394', issn: '2474-7394',
logo: '/assets/logo-hindawi@2x.png', logo: '/assets/logo-hindawi@2x.png',
nameText: 'Faraday Journal', nameText: 'Bioinorganic Chemistry and Applications',
email: 'faraday@hindawi.com', email: 'faraday@hindawi.com',
mts: { mts: {
doctype: 'article SYSTEM "JATS-archivearticle1-mathml3.dtd"', doctype: 'article SYSTEM "JATS-archivearticle1-mathml3.dtd"',
......
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,
},
],
}
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