From ea2a778728e5febaedc4c3df7bd516cb9c16c837 Mon Sep 17 00:00:00 2001
From: Bogdan Cochior <bogdan.cochior@thinslices.com>
Date: Mon, 24 Sep 2018 14:08:18 +0300
Subject: [PATCH] feat(authors): add default corresponding author

---
 .../component-faraday-ui/src/ManuscriptCard.js   |  5 ++++-
 .../component-faraday-ui/src/WizardAuthors.js    | 16 ++++++++++++++--
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/packages/component-faraday-ui/src/ManuscriptCard.js b/packages/component-faraday-ui/src/ManuscriptCard.js
index e9f0e796f..c7106cb06 100644
--- a/packages/component-faraday-ui/src/ManuscriptCard.js
+++ b/packages/component-faraday-ui/src/ManuscriptCard.js
@@ -72,7 +72,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 && (
@@ -139,6 +139,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 3d951ec7a..23a390618 100644
--- a/packages/component-faraday-ui/src/WizardAuthors.js
+++ b/packages/component-faraday-ui/src/WizardAuthors.js
@@ -23,8 +23,7 @@ const castToBool = author => ({
 
 const parseEditedAuthors = (editedAuthor, authors) => {
   const newAuthor = castToBool(editedAuthor)
-
-  return authors.map(
+  const newAuthors = authors.map(
     a =>
       a.id === newAuthor.id
         ? newAuthor
@@ -35,6 +34,19 @@ const parseEditedAuthors = (editedAuthor, authors) => {
               : a.isCorresponding,
           },
   )
+
+  const corresponding = newAuthors.find(a => a.isCorresponding)
+  return corresponding
+    ? newAuthors
+    : newAuthors.map(
+        a =>
+          a.isSubmitting
+            ? {
+                ...a,
+                isCorresponding: true,
+              }
+            : a,
+      )
 }
 
 const WizardAuthors = ({
-- 
GitLab