Skip to content
Snippets Groups Projects
Commit cb3511f1 authored by Sebastian Mihalache's avatar Sebastian Mihalache
Browse files

Merge branch 'develop' of gitlab.coko.foundation:xpub/xpub-faraday into develop

parents 758e0497 6b412d88
No related branches found
No related tags found
1 merge request!10Sprint #12
......@@ -7,27 +7,27 @@ import styled, { css } from 'styled-components'
import {
th,
Menu,
ValidatedField,
Icon,
Button,
ErrorText,
Spinner,
ErrorText,
ValidatedField,
} from '@pubsweet/ui'
import { compose, withHandlers, withProps } from 'recompose'
import {
reduxForm,
isSubmitting,
change as changeForm,
getFormValues,
change as changeForm,
} from 'redux-form'
import AutosaveIndicator from 'pubsweet-component-wizard/src/components/AutosaveIndicator'
import {
uploadFile,
deleteFile,
getFileError,
getSignedUrl,
getRequestStatus,
getFileError,
} from 'pubsweet-components-faraday/src/redux/files'
import {
FileItem,
......@@ -35,8 +35,8 @@ import {
} from 'pubsweet-components-faraday/src/components/Files'
import {
ConfirmationModal,
withModal2,
ConfirmationModal,
} from 'pubsweet-component-modal/src/components'
import {
selectError,
......@@ -46,9 +46,9 @@ import {
} from 'pubsweet-components-faraday/src/redux/recommendations'
import {
parseReviewResponseToForm,
onReviewSubmit,
onReviewChange,
parseReviewResponseToForm,
} from './utils'
const guidelinesLink =
......
......@@ -87,6 +87,7 @@ const ReviewsAndReports = ({
<ReviewReportCard report={report} />
) : (
<ReviewerReportForm
modalKey={`review-${project.id}`}
project={project}
review={review}
version={version}
......
......@@ -4,7 +4,7 @@ import { connect } from 'react-redux'
import PropTypes from 'prop-types'
import { Button, Icon, th } from '@pubsweet/ui'
import styled, { css, withTheme } from 'styled-components'
import { compose, getContext, withHandlers } from 'recompose'
import { compose, getContext, withHandlers, withProps } from 'recompose'
import {
withModal,
ConfirmationModal,
......@@ -35,6 +35,7 @@ const DashboardCard = ({
showAbstractModal,
canInviteReviewers,
showConfirmationModal,
canMakeRecommendation,
...rest
}) => {
const { submitted, title, type } = parseVersion(version)
......@@ -59,7 +60,7 @@ const DashboardCard = ({
/>
</LeftDetails>
<RightDetails flex={2}>
{isHE && (
{canMakeRecommendation && (
<Recommendation
collectionId={project.id}
fragmentId={version.id}
......@@ -165,6 +166,16 @@ const DashboardCard = ({
) : null
}
const isHEToManuscript = (state, collectionId) => {
const currentUserId = get(state, 'currentUser.user.id')
const collection = state.collections.find(c => c.id === collectionId) || {}
const userInvitation = collection.invitations.find(
i => i.role === 'handlingEditor' && i.userId === currentUserId,
)
return userInvitation ? userInvitation.isAccepted : false
}
export default compose(
getContext({ journal: PropTypes.object, currentUser: PropTypes.object }),
withTheme,
......@@ -175,6 +186,11 @@ export default compose(
connect((state, { project }) => ({
isHE: currentUserIs(state, 'handlingEditor'),
invitation: selectInvitation(state, project.id),
isHEToManuscript: isHEToManuscript(state, project.id),
})),
withProps(({ isHEToManuscript, project }) => ({
canMakeRecommendation:
isHEToManuscript && get(project, 'status') === 'reviewCompleted',
})),
withHandlers({
canInviteReviewers: ({ currentUser, project }) => () => {
......
import React from 'react'
import { th } from '@pubsweet/ui'
import { connect } from 'react-redux'
import { selectFragment, selectCollection } from 'xpub-selectors'
import styled, { css } from 'styled-components'
import { compose, withHandlers } from 'recompose'
import { selectFragment, selectCollection } from 'xpub-selectors'
import { selectReviewers } from 'pubsweet-components-faraday/src/redux/reviewers'
const ReviewerBreakdown = ({
......@@ -58,7 +58,7 @@ export default compose(
<BreakdownText>
<b>{reviewers.length}</b> invited,
<b> {report.accepted}</b> agreed,
<b> {report.declined}</b> declined
<b> {report.declined}</b> declined,
<b> {report.submitted}</b> submitted
</BreakdownText>
)
......
......@@ -3,6 +3,7 @@ import { get } from 'lodash'
import { Icon } from '@pubsweet/ui'
import { connect } from 'react-redux'
import styled from 'styled-components'
import { actions } from 'pubsweet-client'
import { compose, withState, withHandlers } from 'recompose'
import { getFormValues, reset as resetForm } from 'redux-form'
......@@ -19,20 +20,20 @@ const RecommendWizard = ({
decision,
nextStep,
prevStep,
hideModal,
closeModal,
submitForm,
isFetching,
recommendationError,
...rest
}) => (
<FormItems.RootContainer>
<IconButton onClick={hideModal}>
<IconButton onClick={closeModal}>
<Icon primary>x</Icon>
</IconButton>
{step === 0 && (
<StepOne
disabled={!decision}
hideModal={hideModal}
hideModal={closeModal}
onSubmit={nextStep}
{...rest}
/>
......@@ -57,25 +58,32 @@ export default compose(
decision: get(getFormValues('recommendation')(state), 'decision'),
}),
{
createRecommendation,
resetForm,
createRecommendation,
getCollections: actions.getCollections,
},
),
withState('step', 'changeStep', 0),
withHandlers({
nextStep: ({ changeStep }) => () => changeStep(s => s + 1),
prevStep: ({ changeStep }) => () => changeStep(s => (s === 0 ? 0 : s - 1)),
closeModal: ({ hideModal, resetForm }) => () => {
hideModal()
resetForm('recommendation')
},
submitForm: ({
showModal,
hideModal,
resetForm,
fragmentId,
collectionId,
getCollections,
createRecommendation,
}) => values => {
const recommendation = utils.parseRecommendationValues(values)
createRecommendation(collectionId, fragmentId, recommendation).then(r => {
resetForm('recommendation')
getCollections()
showModal({
title: 'Recommendation sent',
})
......
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