diff --git a/packages/component-faraday-selectors/src/index.js b/packages/component-faraday-selectors/src/index.js index 5acb64f2ceef380248c7ff7a478ede58e9cc60a6..6c9ebc9280edf6b774437264c1fce3a5324f7245 100644 --- a/packages/component-faraday-selectors/src/index.js +++ b/packages/component-faraday-selectors/src/index.js @@ -199,7 +199,7 @@ const parseInvitedHE = (handlingEditor, state, collectionId) => const hideCustomIdStatuses = ['draft', 'technicalChecks'] -export const parseCollectionDetails = (state, collection) => ({ +export const parseCollectionDetails = (state, collection = {}) => ({ ...collection, customId: !hideCustomIdStatuses.includes(get(collection, 'status', 'draft')) && diff --git a/packages/component-faraday-ui/src/ManuscriptCard.js b/packages/component-faraday-ui/src/ManuscriptCard.js index 095e959e26d78489305ac9c569adf17342656e72..eb945229f9b95c6a40c807cc07301661dafb8555 100644 --- a/packages/component-faraday-ui/src/ManuscriptCard.js +++ b/packages/component-faraday-ui/src/ManuscriptCard.js @@ -73,7 +73,7 @@ const ManuscriptCard = ({ </Row> <Row alignItems="center" justify="flex-start" mb={1}> <H4>Handling editor</H4> - <Text ml={1} mr={3}> + <Text ml={1} mr={3} whiteSpace="nowrap"> {get(handlingEditor, 'name', 'Unassigned')} </Text> {handlingEditor && ( @@ -143,6 +143,9 @@ const MainContainer = styled.div` [data-tooltipped] { overflow: hidden; } + ${H4} { + white-space: nowrap; + } ${H3} { margin-bottom: 0; text-overflow: ellipsis; diff --git a/packages/component-faraday-ui/src/WizardAuthors.js b/packages/component-faraday-ui/src/WizardAuthors.js index 3be5cad89501e670032295e0efa1937d704af0f7..7b283d24311f9906193b4a01b902da8f7d05cb87 100644 --- a/packages/component-faraday-ui/src/WizardAuthors.js +++ b/packages/component-faraday-ui/src/WizardAuthors.js @@ -21,10 +21,24 @@ const castToBool = author => ({ isCorresponding: isBoolean(author.isCorresponding) && author.isCorresponding, }) +const setCorrespondingAuthor = authors => { + const corresponding = authors.find(a => a.isCorresponding) + return corresponding + ? authors + : authors.map( + a => + a.isSubmitting + ? { + ...a, + isCorresponding: true, + } + : a, + ) +} + const parseEditedAuthors = (editedAuthor, authors) => { const newAuthor = castToBool(editedAuthor) - - return authors.map( + const newAuthors = authors.map( a => a.id === newAuthor.id ? newAuthor @@ -35,6 +49,8 @@ const parseEditedAuthors = (editedAuthor, authors) => { : a.isCorresponding, }, ) + + return setCorrespondingAuthor(newAuthors) } const WizardAuthors = ({ @@ -156,7 +172,10 @@ export default compose( }) => author => ({ hideModal, setModalError }) => deleteAuthor(project.id, version.id, author.id) .then(() => { - setFormAuthors(authors.filter(a => a.id !== author.id)) + const newAuthors = setCorrespondingAuthor( + authors.filter(a => a.id !== author.id), + ) + setFormAuthors(newAuthors) hideModal() }) .catch(() => { diff --git a/packages/component-invite/src/routes/collectionsInvitations/post.js b/packages/component-invite/src/routes/collectionsInvitations/post.js index bdd0db7c4cc591eb063a1d4a5aac3fc5449198b0..620e45bd870e09ecd7a5cf210f5a683d185075ea 100644 --- a/packages/component-invite/src/routes/collectionsInvitations/post.js +++ b/packages/component-invite/src/routes/collectionsInvitations/post.js @@ -52,7 +52,7 @@ module.exports = models => async (req, res) => { }) // check collection status - if (collection.status !== 'submitted') { + if (!['submitted', 'heInvited'].includes(collection.status)) { return res.status(400).json({ error: `Cannot invite HE while collection is in the status: ${ collection.status