diff --git a/src/features/Classes/EnrollStudent/index.jsx b/src/features/Classes/EnrollStudent/index.jsx index a858926..6ff58db 100644 --- a/src/features/Classes/EnrollStudent/index.jsx +++ b/src/features/Classes/EnrollStudent/index.jsx @@ -49,8 +49,8 @@ const EnrollStudent = ({ isOpen, onClose, queryClassId }) => { const response = await handleEnrollments(formData, queryClassId); const validationEmailList = response?.data?.results; const messages = await getMessages(); - let validEmails = []; - let invalidEmails = []; + const validEmails = []; + const invalidEmails = []; let textToast = ''; /** @@ -65,26 +65,19 @@ const EnrollStudent = ({ isOpen, onClose, queryClassId }) => { return onClose(); } - validationEmailList.map(email => { - if (email?.invalidIdentifier) { - invalidEmails = [ - ...invalidEmails, - email.identifier, - ]; - return invalidEmails; - } - validEmails = [ - ...validEmails, - email.identifier, - ]; - return validEmails; + validationEmailList.forEach(({ invalidIdentifier, identifier }) => { + (invalidIdentifier ? invalidEmails : validEmails).push(identifier); }); if (invalidEmails.length > 0) { - textToast = `The following email adresses are invalid: ${invalidEmails.join(' ')}\n`; + textToast = `The following email ${invalidEmails.length === 1 + ? 'adress is invalid' + : 'adresses are invalid'}:\n${invalidEmails.join('\n')}\n`; } if (validEmails.length > 0) { - textToast += `Successfully enrolled and sent email to the following users: ${validEmails.join(' ')}`; + textToast += `Successfully enrolled and sent email to the following ${validEmails.length === 1 + ? 'user' + : 'users'}:\n${validEmails.join('\n')}`; } setToastMessage(textToast); diff --git a/src/features/Classes/EnrollStudent/index.scss b/src/features/Classes/EnrollStudent/index.scss index fadadf3..dbea593 100644 --- a/src/features/Classes/EnrollStudent/index.scss +++ b/src/features/Classes/EnrollStudent/index.scss @@ -11,6 +11,10 @@ .student-email .pgn__form-control-floating-label { display: block; } + + .student-email .form-control { + height: 44px; + } } .toast-message {