Skip to content

Commit

Permalink
fix question mark bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ranven committed Sep 26, 2024
1 parent 797e41d commit 21a080a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
21 changes: 19 additions & 2 deletions client/components/FormView/NavigationSidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand All @@ -62,6 +62,10 @@ const getIsCompleted = ({ formData, questionId }) => {
return json && Object.values(json).some(value => value)
}

if (getFieldValue) {
return questionData
}

return Boolean(questionData)
}

Expand Down Expand Up @@ -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'
Expand All @@ -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`)
}
Expand Down
4 changes: 0 additions & 4 deletions client/components/Generic/Generic.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 21a080a

Please sign in to comment.