From 0b877ec179103df062ba0713137dd474446f1c8e Mon Sep 17 00:00:00 2001 From: Tom Date: Sat, 27 May 2023 14:09:49 +0200 Subject: [PATCH] fix captcha image state --- src/components/modals/CaptchaModal.jsx | 8 ++++++-- src/components/styled/modals/CaptchaModal.styled.jsx | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/modals/CaptchaModal.jsx b/src/components/modals/CaptchaModal.jsx index e7f03027..b09bbc1f 100644 --- a/src/components/modals/CaptchaModal.jsx +++ b/src/components/modals/CaptchaModal.jsx @@ -7,7 +7,7 @@ import Draggable from 'react-draggable'; const CaptchaModal = () => { const { - challengesArray, + challengesArray, setChallengesArray, pendingComment, selectedStyle, setCaptchaResponse, @@ -83,6 +83,8 @@ const CaptchaModal = () => { const submitCaptcha = (callback) => { setCaptchaResponse(responseRef.current.value); + setImageSources([]); + setChallengesArray([]); setIsCaptchaOpen(false); if (callback) { @@ -96,6 +98,8 @@ const CaptchaModal = () => { isOpen={isCaptchaOpen} onRequestClose={() => { submitCaptcha(); + setImageSources([]); + setChallengesArray([]); setIsCaptchaOpen(false);}} contentLabel="Captcha Modal" shouldCloseOnEsc={false} @@ -167,7 +171,7 @@ const CaptchaModal = () => { } }} > - {currentChallengeIndex + 1 < totalChallenges ? "Next" : "Post"} + {currentChallengeIndex + 1 < totalChallenges ? "Next" : "Submit"} diff --git a/src/components/styled/modals/CaptchaModal.styled.jsx b/src/components/styled/modals/CaptchaModal.styled.jsx index bb7b886f..6f5e0cc0 100644 --- a/src/components/styled/modals/CaptchaModal.styled.jsx +++ b/src/components/styled/modals/CaptchaModal.styled.jsx @@ -84,7 +84,7 @@ export const StyledModal = styled(Modal)` #nav { float: right; margin: 0; - width: 40px; + width: auto; } ${({ selectedStyle }) => {