mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
disable draggable for CaptchaModal mobile
This commit is contained in:
@@ -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 ?
|
||||||
|
|||||||
Reference in New Issue
Block a user