diff --git a/packages/components-faraday/src/components/Dashboard/DashboardCard.js b/packages/components-faraday/src/components/Dashboard/DashboardCard.js index 4ca60c5e200cde074f91dc85f7cf438ab127e8ac..d95dc0c258b2bef26cec1de6e0b5ea6d15286e9d 100644 --- a/packages/components-faraday/src/components/Dashboard/DashboardCard.js +++ b/packages/components-faraday/src/components/Dashboard/DashboardCard.js @@ -24,6 +24,7 @@ const DashboardCard = ({ showConfirmationModal, theme, currentUser, + renderHandlingEditorRow, ...rest }) => { const { submitted, title, type } = parseVersion(version) @@ -137,14 +138,7 @@ const DashboardCard = ({ <Bottom> <LeftDetails flex="5"> <HEText>Handling Editor</HEText> - {get(currentUser, 'admin') || - (get(currentUser, 'editorInChief') && ( - <EditorInChiefActions project={project} /> - ))} - {get(currentUser, 'handlingEditor') && - status === 'he-invited' && ( - <HandlingEditorActions project={project} /> - )} + {renderHandlingEditorRow()} </LeftDetails> </Bottom> </DetailsView> @@ -161,6 +155,30 @@ export default compose( modalComponent: ConfirmationModal, }), withHandlers({ + renderHandlingEditorRow: ({ currentUser, project }) => () => { + const status = get(project, 'status') || 'draft' + const isAdmin = get(currentUser, 'admin') + const isEic = get(currentUser, 'editorInChief') + const isHe = get(currentUser, 'handlingEditor') + const assignedPeople = get(project, 'assignedPeople') + const assignedHE = + assignedPeople && assignedPeople.find(p => p.role === 'handlingEditor') + + if (isAdmin || isEic) { + if (status === 'submitted' || status === 'he-invited') + return <EditorInChiefActions project={project} /> + if (status === 'under-review') + return <AssignedHE>{get(assignedHE, 'name')}</AssignedHE> + return <div>bine bulanes</div> + } + + if (isHe) { + if (status === 'he-invited') + return <HandlingEditorActions project={project} /> + if (status === 'under-review') + return <AssignedHE>{get(assignedHE, 'name')}</AssignedHE> + } + }, showConfirmationModal: ({ deleteProject, showModal, @@ -191,6 +209,12 @@ const defaultText = css` font-size: ${th('fontSizeBaseSmall')}; ` +const AssignedHE = styled.span` + ${defaultText}; + margin-left: calc(${th('subGridUnit')} * 3); + text-decoration: underline; +` + const AuthorList = styled.span` ${defaultText}; text-align: left; diff --git a/packages/components-faraday/src/components/Dashboard/HandlingEditorActions.js b/packages/components-faraday/src/components/Dashboard/HandlingEditorActions.js index f66b955c4f08fec403d918ff1cefad02c76f57c2..6da2664f874eb242c1bc33273fe058b9fd0972d0 100644 --- a/packages/components-faraday/src/components/Dashboard/HandlingEditorActions.js +++ b/packages/components-faraday/src/components/Dashboard/HandlingEditorActions.js @@ -89,7 +89,7 @@ export default compose( title: 'Decline handling editor role', subtitle: `Clicking "Agree" will assign you as Handling Editor for this Manuscript.`, onConfirm: reason => () => { - handlingEditorDecision(project.id, true, reason).then(() => { + handlingEditorDecision(project.id, false, reason).then(() => { updateCollection({ id: project.id, status: 'submitted', @@ -128,6 +128,7 @@ const DeclineRoot = styled.div` & textarea { height: 100%; + padding: calc(${th('subGridUnit')} * 2); width: 100%; } diff --git a/packages/components-faraday/src/components/Dashboard/utils.js b/packages/components-faraday/src/components/Dashboard/utils.js index b8b45dcb7617db0fbf05553a048ac8c71794b494..3e0bc448f84242dd9068eb96f5c42f095938990b 100644 --- a/packages/components-faraday/src/components/Dashboard/utils.js +++ b/packages/components-faraday/src/components/Dashboard/utils.js @@ -81,6 +81,8 @@ export const mapStatusToLabel = status => { return 'Handling Editor Invited' case 'submitted': return 'Submitted' + case 'under-review': + return 'Under review' default: return 'Draft' }