diff --git a/src/pages/Admin/components/Challenges/Challenges.tsx b/src/pages/Admin/components/Challenges/Challenges.tsx index aabc399e..aa331d59 100644 --- a/src/pages/Admin/components/Challenges/Challenges.tsx +++ b/src/pages/Admin/components/Challenges/Challenges.tsx @@ -92,6 +92,14 @@ export default function Challenges() { */ const [editorValue, setEditorValue] = useState(''); + /** + * State for the editor value of the challenge description + * @author Matthias Roy + * + * @type {boolean} + */ + const [isInputEmpty, setIsInputEmpty] = useState(true); + useEffect(() => { let hasBeenExecuted = false; /** @@ -236,6 +244,11 @@ export default function Challenges() { */ function handleTitleOnChange(event: React.ChangeEvent) { setNewTitle(event.target.value); + if (event.target.value === '' || editorValue === '') { + setIsInputEmpty(true); + } else { + setIsInputEmpty(false); + } } /** @@ -476,6 +489,11 @@ export default function Challenges() { */ const handleEditorChange = (content: string) => { setEditorValue(content); + if (content === '' || newTitle === '') { + setIsInputEmpty(true); + } else { + setIsInputEmpty(false); + } }; return ( @@ -536,7 +554,7 @@ export default function Challenges() {
-