From 492a222489956642f9b9d674473de6e637c29dfa Mon Sep 17 00:00:00 2001 From: Pedro Oliveira Date: Mon, 4 Mar 2024 18:12:10 +0000 Subject: [PATCH] feat: added topicGroupId to RegistrationProvider - corrected bug where it would open unselected accordions if the topicIds matched - added topicGroup to onOverlayOpen --- .../topicSelection/TopicSelection.tsx | 35 +++++++++++-------- .../provider/RegistrationProvider.tsx | 1 + 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src/components/registration/topicSelection/TopicSelection.tsx b/src/components/registration/topicSelection/TopicSelection.tsx index 416e09e51..9837d0f7b 100644 --- a/src/components/registration/topicSelection/TopicSelection.tsx +++ b/src/components/registration/topicSelection/TopicSelection.tsx @@ -45,16 +45,14 @@ export const TopicSelection: VFC<{ const [topics, setTopics] = useState([]); const [isLoading, setIsLoading] = useState(false); const [listView, setListView] = useState(false); - const [topicGroupId, setTopicGroupId] = useState(0); + const [topicGroupId, setTopicGroupId] = useState( + sessionStorageRegistrationData.topicGroupId || undefined + ); const getTopic = (mainTopicId: number) => { return topics?.filter((topic) => topic?.id === mainTopicId)?.[0]; }; - const getTopicInteraction = (topicGroupId: number) => { - setTopicGroupId(topicGroupId); - }; - useEffect(() => { if ( REGISTRATION_DATA_VALIDATION.mainTopicId.validation( @@ -260,9 +258,11 @@ export const TopicSelection: VFC<{ )) : topicGroups.map((topicGroup) => ( )} @@ -421,7 +428,7 @@ export const TopicSelection: VFC<{ ))} - ))} + ))} )} diff --git a/src/globalState/provider/RegistrationProvider.tsx b/src/globalState/provider/RegistrationProvider.tsx index 3b0067156..a3f8cbbfc 100644 --- a/src/globalState/provider/RegistrationProvider.tsx +++ b/src/globalState/provider/RegistrationProvider.tsx @@ -52,6 +52,7 @@ interface RegistrationSessionStorageData { password: string; agencyId: number; mainTopicId: number; + topicGroupId?: number; topicId?: number; zipcode: string; }