Skip to content
Snippets Groups Projects
Commit 32d62ef3 authored by Bogdan Cochior's avatar Bogdan Cochior
Browse files

feat(dashboard): hide customId till EQS passes

parent 3c28fcf6
No related branches found
No related tags found
2 merge requests!58Sprint #20 - Goal - Reviewers submit report,!45Hide manuscript ID on dashboard and thank you page until EQS approval
...@@ -162,3 +162,15 @@ export const getAdminUsers = state => ...@@ -162,3 +162,15 @@ export const getAdminUsers = state =>
.map(s => s.user) .map(s => s.user)
.reverse() .reverse()
.value() .value()
const hideCustomIdStatuses = ['draft', 'technicalChecks']
export const newestFirstParseCustomId = items =>
chain(items)
.orderBy(['created'], ['desc'])
.map(item => ({
...item,
customId:
!hideCustomIdStatuses.includes(get(item, 'status', 'draft')) &&
item.customId,
}))
.value()
...@@ -55,15 +55,20 @@ const ManuscriptCard = ({ ...@@ -55,15 +55,20 @@ const ManuscriptCard = ({
{customId && <Text customId mr={1}>{`ID ${customId}`}</Text>} {customId && <Text customId mr={1}>{`ID ${customId}`}</Text>}
{submitted && ( {submitted && (
<DateParser humanizeThreshold={0} timestamp={submitted}> <DateParser humanizeThreshold={0} timestamp={submitted}>
{timestamp => <Text mr={3}>Submitted on {timestamp}</Text>} {(timestamp, timeAgo) => (
<Text
mr={3}
>{`Submitted on ${timestamp} (${timeAgo} ago)`}</Text>
)}
</DateParser> </DateParser>
)} )}
<Text>{manuscriptType.label || type}</Text> <Text>{manuscriptType.label || type}</Text>
{journal && ( {journal &&
<Text journal ml={1}> (manuscriptType.label || type) && (
{journal} <Text journal ml={1}>
</Text> {journal}
)} </Text>
)}
</Row> </Row>
<Row alignItems="center" justify="flex-start" mb={1}> <Row alignItems="center" justify="flex-start" mb={1}>
<H4>Handling editor</H4> <H4>Handling editor</H4>
......
...@@ -23,6 +23,6 @@ const Dashboard = ({ ...@@ -23,6 +23,6 @@ const Dashboard = ({
export default compose( export default compose(
withProps(({ dashboard, filterItems }) => ({ withProps(({ dashboard, filterItems }) => ({
dashboardItems: filterItems(dashboard.all), dashboardItems: filterItems(dashboard),
})), })),
)(Dashboard) )(Dashboard)
...@@ -5,9 +5,12 @@ import { withJournal } from 'xpub-journal' ...@@ -5,9 +5,12 @@ import { withJournal } from 'xpub-journal'
import { ConnectPage } from 'xpub-connect' import { ConnectPage } from 'xpub-connect'
import { withRouter } from 'react-router-dom' import { withRouter } from 'react-router-dom'
import { compose, withContext } from 'recompose' import { compose, withContext } from 'recompose'
import { newestFirst, selectCurrentUser } from 'xpub-selectors' import { selectCurrentUser } from 'xpub-selectors'
import { getUserPermissions } from 'pubsweet-component-faraday-selectors' import {
getUserPermissions,
newestFirstParseCustomId,
} from 'pubsweet-component-faraday-selectors'
import { Dashboard } from './' import { Dashboard } from './'
import { priorityFilter, orderFilter, withFiltersHOC } from '../Filters' import { priorityFilter, orderFilter, withFiltersHOC } from '../Filters'
...@@ -18,24 +21,8 @@ export default compose( ...@@ -18,24 +21,8 @@ export default compose(
state => { state => {
const { collections, conversion } = state const { collections, conversion } = state
const currentUser = selectCurrentUser(state) const currentUser = selectCurrentUser(state)
const sortedCollections = newestFirst(collections) const dashboard = newestFirstParseCustomId(collections)
const dashboard = {
owner: sortedCollections.filter(
collection =>
collection.owners &&
collection.owners.some(owner => owner.id === currentUser.id),
),
reviewer: sortedCollections.filter(
collection =>
collection.reviewers &&
collection.reviewers.some(
reviewer => reviewer && reviewer.user === currentUser.id,
),
),
all: sortedCollections,
}
const userPermissions = getUserPermissions(state) const userPermissions = getUserPermissions(state)
return { return {
dashboard, dashboard,
......
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