disable draggable for CaptchaModal mobile

This commit is contained in:
Tom
2023-05-11 14:37:06 +02:00
parent 769002e65a
commit 4f6b6d18cb
+14 -1
View File
@@ -18,9 +18,22 @@ const CaptchaModal = () => {
const [imageSources, setImageSources] = useState([]); const [imageSources, setImageSources] = useState([]);
const [currentChallengeIndex, setCurrentChallengeIndex] = useState(0); const [currentChallengeIndex, setCurrentChallengeIndex] = useState(0);
const [totalChallenges, setTotalChallenges] = useState(0); const [totalChallenges, setTotalChallenges] = useState(0);
const [isMobile, setIsMobile] = useState(window.innerWidth <= 480);
const responseRef = useRef(); const responseRef = useRef();
const nodeRef = useRef(null); const nodeRef = useRef(null);
useEffect(() => {
const handleResize = () => setIsMobile(window.innerWidth <= 480);
window.addEventListener('resize', handleResize);
// Cleanup function
return () => {
window.removeEventListener('resize', handleResize);
};
}, [setIsMobile]);
useEffect(() => { useEffect(() => {
if (challengesArray) { if (challengesArray) {
const challenges = challengesArray.challenges; const challenges = challengesArray.challenges;
@@ -71,7 +84,7 @@ const CaptchaModal = () => {
shouldCloseOnOverlayClick={false} shouldCloseOnOverlayClick={false}
selectedStyle={selectedStyle} selectedStyle={selectedStyle}
overlayClassName="hide-modal-overlay"> overlayClassName="hide-modal-overlay">
<Draggable handle=".modal-header" nodeRef={nodeRef}> <Draggable handle=".modal-header" nodeRef={nodeRef} disabled={isMobile}>
<div className="modal-content" ref={nodeRef}> <div className="modal-content" ref={nodeRef}>
<div className="modal-header"> <div className="modal-header">
{pendingComment.parentCid ? {pendingComment.parentCid ?