From ec1b4091e59890d312d40d6102c51cfd49c155c3 Mon Sep 17 00:00:00 2001 From: Ivo Leist Date: Sun, 10 Dec 2023 13:04:59 +0100 Subject: [PATCH] only enable the conversion arrow if the needed number of files is uploaded --- .../submissionForms/SubmissionForms.jsx | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/convertPheno_client/src/code/views/conversion/ components/submission/components/submissionForms/SubmissionForms.jsx b/convertPheno_client/src/code/views/conversion/ components/submission/components/submissionForms/SubmissionForms.jsx index c9691b84..8a4a97dd 100644 --- a/convertPheno_client/src/code/views/conversion/ components/submission/components/submissionForms/SubmissionForms.jsx +++ b/convertPheno_client/src/code/views/conversion/ components/submission/components/submissionForms/SubmissionForms.jsx @@ -51,11 +51,14 @@ export default function SubmissionForms(props) { }, [inputFormat]); const conversionCanBeStarted = () => { - // what is this for? const trueVals = Object.values(outputFormats).filter((value) => value); if (trueVals.length === 0) { - // TODO - // show an error toast + // no output format selected + return false; + } + + if (["redcap", "cdisc"].includes(inputFormat) && Object.keys(uploadedFiles).length < 3) { + // not all files uploaded return false; } if (runExampleData || filesUploadFinished) return true; @@ -88,12 +91,6 @@ export default function SubmissionForms(props) { } if (["redcap", "cdisc"].includes(inputFormat)) { - if (Object.keys(uploadedFiles).length < 3) { - toast.error("Please upload all required files"); - console.log(uploadedFiles); - return; - } - // if cdisc check if at least one of the files is a .xml file if (inputFormat === "cdisc") { const fileNames = Object.keys(uploadedFiles);