From 21a080ae8ec0b00c6daf5ab15c49f1bb3974e01f Mon Sep 17 00:00:00 2001 From: Venla Date: Thu, 26 Sep 2024 11:00:58 +0300 Subject: [PATCH] fix question mark bug --- .../components/FormView/NavigationSidebar.js | 21 +++++++++++++++++-- client/components/Generic/Generic.scss | 4 ---- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/client/components/FormView/NavigationSidebar.js b/client/components/FormView/NavigationSidebar.js index e0ae256a..e9158701 100644 --- a/client/components/FormView/NavigationSidebar.js +++ b/client/components/FormView/NavigationSidebar.js @@ -53,7 +53,7 @@ const getCorrectRomanNumeral = (number, formType) => { return romanize(number) || '0' } -const getIsCompleted = ({ formData, questionId }) => { +const getIsCompleted = ({ formData, questionId, getFieldValue }) => { const questionData = formData[questionId] const fromJson = questionId.endsWith('_selection') @@ -62,6 +62,10 @@ const getIsCompleted = ({ formData, questionId }) => { return json && Object.values(json).some(value => value) } + if (getFieldValue) { + return questionData + } + return Boolean(questionData) } @@ -164,7 +168,6 @@ const NavigationSidebar = ({ programmeKey, formType, formNumber, questionData }) if ( type === 'TEXTAREA' || type === 'ENTITY' || - type === 'META_ENTITY' || type === 'SELECTION' || type === 'ENTITY_LEVELS' || type === 'ENTITY_UNIVERSITY' @@ -181,6 +184,20 @@ const NavigationSidebar = ({ programmeKey, formType, formNumber, questionData }) `${id}_start_date_text`, `${id}_end_date_text`, ) + } else if (type === 'META_ENTITY') { + idsToCheck.push(`${id}_light`) + + let lightColor = getIsCompleted({ + formData: form.data, + questionId: `${id}_light`, + getFieldValue: true, + }) + + if (lightColor === 'gray') { + idsToCheck.push(`${id}_comment_text`) + } else { + idsToCheck.push(`${id}_text`) + } } else { idsToCheck.push(`${id}_1_text`) } diff --git a/client/components/Generic/Generic.scss b/client/components/Generic/Generic.scss index 06cf4065..56d49636 100644 --- a/client/components/Generic/Generic.scss +++ b/client/components/Generic/Generic.scss @@ -437,10 +437,6 @@ margin-left: auto; } -.form-text-area { - height: 250px; -} - // custom styling for react datepicker: make inactive month's day numbers look inactive .react-datepicker__day--outside-month { color: lightgray !important;