From 2756b945ef217ea1e21c90cf1ef04263fe90ddb0 Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Fri, 29 Nov 2024 22:54:43 +0530 Subject: [PATCH 1/4] fix: ensure correct highlighting of navigation tabs on selection --- .../Patient/PatientDetailsTab/Demography.tsx | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/src/components/Patient/PatientDetailsTab/Demography.tsx b/src/components/Patient/PatientDetailsTab/Demography.tsx index 2a412f03f9a..c2d40b381a0 100644 --- a/src/components/Patient/PatientDetailsTab/Demography.tsx +++ b/src/components/Patient/PatientDetailsTab/Demography.tsx @@ -31,34 +31,28 @@ export const Demography = (props: PatientProps) => { useState(); const [activeSection, setActiveSection] = useState(null); + const [clickedSection, setClickedSection] = useState(null); useEffect(() => { setAssignedVolunteerObject(patientData.assigned_to_object); - - const observedSections: Element[] = []; const sections = document.querySelectorAll("div[id]"); const observer = new IntersectionObserver( (entries) => { - entries.forEach((entry) => { - if (entry.isIntersecting) { - setActiveSection(entry.target.id); - } - }); - }, - { - threshold: 0.6, + if (clickedSection) return; + const visibleSection = entries.find((entry) => entry.isIntersecting); + if (visibleSection) { + setActiveSection(visibleSection.target.id); + } }, + { threshold: 0.6 }, ); - sections.forEach((section) => { - observer.observe(section); - observedSections.push(section); - }); + sections.forEach((section) => observer.observe(section)); return () => { - observedSections.forEach((section) => observer.unobserve(section)); + sections.forEach((section) => observer.unobserve(section)); }; - }, [patientData.assigned_to_object]); + }, [clickedSection]); const { data: insuranceDetials } = useQuery(routes.hcx.policies.list, { query: { @@ -71,6 +65,8 @@ export const Demography = (props: PatientProps) => { )?.text; const scrollToSection = (sectionId: string) => { + setClickedSection(sectionId); + setActiveSection(sectionId); const section = document.getElementById(sectionId); if (section) { section.scrollIntoView({ behavior: "smooth" }); From ef68ac0a84c179c76ef9a518c508548500f12ac3 Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Tue, 10 Dec 2024 22:19:33 +0530 Subject: [PATCH 2/4] Volunteer phone number added --- src/components/Patient/PatientDetailsTab/Demography.tsx | 2 +- src/components/Patient/models.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Patient/PatientDetailsTab/Demography.tsx b/src/components/Patient/PatientDetailsTab/Demography.tsx index 7daa57d566a..7c781c5f6b2 100644 --- a/src/components/Patient/PatientDetailsTab/Demography.tsx +++ b/src/components/Patient/PatientDetailsTab/Demography.tsx @@ -287,7 +287,7 @@ export const Demography = (props: PatientProps) => { hidden: !patientData.assigned_to_object, details: [ Date: Tue, 10 Dec 2024 22:28:50 +0530 Subject: [PATCH 3/4] Volunteer phone number added --- src/components/Patient/models.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/Patient/models.tsx b/src/components/Patient/models.tsx index 2f170a74ff2..4b0428e615e 100644 --- a/src/components/Patient/models.tsx +++ b/src/components/Patient/models.tsx @@ -49,6 +49,7 @@ export interface AssignedToObjectModel { first_name: string; last_name: string; last_login?: string; + alt_phone_number?: string; phone_number?: string; user_type: string; } From 3de864bcaab6fa7164a2ed22428aed693f7c3560 Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Sat, 28 Dec 2024 12:45:00 +0530 Subject: [PATCH 4/4] updated volunteer contact --- src/components/Patient/PatientDetailsTab/Demography.tsx | 2 +- src/components/Patient/models.tsx | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/Patient/PatientDetailsTab/Demography.tsx b/src/components/Patient/PatientDetailsTab/Demography.tsx index d0469824095..a1f1e9833d9 100644 --- a/src/components/Patient/PatientDetailsTab/Demography.tsx +++ b/src/components/Patient/PatientDetailsTab/Demography.tsx @@ -287,7 +287,7 @@ export const Demography = (props: PatientProps) => { hidden: !patientData.assigned_to_object, details: [