From ef00bc56f0230e7295a1b651d12d659cbddfe4ec Mon Sep 17 00:00:00 2001 From: Mihail Gorceag <mgorceag@EN410053.local> Date: Wed, 14 Apr 2021 15:22:34 +0300 Subject: [PATCH] fix: disable form popup for ncrc --- .../src/components/FormTemplate.js | 53 ++++++++++--------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/app/components/component-submit/src/components/FormTemplate.js b/app/components/component-submit/src/components/FormTemplate.js index 974b97a0b2..b3138cb684 100644 --- a/app/components/component-submit/src/components/FormTemplate.js +++ b/app/components/component-submit/src/components/FormTemplate.js @@ -187,31 +187,34 @@ const FormTemplate = ({ }) => { const client = useApolloClient() - const submitButton = (text, haspopup = false) => ( - <div> - <Button - onClick={async () => { - const hasErrors = Object.keys(await validateForm()).length !== 0 - - // If there are errors, do a fake submit - // to focus on the error - if ( - hasErrors || - values.status === articleStatuses.evaluated || - (values.status === articleStatuses.submitted && !haspopup) - ) { - handleSubmit() - } else { - toggleConfirming() - } - }} - primary - type="button" - > - {text} - </Button> - </div> - ) + const submitButton = (text, haspopup = false) => { + return ( + <div> + <Button + onClick={async () => { + const hasErrors = Object.keys(await validateForm()).length !== 0 + + // If there are errors, do a fake submit + // to focus on the error + if ( + hasErrors || + values.status === articleStatuses.evaluated || + values.status === articleStatuses.submitted || + !haspopup + ) { + handleSubmit() + } else { + toggleConfirming() + } + }} + primary + type="button" + > + {text} + </Button> + </div> + ) + } const submitButtonText = match.url.includes('/evaluation') ? 'Submit Evaluation' -- GitLab