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

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

parents f15294d8 9ac14acd
No related branches found
No related tags found
1 merge request!6Agree/Decline to work on a manuscript
......@@ -12,12 +12,7 @@ import {
import ZipFiles from './ZipFiles'
import { InviteReviewers } from '../Reviewers/'
import { parseVersion, parseJournalIssue, mapStatusToLabel } from './../utils'
import {
EditorInChiefActions,
HandlingEditorActions,
AuthorTooltip,
ReviewerDecision,
} from './'
import { AuthorTooltip, ReviewerDecision, HandlingEditorSection } from './'
const DashboardCard = ({
deleteProject,
......@@ -29,7 +24,6 @@ const DashboardCard = ({
showConfirmationModal,
theme,
currentUser,
renderHandlingEditorRow,
canInviteReviewers,
...rest
}) => {
......@@ -151,8 +145,10 @@ const DashboardCard = ({
</Top>
<Bottom>
<LeftDetails flex="5">
<HEText>Handling Editor</HEText>
{renderHandlingEditorRow()}
<HandlingEditorSection
currentUser={currentUser}
project={project}
/>
</LeftDetails>
{canInviteReviewers() && (
<InviteReviewers
......@@ -187,34 +183,6 @@ export default compose(
const isAccepted = get(handlingEditor, 'isAccepted')
return (isAdmin || isEic || isHe) && isAccepted
},
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 handlingEditor = get(project, 'handlingEditor')
// this can be changed, but it works; cba
if (isAdmin || isEic) {
if (status === 'submitted' || status === 'heInvited')
return <EditorInChiefActions project={project} />
if (status === 'underReview')
return <AssignedHE>{get(handlingEditor, 'name')}</AssignedHE>
return <div />
}
if (isHe) {
if (status === 'heInvited')
return (
<HandlingEditorActions
currentUser={currentUser}
project={project}
/>
)
if (status === 'underReview' || status === 'heAssigned')
return <AssignedHE>{get(handlingEditor, 'name')}</AssignedHE>
}
},
showConfirmationModal: ({
deleteProject,
showModal,
......@@ -245,12 +213,6 @@ 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;
......@@ -418,9 +380,4 @@ const DateField = styled.span`
text-align: left;
`
const HEText = styled.div`
${defaultText};
text-transform: uppercase;
`
// #endregion
......@@ -116,7 +116,7 @@ const DecisionButton = styled(Button)`
${defaultText};
align-items: center;
color: ${({ primary }) =>
primary ? th('colorTextReverse') : th('colorPrimary')});
primary ? th('colorTextReverse') : th('colorPrimary')};
background-color: ${({ primary }) =>
primary ? th('colorPrimary') : th('backgroundColorReverse')};
height: calc(${th('subGridUnit')}*5);
......
import React from 'react'
import { th } from '@pubsweet/ui'
import { get } from 'lodash'
import styled, { css } from 'styled-components'
import { EditorInChiefActions, HandlingEditorActions } from './'
const renderHE = (currentUser, project) => {
const status = get(project, 'status') || 'draft'
const isAdmin = get(currentUser, 'admin')
const isEic = get(currentUser, 'editorInChief')
const isHe = get(currentUser, 'handlingEditor')
const handlingEditor = get(project, 'handlingEditor')
const eicActionsStatuses = ['submitted', 'heInvited']
const heActionsStatuses = ['heInvited']
if ((isAdmin || isEic) && eicActionsStatuses.includes(status)) {
return <EditorInChiefActions project={project} />
}
if (isHe && heActionsStatuses.includes(status)) {
return <HandlingEditorActions currentUser={currentUser} project={project} />
}
return <AssignedHE>{get(handlingEditor, 'name')}</AssignedHE>
}
const HandlingEditorSection = ({ currentUser, project }) => (
<Root>
<HEText>Handling Editor</HEText>
{renderHE(currentUser, project)}
</Root>
)
export default HandlingEditorSection
// #region styled-components
const defaultText = css`
color: ${th('colorText')};
font-family: ${th('fontReading')};
font-size: ${th('fontSizeBaseSmall')};
`
const Root = styled.div`
display: flex;
`
const HEText = styled.div`
${defaultText};
text-transform: uppercase;
`
const AssignedHE = styled.span`
${defaultText};
margin-left: calc(${th('subGridUnit')} * 3);
text-decoration: underline;
`
// #endregion
......@@ -4,5 +4,6 @@ export { default as AuthorTooltip } from './AuthorTooltip'
export { default as ReviewerDecision } from './ReviewerDecision'
export { default as EditorInChiefActions } from './EditorInChiefActions'
export { default as HandlingEditorActions } from './HandlingEditorActions'
export { default as HandlingEditorSection } from './HandlingEditorSection'
export default DashboardPage
......@@ -92,11 +92,11 @@ module.exports = {
},
heInvited: {
public: 'Submitted',
private: 'HE Invited',
private: 'Handling Editor Invited',
},
heAssigned: {
public: 'HE Assigned',
private: 'HE Assigned',
public: 'Handling Editor Assigned',
private: 'Handling Editor Assigned',
},
reviewersInvited: {
public: 'Reviewers Invited',
......
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