From 2bed1bb56a5ad8c4302ae4e719306c1734037981 Mon Sep 17 00:00:00 2001 From: Ivonne Hernandez Date: Wed, 28 Aug 2024 16:42:37 -0600 Subject: [PATCH] Refactor listAllTruthyValues in Confirmation to acct for new current benefits data structure --- src/Components/Confirmation/Confirmation.js | 40 +++++++++++++++------ 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/src/Components/Confirmation/Confirmation.js b/src/Components/Confirmation/Confirmation.js index 13441d4b0..2e0554e0d 100644 --- a/src/Components/Confirmation/Confirmation.js +++ b/src/Components/Confirmation/Confirmation.js @@ -564,17 +564,33 @@ const Confirmation = () => { return mappedListItems; }; - const listAllTruthyValues = (selectedOptions, relatedOptionsList) => { - const mappedListItems = selectedOptions.map((option) => { - return ( -

- {' '} - {relatedOptionsList[option]}{' '} -

- ); - }); + const listAllTruthyValues = (selectedOptions, relatedOptionsList, stateVariableName) => { + if (stateVariableName === 'benefits') { + const mappedListItems = selectedOptions.map((option) => { + const { id: nameId, defaultMessage: nameDefaultMsg } = relatedOptionsList[option].name.props; + const { id: descId, defaultMessage: descDefaultMsg } = relatedOptionsList[option].description.props; + + return ( +

+ {}: + {} +

+ ); + }); - return mappedListItems; + return mappedListItems; + } else { + const mappedListItems = selectedOptions.map((option) => { + return ( +

+ {' '} + {relatedOptionsList[option]}{' '} +

+ ); + }); + + return mappedListItems; + } }; const displayHHCheckboxSection = ( @@ -601,7 +617,9 @@ const Confirmation = () => {

{hasAnyTruthyOptions ? ( -
{listAllTruthyValues(truthyOptions, optionsList)}
+
+ {listAllTruthyValues(truthyOptions, optionsList, stateVariableName)} +
) : (