Skip to content
Snippets Groups Projects
Commit 62e45441 authored by Tania Fecheta's avatar Tania Fecheta
Browse files

feat(authsome-mode): filter out manuscripts with deleted status

parents 1c079ba6 d8192034
No related branches found
No related tags found
3 merge requests!222Sprint #26,!217Sprint #26,!198Hin 1166 admin delete manuscript
...@@ -26,6 +26,7 @@ const ManuscriptCard = ({ ...@@ -26,6 +26,7 @@ const ManuscriptCard = ({
isAdmin, isAdmin,
isDraft, isDraft,
onDelete, onDelete,
isDeleted,
isFetching, isFetching,
deleteManuscript, deleteManuscript,
onCardClick, onCardClick,
...@@ -87,34 +88,56 @@ const ManuscriptCard = ({ ...@@ -87,34 +88,56 @@ const ManuscriptCard = ({
<ReviewerBreakdown fragment={fragment} label="Reviewer Reports" /> <ReviewerBreakdown fragment={fragment} label="Reviewer Reports" />
</Fragment> </Fragment>
)} )}
{isDraft && (
<Item justify="flex-end" onClick={e => e.stopPropagation()}>
<OpenModal
confirmText="Delete"
isFetching={isFetching}
modalKey={`delete-${collId}`}
onConfirm={onDelete}
title="Are you sure you want to delete this submission?"
>
{showModal => (
<ActionLink
height={16}
icon="trash"
onClick={showModal}
size="small"
>
Delete
</ActionLink>
)}
</OpenModal>
</Item>
)}
{isDraft && (
<Item justify="flex-end" onClick={e => e.stopPropagation()}>
<OpenModal
confirmText="Delete"
isFetching={isFetching}
modalKey={`delete-${collId}`}
onConfirm={onDelete}
title="Are you sure you want to delete this submission?"
>
{showModal => (
<ActionLink>
<DeleteIcon
fontIcon="deleteIcon"
onClick={showModal}
paddingBottom={2}
paddingRight={0}
size={1.6}
>
DELETE
</DeleteIcon>
</ActionLink>
)}
</OpenModal>
</Item>
)}
{isAdmin && {isAdmin &&
isDraft && ( !isDraft &&
<Item justify="flex-end" onClick={e => e.stopPropagation()}> !isDeleted && (
<OpenModal
confirmText="Delete"
isFetching={isFetching}
modalKey={`delete-${collId}`}
onConfirm={onDelete}
title="Are you sure you want to delete this submission?"
>
{showModal => (
<ActionLink>
<DeleteIcon
fontIcon="deleteIcon"
onClick={showModal}
paddingBottom={2}
paddingRight={0}
size={1.6}
>
DELETE
</DeleteIcon>
</ActionLink>
)}
</OpenModal>
</Item>
)}
{isAdmin &&
!isDraft && (
<Item justify="flex-end" onClick={e => e.stopPropagation()}> <Item justify="flex-end" onClick={e => e.stopPropagation()}>
<FormModal <FormModal
collectionId={collId} collectionId={collId}
...@@ -182,6 +205,7 @@ export default compose( ...@@ -182,6 +205,7 @@ export default compose(
t => t.value === get(metadata, 'type', ''), t => t.value === get(metadata, 'type', ''),
), ),
isDraft: status === 'draft', isDraft: status === 'draft',
isDeleted: status === 'deleted',
}), }),
), ),
setDisplayName('ManuscriptCard'), setDisplayName('ManuscriptCard'),
......
...@@ -46,9 +46,11 @@ export default compose( ...@@ -46,9 +46,11 @@ export default compose(
deleteCollection: actions.deleteCollection, deleteCollection: actions.deleteCollection,
}, },
), ),
shouldUpdate( shouldUpdate((props, nextProps) =>
(props, nextProps) => props.collections.some(
props.collections.length !== nextProps.collections.length, (collection, index) =>
collection.status !== nextProps.collections[index].status,
),
), ),
withRouter, withRouter,
withJournal, withJournal,
......
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