Skip to content

Commit

Permalink
exclude partner 65+ and not getting OAS
Browse files Browse the repository at this point in the history
  • Loading branch information
numbap committed Sep 27, 2023
1 parent 5ea4aa6 commit e704d7a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
1 change: 1 addition & 0 deletions components/ResultsPage/EstimatedTotal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export const EstimatedTotal: React.VFC<{
key={benefit.benefitKey}
heading={apiTrans.benefit[benefit.benefitKey]}
result={benefit}
displayAmount={partner && partnerNoOAS ? false : true}
/>
))}
</ul>
Expand Down
24 changes: 15 additions & 9 deletions components/ResultsPage/EstimatedTotalItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,43 @@ import { useTranslation } from '../Hooks'
export const EstimatedTotalItem: React.VFC<{
heading: string
result: BenefitResult
}> = ({ heading, result }) => {
displayAmount: boolean
}> = ({ heading, result, displayAmount }) => {
const tsln = useTranslation<WebTranslations>()
/*
returns benefit name with from/de and proper article. ... french nuances.
*/

function displayBenefitName(benefitName: string, result: number): string {
function displayBenefitName(
benefitName: string,
result: number,
displayAmount: boolean
): string {
if (tsln._language === Language.EN) {
return ` from the ${benefitName}`
return displayAmount ? ` from the ${benefitName}` : `the ${benefitName}`
} else {
switch (benefitName) {
case tsln.oas:
const lowCase =
benefitName.charAt(0).toLowerCase() + benefitName.slice(1)
return ` de la ${lowCase}`
return displayAmount ? ` de la ${lowCase}` : `la ${lowCase}`
case tsln.gis:
return ` du ${benefitName}`
return displayAmount ? ` du ${benefitName}` : `du ${benefitName}`
default:
return ` de l'${benefitName}`
return displayAmount ? ` de l'${benefitName}` : `l'${benefitName}`
}
}
}

if (!result.entitlement) return null

console.log(result, '=====')
return (
<li>
<strong>
{numberToStringCurrency(result.entitlement.result, tsln._language)}
{displayAmount &&
numberToStringCurrency(result.entitlement.result, tsln._language)}
</strong>
{displayBenefitName(heading, result.entitlement.result)}
{displayBenefitName(heading, result.entitlement.result, displayAmount)}
</li>
)
}
1 change: 1 addition & 0 deletions components/ResultsPage/WillBeEligible.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ export const WillBeEligible: React.VFC<{
key={benefit.benefitKey}
heading={apiTrans.benefit[benefit.benefitKey]}
result={benefit}
displayAmount={partner && partnerNoOAS ? false : true}
/>
))}
</ul>
Expand Down

0 comments on commit e704d7a

Please sign in to comment.