diff --git a/packages/component-dashboard/src/components/Dashboard.js b/packages/component-dashboard/src/components/Dashboard.js index 228e9261f61c2f06f3fab42361be520d7478b15a..acc01832a4664e0ef3f645a0a92a76285ffb18ee 100644 --- a/packages/component-dashboard/src/components/Dashboard.js +++ b/packages/component-dashboard/src/components/Dashboard.js @@ -56,15 +56,6 @@ const Dashboard = ({ </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 && ( <div className={classes.section}> <div className={classes.heading}>My Manuscripts</div> diff --git a/packages/component-dashboard/src/components/DashboardPage.js b/packages/component-dashboard/src/components/DashboardPage.js index d4c674cfe65747d6eec3e3702cc1e4b8aea96e0d..b2dcfe4fee6984b5a6fe89572dd107d6f1899d4a 100644 --- a/packages/component-dashboard/src/components/DashboardPage.js +++ b/packages/component-dashboard/src/components/DashboardPage.js @@ -33,27 +33,41 @@ export default compose( 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 = { - owner: sortedCollections - .filter(collection => collection.owners - && collection.owners.some(owner => owner.id === currentUser.id)), - assign: sortedCollections - .filter(collection => collection.status === 'submitted' - && !teams.some(team => - team.object.type === 'collection' - && team.object.id === collection.id - && team.teamType.name === 'handlingEditor' - )), - editor: newestFirst(teams - .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), + owner: sortedCollections.filter( + collection => + collection.owners && + collection.owners.some(owner => owner.id === currentUser.id) + ), + editor: newestFirst( + unassignedCollections + .concat(myCollections) + .filter( + (collection, index, items) => + items.findIndex(item => item.id === collection.id) === index + ) + ), // reviewer: newestFirst(teams // .filter(team => team.group === 'reviewer' // && team.object.type === 'collection'