diff --git a/src/components/alerts/confirm.jsx b/src/components/alerts/confirm.jsx index 6f2a6b1..174a4e6 100644 --- a/src/components/alerts/confirm.jsx +++ b/src/components/alerts/confirm.jsx @@ -1,19 +1,25 @@ import Swal from 'sweetalert2'; -const Confirm = (title, cb, text = `You won't be able to revert this`, icon = 'warning', confirmBtnText = 'Save') => { - Swal.fire({ - title, - text, - icon, - showCancelButton: true, - confirmButtonColor: '#3085d6', - cancelButtonColor: '#d33', - confirmButtonText: confirmBtnText, - }).then((result) => { - if (result.isConfirmed) { - cb(true); - } - }) -} +const Confirm = ( + title, + cb, + text = `You won't be able to revert this`, + icon = 'warning', + confirmBtnText = 'Save', +) => { + Swal.fire({ + title, + text, + icon, + showCancelButton: true, + confirmButtonColor: '#3085d6', + cancelButtonColor: '#d33', + confirmButtonText: confirmBtnText, + }).then((result) => { + if (result.isConfirmed) { + cb(true); + } + }); +}; export default Confirm; diff --git a/src/components/alerts/index.jsx b/src/components/alerts/index.jsx index b510502..4872f2b 100644 --- a/src/components/alerts/index.jsx +++ b/src/components/alerts/index.jsx @@ -6,4 +6,12 @@ import ChainInput from './chaining'; import Confirm from './confirm'; import Toast from './toast'; -export { NotifyAlert, RequestStatus, TimerAlert, HTMLAlert, ChainInput, Confirm, Toast }; +export { + NotifyAlert, + RequestStatus, + TimerAlert, + HTMLAlert, + ChainInput, + Confirm, + Toast, +}; diff --git a/src/components/alerts/toast.jsx b/src/components/alerts/toast.jsx index a2d5759..f5cab8e 100644 --- a/src/components/alerts/toast.jsx +++ b/src/components/alerts/toast.jsx @@ -1,23 +1,21 @@ import toast, { Toaster } from 'react-hot-toast'; - - // const Toast = (toastMessage, toastType='success') => { // // toast[toastType](toastMessage); - + // toast('Here is your toast.'); // }; -import React from 'react' +import React from 'react'; const Toast = () => { - const notify = () => toast('Here is your toast.'); - return ( -
- {notify()} - -
- ) -} + const notify = () => toast('Here is your toast.'); + return ( +
+ {notify()} + +
+ ); +}; export default Toast; diff --git a/src/pages/private/admin/manageQuestions.jsx b/src/pages/private/admin/manageQuestions.jsx index 5a2ad7a..f3b9269 100644 --- a/src/pages/private/admin/manageQuestions.jsx +++ b/src/pages/private/admin/manageQuestions.jsx @@ -16,7 +16,9 @@ const ManageQuestions = () => { useEffect(() => { const fetchQuestions = async () => { try { - const { data } = await http.get(`${apiUrl}/${endPoints.slamBook.allQuestions}`); + const { data } = await http.get( + `${apiUrl}/${endPoints.slamBook.allQuestions}`, + ); setQuestions(data); setNoQuestions(false); } catch (ex) {} @@ -48,9 +50,12 @@ const ManageQuestions = () => { const originalQuestions = [...questions]; try { - const { data } = await http.post(`${apiUrl}/${endPoints.slamBook.createQuestion}`, { - title: previousInputValue, - }); + const { data } = await http.post( + `${apiUrl}/${endPoints.slamBook.createQuestion}`, + { + title: previousInputValue, + }, + ); NotifyAlert('Successfully added the question', 'top'); setQuestions([data, ...questions]); setNoQuestions(false); diff --git a/src/pages/private/admin/questions/listQuestion.jsx b/src/pages/private/admin/questions/listQuestion.jsx index 87a0a7b..c9b69cb 100644 --- a/src/pages/private/admin/questions/listQuestion.jsx +++ b/src/pages/private/admin/questions/listQuestion.jsx @@ -36,9 +36,7 @@ const ListQuestions = ({ onKeyDown={handleKeyPress} /> {inputValidationAlert.apply && ( - - {inputValidationAlert.message} - + {inputValidationAlert.message} )}
diff --git a/src/pages/private/user/index.jsx b/src/pages/private/user/index.jsx index d7a5ec6..75d8610 100644 --- a/src/pages/private/user/index.jsx +++ b/src/pages/private/user/index.jsx @@ -17,5 +17,5 @@ export { HomePage, LogOut, ResetPassword, - ModerateMessages + ModerateMessages, }; diff --git a/src/pages/private/user/messages/index.jsx b/src/pages/private/user/messages/index.jsx index 4342b61..d415461 100644 --- a/src/pages/private/user/messages/index.jsx +++ b/src/pages/private/user/messages/index.jsx @@ -30,7 +30,10 @@ class PeopleCards extends Component { persons, sections, departments, - people: persons && persons.length > 0 ? persons.sort((a, b) => a.userId - b.userId) : persons, + people: + persons && persons.length > 0 + ? persons.sort((a, b) => a.userId - b.userId) + : persons, ProgressBar: !this.state.ProgressBar, }); } @@ -43,9 +46,7 @@ class PeopleCards extends Component { filterPeople = (e) => { const people = this.state.persons.filter( (person) => - person.name - .toLowerCase() - .search(e.target.value.trim().toLowerCase()) !== -1, + person.name.toLowerCase().search(e.target.value.trim().toLowerCase()) !== -1, ); this.setState({ people, NoSearchResults: !people.length }); }; @@ -66,10 +67,7 @@ class PeopleCards extends Component { return this.setState({ people: persons.filter((e) => { if (sectionSelect !== 'ALL') { - return ( - e.department === input.value && - e.section === sectionSelect - ); + return e.department === input.value && e.section === sectionSelect; } return e.department === input.value; }), @@ -93,10 +91,7 @@ class PeopleCards extends Component { return this.setState({ people: persons.filter((e) => { if (departmentSelect !== 'ALL') { - return ( - e.section === input.value && - e.department === departmentSelect - ); + return e.section === input.value && e.department === departmentSelect; } return e.section === input.value; }), @@ -105,17 +100,12 @@ class PeopleCards extends Component { }; handleModalOpen = (isModalOpen) => { - this.setState({ ...this.state, isModalOpen }) - } + this.setState({ ...this.state, isModalOpen }); + }; render() { - const { - ProgressBar, - departments, - sections, - people, - NoSearchResults, - } = this.state; + const { ProgressBar, departments, sections, people, NoSearchResults } = + this.state; return ( <> diff --git a/src/pages/private/user/messages/modal.jsx b/src/pages/private/user/messages/modal.jsx index 6e5749d..7871f60 100644 --- a/src/pages/private/user/messages/modal.jsx +++ b/src/pages/private/user/messages/modal.jsx @@ -12,15 +12,22 @@ import { apiUrl, endPoints } from '../../../../config.json'; import http from '../../../../services/httpService'; import { NotifyAlert, TimerAlert } from '../../../../components'; -const ModalBox = ({ personId, personName, toggleOpen, triggerModal, modalValue, isAnonymousMessage }) => { +const ModalBox = ({ + personId, + personName, + toggleOpen, + triggerModal, + modalValue, + isAnonymousMessage, +}) => { const [ModalValue, setModalValue] = useState(() => modalValue); const [isAnonymous, setIsAnonymous] = useState(() => isAnonymousMessage); - console.log('isAnonymousMessage...', isAnonymousMessage) + console.log('isAnonymousMessage...', isAnonymousMessage); useEffect(() => { - setModalValue(modalValue) - }, [modalValue]) + setModalValue(modalValue); + }, [modalValue]); // useEffect(() => { // setIsAnonymous(); @@ -38,7 +45,7 @@ const ModalBox = ({ personId, personName, toggleOpen, triggerModal, modalValue, `${apiUrl}/${endPoints.messages.new}`, messageObject, ); - console.log('data...', data) + console.log('data...', data); setModalValue(data.message); TimerAlert('Message sent successfully'); triggerModal(personId); @@ -62,9 +69,7 @@ const ModalBox = ({ personId, personName, toggleOpen, triggerModal, modalValue,
-

- Write a nice message for {personName} :) -

+

Write a nice message for {personName} :)