From 4f6b6d18cbe85cc33a9540eefe0c031d1e3213ff Mon Sep 17 00:00:00 2001 From: Tom Date: Thu, 11 May 2023 14:37:06 +0200 Subject: [PATCH] disable draggable for CaptchaModal mobile --- src/components/CaptchaModal.jsx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/components/CaptchaModal.jsx b/src/components/CaptchaModal.jsx index 15bb7f3f..47395c75 100644 --- a/src/components/CaptchaModal.jsx +++ b/src/components/CaptchaModal.jsx @@ -18,9 +18,22 @@ const CaptchaModal = () => { const [imageSources, setImageSources] = useState([]); const [currentChallengeIndex, setCurrentChallengeIndex] = useState(0); const [totalChallenges, setTotalChallenges] = useState(0); + const [isMobile, setIsMobile] = useState(window.innerWidth <= 480); const responseRef = useRef(); const nodeRef = useRef(null); + + useEffect(() => { + const handleResize = () => setIsMobile(window.innerWidth <= 480); + window.addEventListener('resize', handleResize); + + // Cleanup function + return () => { + window.removeEventListener('resize', handleResize); + }; + }, [setIsMobile]); + + useEffect(() => { if (challengesArray) { const challenges = challengesArray.challenges; @@ -71,7 +84,7 @@ const CaptchaModal = () => { shouldCloseOnOverlayClick={false} selectedStyle={selectedStyle} overlayClassName="hide-modal-overlay"> - +
{pendingComment.parentCid ?