From 61fab5de306a8e4183ed6617695104caf0e203ed Mon Sep 17 00:00:00 2001 From: lucille Date: Thu, 4 Jul 2024 23:46:05 +0300 Subject: [PATCH 1/3] Move the tabs implementation in the commons-lib -tb/TPT --- .../tb-program-management.tsx | 34 ++----------------- .../tb-contact-list.component.tsx | 19 ++--------- .../tpt-program-management.tsx | 33 ++---------------- .../tb-treatment-follow-up.component.tsx | 19 ++--------- 4 files changed, 9 insertions(+), 96 deletions(-) diff --git a/packages/esm-tb-app/src/tb/program-management/tb-program-management.tsx b/packages/esm-tb-app/src/tb/program-management/tb-program-management.tsx index 8a33d70e3..4a7b2c025 100644 --- a/packages/esm-tb-app/src/tb/program-management/tb-program-management.tsx +++ b/packages/esm-tb-app/src/tb/program-management/tb-program-management.tsx @@ -1,41 +1,13 @@ import React from 'react'; +import { TabsComponent } from '@ohri/openmrs-esm-ohri-commons-lib'; import { useConfig } from '@openmrs/esm-framework'; -import { Tabs, Tab, TabList, TabPanels, TabPanel } from '@carbon/react'; -import { type PatientChartProps, getMenuItemTabConfiguration, EncounterList } from '@ohri/openmrs-esm-ohri-commons-lib'; +import { type PatientChartProps } from '@ohri/openmrs-esm-ohri-commons-lib'; import tptProgramManagemetConfigSchema from './tb-program-management-config.json'; -import styles from '../common.scss'; - const ProgramManagementSummary: React.FC = ({ patientUuid }) => { const config = useConfig(); - const tabs = getMenuItemTabConfiguration(tptProgramManagemetConfigSchema, config); - return ( -
- - - {tabs.map((tab) => ( - {tab.name} - ))} - - - {tabs.map((tab) => ( - - - - ))} - - -
- ); + return ; }; export default ProgramManagementSummary; diff --git a/packages/esm-tb-app/src/tb/tb-contact-listing/tb-contact-list.component.tsx b/packages/esm-tb-app/src/tb/tb-contact-listing/tb-contact-list.component.tsx index ccb49ec86..28a2c4b69 100644 --- a/packages/esm-tb-app/src/tb/tb-contact-listing/tb-contact-list.component.tsx +++ b/packages/esm-tb-app/src/tb/tb-contact-listing/tb-contact-list.component.tsx @@ -1,6 +1,6 @@ import React from 'react'; +import { TabsComponent } from '@ohri/openmrs-esm-ohri-commons-lib'; import { useConfig } from '@openmrs/esm-framework'; -import { EncounterList, getMenuItemTabConfiguration } from '@ohri/openmrs-esm-ohri-commons-lib'; import tbFollowupConfigSchema from './tb-contact-listing-config.json'; interface OverviewListProps { @@ -9,23 +9,8 @@ interface OverviewListProps { const TbContactTracingList: React.FC = ({ patientUuid }) => { const config = useConfig(); - const tabs = getMenuItemTabConfiguration(tbFollowupConfigSchema, config); - return ( - <> - {tabs.map((tab) => ( - - ))} - - ); + return ; }; export default TbContactTracingList; diff --git a/packages/esm-tb-app/src/tb/tpt/program-management/tpt-program-management.tsx b/packages/esm-tb-app/src/tb/tpt/program-management/tpt-program-management.tsx index db189d008..fa62ca9de 100644 --- a/packages/esm-tb-app/src/tb/tpt/program-management/tpt-program-management.tsx +++ b/packages/esm-tb-app/src/tb/tpt/program-management/tpt-program-management.tsx @@ -1,45 +1,16 @@ import React from 'react'; import { useConfig } from '@openmrs/esm-framework'; -import { Tabs, Tab, TabList, TabPanels, TabPanel } from '@carbon/react'; -import { EncounterList, getMenuItemTabConfiguration } from '@ohri/openmrs-esm-ohri-commons-lib'; +import { TabsComponent } from '@ohri/openmrs-esm-ohri-commons-lib'; import tptProgramManagemetConfigSchema from './tpt-program-management-config.json'; -import styles from '../../common.scss'; - interface OverviewListProps { patientUuid: string; } const TptProgramManagementSummary: React.FC = ({ patientUuid }) => { const config = useConfig(); - const tabs = getMenuItemTabConfiguration(tptProgramManagemetConfigSchema, config); - return ( -
- - - {tabs.map((tab) => ( - {tab.name} - ))} - - - {tabs.map((tab) => ( - - - - ))} - - -
- ); + return ; }; export default TptProgramManagementSummary; diff --git a/packages/esm-tb-app/src/tb/treatment-and-follow-up/tb-treatment-follow-up.component.tsx b/packages/esm-tb-app/src/tb/treatment-and-follow-up/tb-treatment-follow-up.component.tsx index ebb2b9548..abb8184ca 100644 --- a/packages/esm-tb-app/src/tb/treatment-and-follow-up/tb-treatment-follow-up.component.tsx +++ b/packages/esm-tb-app/src/tb/treatment-and-follow-up/tb-treatment-follow-up.component.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { useConfig } from '@openmrs/esm-framework'; -import { EncounterList, getMenuItemTabConfiguration } from '@ohri/openmrs-esm-ohri-commons-lib'; +import { TabsComponent } from '@ohri/openmrs-esm-ohri-commons-lib'; import tbFollowupConfigSchema from './tb-treatment-followup-config.json'; interface OverviewListProps { @@ -9,23 +9,8 @@ interface OverviewListProps { const TbTreatmentFollowUpList: React.FC = ({ patientUuid }) => { const config = useConfig(); - const tabs = getMenuItemTabConfiguration(tbFollowupConfigSchema, config); - return ( - <> - {tabs.map((tab) => ( - - ))} - - ); + return ; }; export default TbTreatmentFollowUpList; From 89ed2f2b59814e2533b71d59a02bf7426f5d2c8e Mon Sep 17 00:00:00 2001 From: lucille Date: Mon, 8 Jul 2024 12:02:12 +0300 Subject: [PATCH 2/3] Remove duplication of TPT summary and program management --- packages/esm-tb-app/src/routes.json | 36 ----------------------------- 1 file changed, 36 deletions(-) diff --git a/packages/esm-tb-app/src/routes.json b/packages/esm-tb-app/src/routes.json index 563f183d6..d68bbe145 100644 --- a/packages/esm-tb-app/src/routes.json +++ b/packages/esm-tb-app/src/routes.json @@ -106,42 +106,6 @@ "slot": "tpt-program-management-summary-slot", "component": "tptProgramManagementDashboard" }, - - - { - "name": "tpt-patient-summary", - "slot": "ohri-tpt-slot", - "component": "tptPatientSummaryDashboardLink", - "meta": { - "slot": "tpt-patient-summary-slot", - "columns": 1, - "path": "tpt-patient-summary", - "layoutMode": "anchored" - } - }, - { - "name": "tpt-patient-summary-ext", - "slot": "tpt-patient-summary-slot", - "component": "tptPatientSummaryDashboard" - }, - - { - "name": "tpt-program-management-summary", - "slot": "ohri-tpt-slot", - "component": "tptProgramManagementDashboardLink", - "meta": { - "slot": "tpt-program-management-summary-slot", - "columns": 1, - "path": "tpt-program-management", - "layoutMode": "anchored" - } - }, - { - "name": "tpt-program-management-summary-ext", - "slot": "tpt-program-management-summary-slot", - "component": "tptProgramManagementDashboard" - }, - { "name": "tb-treatment-follow-up-summary", "slot": "ohri-tb-slot", From 75607491d1e9f43d4dab3ae301689819bb4351cf Mon Sep 17 00:00:00 2001 From: lucille Date: Mon, 8 Jul 2024 14:40:50 +0300 Subject: [PATCH 3/3] fix failing build --- .../tb/program-management/tb-program-management.tsx | 10 ++++++++-- .../tb-contact-listing/tb-contact-list.component.tsx | 4 ++-- .../tpt/program-management/tpt-program-management.tsx | 10 ++++++++-- .../tb-treatment-follow-up.component.tsx | 4 ++-- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/packages/esm-tb-app/src/tb/program-management/tb-program-management.tsx b/packages/esm-tb-app/src/tb/program-management/tb-program-management.tsx index 4a7b2c025..a76f745bd 100644 --- a/packages/esm-tb-app/src/tb/program-management/tb-program-management.tsx +++ b/packages/esm-tb-app/src/tb/program-management/tb-program-management.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { TabsComponent } from '@ohri/openmrs-esm-ohri-commons-lib'; +import { EncounterListTabsComponent } from '@ohri/openmrs-esm-ohri-commons-lib'; import { useConfig } from '@openmrs/esm-framework'; import { type PatientChartProps } from '@ohri/openmrs-esm-ohri-commons-lib'; import tptProgramManagemetConfigSchema from './tb-program-management-config.json'; @@ -7,7 +7,13 @@ import tptProgramManagemetConfigSchema from './tb-program-management-config.json const ProgramManagementSummary: React.FC = ({ patientUuid }) => { const config = useConfig(); - return ; + return ( + + ); }; export default ProgramManagementSummary; diff --git a/packages/esm-tb-app/src/tb/tb-contact-listing/tb-contact-list.component.tsx b/packages/esm-tb-app/src/tb/tb-contact-listing/tb-contact-list.component.tsx index 28a2c4b69..76c1f0992 100644 --- a/packages/esm-tb-app/src/tb/tb-contact-listing/tb-contact-list.component.tsx +++ b/packages/esm-tb-app/src/tb/tb-contact-listing/tb-contact-list.component.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { TabsComponent } from '@ohri/openmrs-esm-ohri-commons-lib'; +import { EncounterListTabsComponent } from '@ohri/openmrs-esm-ohri-commons-lib'; import { useConfig } from '@openmrs/esm-framework'; import tbFollowupConfigSchema from './tb-contact-listing-config.json'; @@ -10,7 +10,7 @@ interface OverviewListProps { const TbContactTracingList: React.FC = ({ patientUuid }) => { const config = useConfig(); - return ; + return ; }; export default TbContactTracingList; diff --git a/packages/esm-tb-app/src/tb/tpt/program-management/tpt-program-management.tsx b/packages/esm-tb-app/src/tb/tpt/program-management/tpt-program-management.tsx index fa62ca9de..66dd4e8b8 100644 --- a/packages/esm-tb-app/src/tb/tpt/program-management/tpt-program-management.tsx +++ b/packages/esm-tb-app/src/tb/tpt/program-management/tpt-program-management.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { useConfig } from '@openmrs/esm-framework'; -import { TabsComponent } from '@ohri/openmrs-esm-ohri-commons-lib'; +import { EncounterListTabsComponent } from '@ohri/openmrs-esm-ohri-commons-lib'; import tptProgramManagemetConfigSchema from './tpt-program-management-config.json'; interface OverviewListProps { @@ -10,7 +10,13 @@ interface OverviewListProps { const TptProgramManagementSummary: React.FC = ({ patientUuid }) => { const config = useConfig(); - return ; + return ( + + ); }; export default TptProgramManagementSummary; diff --git a/packages/esm-tb-app/src/tb/treatment-and-follow-up/tb-treatment-follow-up.component.tsx b/packages/esm-tb-app/src/tb/treatment-and-follow-up/tb-treatment-follow-up.component.tsx index abb8184ca..994504a15 100644 --- a/packages/esm-tb-app/src/tb/treatment-and-follow-up/tb-treatment-follow-up.component.tsx +++ b/packages/esm-tb-app/src/tb/treatment-and-follow-up/tb-treatment-follow-up.component.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { useConfig } from '@openmrs/esm-framework'; -import { TabsComponent } from '@ohri/openmrs-esm-ohri-commons-lib'; +import { EncounterListTabsComponent } from '@ohri/openmrs-esm-ohri-commons-lib'; import tbFollowupConfigSchema from './tb-treatment-followup-config.json'; interface OverviewListProps { @@ -10,7 +10,7 @@ interface OverviewListProps { const TbTreatmentFollowUpList: React.FC = ({ patientUuid }) => { const config = useConfig(); - return ; + return ; }; export default TbTreatmentFollowUpList;