diff --git a/src/components/Announcements/index.jsx b/src/components/Announcements/index.jsx index 836efab263..005e0fafb7 100644 --- a/src/components/Announcements/index.jsx +++ b/src/components/Announcements/index.jsx @@ -6,7 +6,7 @@ import { sendEmail, broadcastEmailsToAll } from '../../actions/sendEmails'; import { boxStyle, boxStyleDark } from 'styles'; import { toast } from 'react-toastify'; -function Announcements({title, email}) { +function Announcements({ title, email }) { const darkMode = useSelector(state => state.theme.darkMode); const dispatch = useDispatch(); const [emailTo, setEmailTo] = useState(''); @@ -47,11 +47,11 @@ function Announcements({title, email}) { once you do not need it anymore. */ - input.onchange = function() { + input.onchange = function () { const file = this.files[0]; const reader = new FileReader(); - reader.onload = function() { + reader.onload = function () { /* Note: Now we need to register the blob in TinyMCEs image blob registry. In the next release this part hopefully won't be @@ -89,8 +89,9 @@ function Announcements({title, email}) { }, [email]); const handleEmailListChange = e => { - const emails = e.target.value.split(','); - setEmailList(emails); + const value = e.target.value; + setEmailTo(value); // Update emailTo for the input field + setEmailList(value.split(',')); // Update emailList for the email list }; const handleHeaderContentChange = e => { @@ -101,14 +102,14 @@ function Announcements({title, email}) { const addHeaderToEmailContent = () => { if (!headerContent) return; const imageTag = `Header Image`; - const editor = tinymce.get('email-editor'); - if (editor) { - editor.insertContent(imageTag); - setEmailContent(editor.getContent()); - } - setHeaderContent(''); // Clear the input field after inserting the header + const editor = tinymce.get('email-editor'); + if (editor) { + editor.insertContent(imageTag); + setEmailContent(editor.getContent()); + } + setHeaderContent(''); // Clear the input field after inserting the header }; - + const convertImageToBase64 = (file, callback) => { const reader = new FileReader(); reader.onloadend = () => { @@ -166,13 +167,13 @@ function Announcements({title, email}) { }; return ( -
+
- { title ? ( + {title ? (

{title}

) - :(

Weekly Progress Editor

) + : (

Weekly Progress Editor

) }
@@ -185,69 +186,75 @@ function Announcements({title, email}) { setEmailContent(content); }} />} - { - title ? ( - "" - ) : ( - - ) - } - -
-
{ title ? ( -

Email

+ "" ) : ( - - + ) } - -
+
{ title ? ( - "Send Email" +

Email

) : ( - "Send mail to specific users" + + ) } + + + - -
- - - - -
- - - -
-
+ +
+ + + + +
+ + +
- +
+ + ); }