Skip to content
Snippets Groups Projects
Commit bd674da3 authored by Alexandru Munteanu's avatar Alexandru Munteanu
Browse files

feat(dashboard-card): new statuses on FE

parent e0045d67
No related branches found
No related tags found
1 merge request!6Agree/Decline to work on a manuscript
......@@ -34,7 +34,6 @@ const DashboardCard = ({
...rest
}) => {
const { submitted, title, type } = parseVersion(version)
const status = get(project, 'status')
const metadata = get(version, 'metadata')
const files = get(version, 'files')
const customId = project.customId || project.id.split('-')[0]
......@@ -81,7 +80,7 @@ const DashboardCard = ({
</Top>
<Bottom>
<LeftDetails flex="3">
<Status>{mapStatusToLabel(status)}</Status>
<Status>{mapStatusToLabel(project)}</Status>
<DateField>{submitted || ''}</DateField>
</LeftDetails>
<RightDetails flex="4">
......@@ -197,22 +196,22 @@ export default compose(
// this can be changed, but it works; cba
if (isAdmin || isEic) {
if (status === 'submitted' || status === 'he-invited')
if (status === 'submitted' || status === 'heInvited')
return <EditorInChiefActions project={project} />
if (status === 'under-review')
if (status === 'underReview')
return <AssignedHE>{get(handlingEditor, 'name')}</AssignedHE>
return <div />
}
if (isHe) {
if (status === 'he-invited')
if (status === 'heInvited')
return (
<HandlingEditorActions
currentUser={currentUser}
project={project}
/>
)
if (status === 'under-review')
if (status === 'underReview' || status === 'heAssigned')
return <AssignedHE>{get(handlingEditor, 'name')}</AssignedHE>
}
},
......
import moment from 'moment'
import { get, find } from 'lodash'
import { get, find, capitalize } from 'lodash'
export const parseTitle = version => {
const title = get(version, 'metadata.title')
......@@ -43,7 +43,7 @@ export const parseVersion = version => ({
export const parseJournalIssue = (journal, metadata) =>
journal.issueTypes.find(t => t.value === get(metadata, 'issue'))
export const mapStatusToLabel = status => {
export const mapStatusToLabel2 = status => {
switch (status) {
case 'he-invited':
return 'Handling Editor Assigned'
......@@ -56,6 +56,15 @@ export const mapStatusToLabel = status => {
}
}
export const mapStatusToLabel = ({ visibleStatus, status }) => {
if (visibleStatus) {
return visibleStatus
} else if (status) {
return capitalize(status)
}
return 'Draft'
}
export const handleError = fn => e => {
fn(get(JSON.parse(e.response), 'error') || 'Oops! Something went wrong!')
}
......
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