From 8f08ce35dfa4000e7932fbb16e715ce5ddd16f7a Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Wed, 5 Jun 2024 13:39:35 +0100 Subject: [PATCH] added props and included generic copy of state --- components/myportal/mycases.js | 1 + components/myportal/myrepresentations.js | 1 + components/myportal/topthree.js | 70 +++++++++++++----------- 3 files changed, 40 insertions(+), 32 deletions(-) diff --git a/components/myportal/mycases.js b/components/myportal/mycases.js index 6014799a..aa6684b8 100644 --- a/components/myportal/mycases.js +++ b/components/myportal/mycases.js @@ -22,6 +22,7 @@ const MyCases = (props) => { showTopThree={props.myCases.myCases} showDetails={props.myCases.myCasesDetails} topThreeType={"myCases"} + props={props} /> {props.myCases.myCases["@odata.count"] > 3 && ( diff --git a/components/myportal/myrepresentations.js b/components/myportal/myrepresentations.js index 5598b6fe..5c7c1c07 100644 --- a/components/myportal/myrepresentations.js +++ b/components/myportal/myrepresentations.js @@ -25,6 +25,7 @@ const MyRepresentations = (props) => { props.myRepresentations.myRepresentationsDetails } topThreeType={"myRepresentations"} + props={props} /> diff --git a/components/myportal/topthree.js b/components/myportal/topthree.js index e05b3897..a3f84785 100644 --- a/components/myportal/topthree.js +++ b/components/myportal/topthree.js @@ -199,46 +199,52 @@ const TopThree = (props) => { showTopThreeArr[key].incidentid : router.locale == "cy" ? "/fymhorth/achos/" + - showTopThreeArr[key].pinswg_title + showTopThreeArr[key].pinswg_title + + "?key=" + + topThreeType : "/myportal/case/" + - showTopThreeArr[key].pinswg_title + showTopThreeArr[key].pinswg_title + + "?key=" + + topThreeType } className="govuk-link--no-underline" data-id={index} onClick={() => { setSearchResults( - props.props.watchedCases.watchedCases - ); - setSearchDetails( - props.props.watchedCases - .watchedCasesDetails - ); - setCurrentReference({ - "ticketnumber": - showTopThreeArr[key].ticketnumber, - "currentReference": - topThreeType != "watchedCases" - ? topThreeType != - "myRepresentations" - ? showTopThreeArr[key] - .ticketnumber - : showTopThreeArr[key][ - "_pinswg_case_value@OData.Community.Display.V1.FormattedValue" - ] - : showTopThreeArr[key][ - "_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue" - ], - "currentType": topThreeType, - - "incidentid": getIncidentId( - topThreeType, - showTopThreeArr[key] + props.props[topThreeType][topThreeType] + ), + setSearchDetails( + props.props[topThreeType][ + topThreeType + "Details" + ] ), + setCurrentReference({ + "ticketnumber": + showTopThreeArr[key] + .ticketnumber, + "currentReference": + topThreeType != "watchedCases" + ? topThreeType != + "myRepresentations" + ? showTopThreeArr[key] + .ticketnumber + : showTopThreeArr[key][ + "_pinswg_case_value@OData.Community.Display.V1.FormattedValue" + ] + : showTopThreeArr[key][ + "_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue" + ], + "currentType": topThreeType, - "appealType": - showTopThreeArr[key] - .pinswg_appealcasetype, - }); + "incidentid": getIncidentId( + topThreeType, + showTopThreeArr[key] + ), + + "appealType": + showTopThreeArr[key] + .pinswg_appealcasetype, + }); }} > {topThreeType != "watchedCases"