Skip to content
Snippets Groups Projects
Commit 026ef0ce authored by Yannis Barlas's avatar Yannis Barlas
Browse files

Merge branch '71-combine-dashboard-sections' into 'master'

Merge "My Manuscripts" and "Assign"

Closes #71

See merge request xpub!56
parents e31e8032 4091d596
No related branches found
No related tags found
No related merge requests found
...@@ -56,15 +56,6 @@ const Dashboard = ({ ...@@ -56,15 +56,6 @@ const Dashboard = ({
</div> </div>
)} )}
{!!dashboard.assign.length && (
<div className={classes.section}>
<div className={classes.heading}>Assign</div>
{dashboard.assign.map(project => (
<EditorItemWithVersion key={project.id} project={project} AssignEditor={AssignEditor} />
))}
</div>
)}
{!!dashboard.editor.length && ( {!!dashboard.editor.length && (
<div className={classes.section}> <div className={classes.section}>
<div className={classes.heading}>My Manuscripts</div> <div className={classes.heading}>My Manuscripts</div>
......
...@@ -33,27 +33,41 @@ export default compose( ...@@ -33,27 +33,41 @@ export default compose(
const sortedCollections = newestFirst(collections) const sortedCollections = newestFirst(collections)
const unassignedCollections = sortedCollections.filter(
collection =>
collection.status === 'submitted' &&
!teams.some(
team =>
team.object.type === 'collection' &&
team.object.id === collection.id &&
team.teamType.name === 'handlingEditor'
)
)
const myCollections = teams
.filter(
team =>
team.group === 'editor' &&
team.object.type === 'collection' &&
team.members.includes(currentUser.id)
)
.map(team =>
collections.find(collection => collection.id === team.object.id)
)
const dashboard = { const dashboard = {
owner: sortedCollections owner: sortedCollections.filter(
.filter(collection => collection.owners collection =>
&& collection.owners.some(owner => owner.id === currentUser.id)), collection.owners &&
assign: sortedCollections collection.owners.some(owner => owner.id === currentUser.id)
.filter(collection => collection.status === 'submitted' ),
&& !teams.some(team => editor: newestFirst(
team.object.type === 'collection' unassignedCollections
&& team.object.id === collection.id .concat(myCollections)
&& team.teamType.name === 'handlingEditor' .filter(
)), (collection, index, items) =>
editor: newestFirst(teams items.findIndex(item => item.id === collection.id) === index
.filter(team => team.group === 'editor' )
&& team.object.type === 'collection' ),
&& team.members.includes(currentUser.id))
.map(team => team.object.id)
.filter((id, index, items) => items.indexOf(id) === index) // unique
.map(id => collections.find(
collection => collection.id === id
)))
.filter(collection => collection),
// reviewer: newestFirst(teams // reviewer: newestFirst(teams
// .filter(team => team.group === 'reviewer' // .filter(team => team.group === 'reviewer'
// && team.object.type === 'collection' // && team.object.type === 'collection'
......
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