From ea169b5a96be5dd1d505daa4e713285f691cbf7c Mon Sep 17 00:00:00 2001 From: lucille Date: Wed, 3 Jul 2024 11:01:21 +0300 Subject: [PATCH] address comments on the PR --- .../cacx-visits/cacx-visits-services.component.tsx | 8 ++------ .../encounter-list-tabs.component.tsx} | 14 +++++++++----- .../encounter-list-tabs.scss} | 0 packages/esm-commons-lib/src/index.ts | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) rename packages/esm-commons-lib/src/components/{encounter-tabs/encounter-tabs.component.tsx => encounter-list-tabs/encounter-list-tabs.component.tsx} (67%) rename packages/esm-commons-lib/src/components/{encounter-tabs/common.scss => encounter-list-tabs/encounter-list-tabs.scss} (100%) diff --git a/packages/esm-cervical-cancer-app/src/cervical-cancer/cacx-visits/cacx-visits-services.component.tsx b/packages/esm-cervical-cancer-app/src/cervical-cancer/cacx-visits/cacx-visits-services.component.tsx index 141e8ed55..06c75db21 100644 --- a/packages/esm-cervical-cancer-app/src/cervical-cancer/cacx-visits/cacx-visits-services.component.tsx +++ b/packages/esm-cervical-cancer-app/src/cervical-cancer/cacx-visits/cacx-visits-services.component.tsx @@ -1,6 +1,5 @@ import React from 'react'; -import { useConfig } from '@openmrs/esm-framework'; -import { getMenuItemTabConfiguration, TabsComponent } from '@ohri/openmrs-esm-ohri-commons-lib'; +import { TabsComponent } from '@ohri/openmrs-esm-ohri-commons-lib'; import cacxConfigSchema from './cacx-config.json'; interface OverviewListProps { @@ -8,10 +7,7 @@ interface OverviewListProps { } const CaCxCervicalCancerServices: React.FC = ({ patientUuid }) => { - const config = useConfig(); - const tabs = getMenuItemTabConfiguration(cacxConfigSchema, config); - - return ; + return ; }; export default CaCxCervicalCancerServices; diff --git a/packages/esm-commons-lib/src/components/encounter-tabs/encounter-tabs.component.tsx b/packages/esm-commons-lib/src/components/encounter-list-tabs/encounter-list-tabs.component.tsx similarity index 67% rename from packages/esm-commons-lib/src/components/encounter-tabs/encounter-tabs.component.tsx rename to packages/esm-commons-lib/src/components/encounter-list-tabs/encounter-list-tabs.component.tsx index ec8097d05..162d85a44 100644 --- a/packages/esm-commons-lib/src/components/encounter-tabs/encounter-tabs.component.tsx +++ b/packages/esm-commons-lib/src/components/encounter-list-tabs/encounter-list-tabs.component.tsx @@ -1,14 +1,18 @@ import React from 'react'; import { Tabs, Tab, TabList, TabPanels, TabPanel } from '@carbon/react'; -import { EncounterList } from '@ohri/openmrs-esm-ohri-commons-lib'; -import styles from './common.scss'; +import { useConfig } from '@openmrs/esm-framework'; +import { EncounterList, getMenuItemTabConfiguration } from '@ohri/openmrs-esm-ohri-commons-lib'; +import styles from './encounter-list-tabs.scss'; -interface OverviewListProps { +interface TabsComponentProps { patientUuid: string; - tabsConfig: any[]; + configSchema: any; } -export const TabsComponent: React.FC = ({ patientUuid, tabsConfig }) => { +export const TabsComponent: React.FC = ({ patientUuid, configSchema }) => { + const config = useConfig(); + const tabsConfig = getMenuItemTabConfiguration(configSchema, config); + return (
diff --git a/packages/esm-commons-lib/src/components/encounter-tabs/common.scss b/packages/esm-commons-lib/src/components/encounter-list-tabs/encounter-list-tabs.scss similarity index 100% rename from packages/esm-commons-lib/src/components/encounter-tabs/common.scss rename to packages/esm-commons-lib/src/components/encounter-list-tabs/encounter-list-tabs.scss diff --git a/packages/esm-commons-lib/src/index.ts b/packages/esm-commons-lib/src/index.ts index 7fcaf7dfe..f4982ca46 100644 --- a/packages/esm-commons-lib/src/index.ts +++ b/packages/esm-commons-lib/src/index.ts @@ -55,7 +55,7 @@ export * from './utils/summary-card-config-builder'; export * from './utils/encounter-tile-config-builder'; export * from './utils/cohort-list-config-builder'; export * from './utils/patient-list-tabs-config-builder'; -export * from './components/encounter-tabs/encounter-tabs.component'; +export * from './components/encounter-list-tabs/encounter-list-tabs.component'; // Workspace registration moved to the index.ts and routes.json const options = { featureName: 'ohri-forms-workspace-item',