Skip to content

Commit

Permalink
fix: check if the topic clicked is in the correct topicGroup
Browse files Browse the repository at this point in the history
  • Loading branch information
pnboliveira committed Feb 13, 2024
1 parent ed9d655 commit 92bad60
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/components/registration/topicSelection/TopicSelection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,16 @@ export const TopicSelection: VFC<{
const [topics, setTopics] = useState<TopicsDataInterface[]>([]);
const [isLoading, setIsLoading] = useState<boolean>(false);
const [listView, setListView] = useState<boolean>(false);
const [topicGroupId, setTopicGroupId] = useState<number>(0);

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(
Expand Down Expand Up @@ -347,10 +352,15 @@ export const TopicSelection: VFC<{
topic?.id
}
);
getTopicInteraction(
topicGroup.id
);
}}
checked={
value ===
topic?.id
topic?.id &&
topicGroup.id ===
topicGroupId
}
/>
}
Expand Down Expand Up @@ -411,7 +421,7 @@ export const TopicSelection: VFC<{
))}
</AccordionDetails>
</Accordion>
))}
))}
</RadioGroup>
</FormControl>
)}
Expand Down

0 comments on commit 92bad60

Please sign in to comment.