diff --git a/new-lamassu-admin/src/pages/OperatorInfo/ContactInfo.js b/new-lamassu-admin/src/pages/OperatorInfo/ContactInfo.js index 802301f1..e1b68f21 100644 --- a/new-lamassu-admin/src/pages/OperatorInfo/ContactInfo.js +++ b/new-lamassu-admin/src/pages/OperatorInfo/ContactInfo.js @@ -128,7 +128,7 @@ const ContactInfo = ({ wizard }) => { phone: Yup.string(), email: Yup.string() .email('Please enter a valid email address') - .required(), + .required('An email is required'), website: Yup.string(), companyNumber: Yup.string() }) @@ -182,6 +182,9 @@ const ContactInfo = ({ wizard }) => { } } + const getErrorMsg = formikErrors => + !R.isNil(formikErrors.email) ? formikErrors.email : null + return ( <>
@@ -223,58 +226,67 @@ const ContactInfo = ({ wizard }) => { setEditing(false) setError(null) }}> -
- -
- setError(null)} - /> - setError(null)} - /> -
-
- setError(null)} - /> - setError(null)} - /> -
-
- setError(null)} - /> -
-
- {editing && ( - <> - - Save - - - Cancel - - {error && Failed to save changes} - + {({ errors }) => ( + + +
+ setError(null)} + /> + setError(null)} + /> +
+
+ setError(null)} + /> + setError(null)} + /> +
+
+ setError(null)} + /> +
+ {editing && !!getErrorMsg(errors) && ( + + {getErrorMsg(errors)} + )} -
- +
+ {editing && ( + <> + + Save + + + Cancel + + {error && ( + Failed to save changes + )} + + )} +
+ + )}
{!wizard && ( diff --git a/new-lamassu-admin/src/pages/OperatorInfo/OperatorInfo.styles.js b/new-lamassu-admin/src/pages/OperatorInfo/OperatorInfo.styles.js index 1cc0c3ba..9bdfe706 100644 --- a/new-lamassu-admin/src/pages/OperatorInfo/OperatorInfo.styles.js +++ b/new-lamassu-admin/src/pages/OperatorInfo/OperatorInfo.styles.js @@ -62,6 +62,9 @@ const global = { marginTop: 4, marginLeft: 16 } + }, + formErrorMsg: { + margin: [[0, 0, 20, 0]] } }