Skip to content

Commit

Permalink
Correction de l'affichage de l'éligibilité qui ne tenait pas compte d…
Browse files Browse the repository at this point in the history
…e toutes les aides
  • Loading branch information
morganmerzouk committed Oct 24, 2024
1 parent 319cf08 commit 95a3842
Showing 1 changed file with 5 additions and 20 deletions.
25 changes: 5 additions & 20 deletions components/Eligibility.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { No, Yes } from '@/components/ResultUI'
import { useMemo } from 'react'
import AmpleurSummary from './ampleur/AmpleurSummary'
import { CustomQuestionWrapper } from './CustomQuestionUI'
import PersonaBar from './PersonaBar'
Expand All @@ -11,6 +10,7 @@ import { useIsCompact } from './useIsInIframe'
import Feedback from '@/app/contact/Feedback'
import FatConseiller from './FatConseiller'
import BackToLastQuestion from './BackToLastQuestion'
import { useAides } from './ampleur/useAides'

export default function Eligibility({
setSearchParams,
Expand All @@ -34,23 +34,8 @@ export default function Eligibility({
)
return url
}

const [mpraEvaluation, mprgEvaluation, ceeConditionsEvaluation] =
useMemo(() => {
const newEngine = engine.setSituation(situation)
return [
newEngine.evaluate('MPR . accompagnée . éligible'),
newEngine.evaluate('MPR . non accompagnée . éligible'),
newEngine.evaluate('CEE . conditions'),
]
}, [situation, engine]),
mpra = mpraEvaluation.nodeValue,
mprg = mprgEvaluation.nodeValue,
ceeConditions = ceeConditionsEvaluation.nodeValue
const both = mpra && mprg,
noMpr = !mpra && !mprg,
some = mpra || mprg || ceeConditions

const aides = useAides(engine, situation)
const hasAides = aides.filter((aide) => aide.status === true).length > 0
const showPersonaBar = searchParams.personas != null

return (
Expand Down Expand Up @@ -87,10 +72,10 @@ export default function Eligibility({
margin: 0.5rem 0 !important;
`}
>
{some && <>Bonne nouvelle 🥳</>}
{hasAides && <>Bonne nouvelle 🥳</>}
</h2>
</header>
{some ? (
{hasAides ? (
<p>
<Yes>Vous êtes éligible</Yes> aux aides présentées ci-dessous
</p>
Expand Down

0 comments on commit 95a3842

Please sign in to comment.