Skip to content
Snippets Groups Projects
StepTwo.js 3.98 KiB
Newer Older
import React, { Fragment } from 'react'
import { get } from 'lodash'
import { Field } from 'redux-form'
import { required } from 'xpub-validators'
import { withHandlers } from 'recompose'
  RowOverrideAlert,
  ItemOverrideAlert,
} from 'pubsweet-component-faraday-ui'
import { H2, Menu, TextField, ValidatedField } from '@pubsweet/ui'

import { Empty } from './'

const StepTwo = ({
  authorsError,
  journal: { submission: { questions = [] } },
    <Row alignItems="center" mb={1}>
      <H2>2. Manuscript & Author Details</H2>
    </Row>
    <Row mb={3}>
      <Text align="center" secondary>
        Please provide the details of all the authors of this manuscript, in the
        order that they appear on the manuscript. Your details have been
        prefilled as the submitting author.
      <Item data-test-id="submission-title" flex={3} mr={1} vertical>
        <Label required>MANUSCRIPT TITLE</Label>
        <ValidatedField
          component={TextField}
          name="metadata.title"
          validate={[required]}
        />
      <ItemOverrideAlert data-test-id="submission-type" vertical>
        <Label required>MANUSCRIPT TYPE</Label>
          component={input => (
            <Menu
              options={manuscriptTypes}
              {...input}
              placeholder="Please select"
            />
          )}
          name="metadata.type"
          validate={[required]}
        />
      </ItemOverrideAlert>
    <RowOverrideAlert mb={2}>
      <Item data-test-id="submission-abstract" vertical>
        <Label required>ABSTRACT</Label>
          component={Textarea}
          minHeight={15}
          name="metadata.abstract"
          validate={[required]}
        />
    </RowOverrideAlert>
    <Field component={Empty} name="authors" />
    <WizardAuthors
      addAuthor={addAuthor}
      changeForm={changeForm}
      error={authorsError}
      isAuthorEdit={isAuthorEdit}
      isAuthorsFetching={isAuthorsFetching}
      onAuthorEdit={setAuthorEditIndex}
    {questions.map(q => (
      <RadioWithComments
        formValues={formValues}
        key={q.id}
        tooltipContent={getTooltipContent(q.id)}
        {...q}
      />
    ))}
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 = () => (
    When an author, editor, or reviewer has a financial/personal interest or
    belief that could affect his/her objectivity, or inappropriately influence
    his/her actions, a potential conflict of interest exists.{' '}
    <ActionLink to="https://www.hindawi.com/editors/coi/">More info</ActionLink>
  </Text>
const DataAvailabilityTooltip = () => (
  <Text>
    Statement about where data supporting the results reported in a published
    article can be found, including, where applicable, hyperlinks to publicly
    archived datasets analysed or generated during the study.
  </Text>
)
const FundingTooltip = () => (
  <Text>
    Statement about how the research and publication of an article is funded,
    naming each financially supporting body followed by any associated grant
    numbers in square brackets.
  </Text>
)