From a2ddd1e1d802b39ecdd15b081c302f6179aacee5 Mon Sep 17 00:00:00 2001 From: Harman-singh-waraich Date: Thu, 17 Oct 2024 17:08:52 +0530 Subject: [PATCH] fix(web): submit-evidence-button-disable-condition --- .../Cases/CaseDetails/Evidence/SubmitEvidenceModal.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/web/src/pages/Cases/CaseDetails/Evidence/SubmitEvidenceModal.tsx b/web/src/pages/Cases/CaseDetails/Evidence/SubmitEvidenceModal.tsx index 2b7caab8a..2ee9c0451 100644 --- a/web/src/pages/Cases/CaseDetails/Evidence/SubmitEvidenceModal.tsx +++ b/web/src/pages/Cases/CaseDetails/Evidence/SubmitEvidenceModal.tsx @@ -1,4 +1,4 @@ -import React, { useCallback, useState } from "react"; +import React, { useCallback, useMemo, useState } from "react"; import styled from "styled-components"; import Modal from "react-modal"; @@ -14,6 +14,7 @@ import { wrapWithToast, OPTIONS as toastOptions } from "utils/wrapWithToast"; import EnsureAuth from "components/EnsureAuth"; import { EnsureChain } from "components/EnsureChain"; +import { isUndefined } from "src/utils"; const StyledModal = styled(Modal)` position: absolute; @@ -64,6 +65,8 @@ const SubmitEvidenceModal: React.FC<{ const [file, setFile] = useState(); const { uploadFile } = useAtlasProvider(); + const isDisabled = useMemo(() => isSending || message.trim() === "" || isUndefined(message), [isSending, message]); + const submitEvidence = useCallback(async () => { try { setIsSending(true); @@ -94,7 +97,7 @@ const SubmitEvidenceModal: React.FC<{