Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move the tabs implementation in the commons-lib -tb/tpt app #1898

Merged
merged 4 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 0 additions & 36 deletions packages/esm-tb-app/src/routes.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -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<PatientChartProps> = ({ patientUuid }) => {
const config = useConfig();
const tabs = getMenuItemTabConfiguration(tptProgramManagemetConfigSchema, config);

return (
<div className={styles.tabContainer}>
<Tabs>
<TabList contained>
{tabs.map((tab) => (
<Tab key={tab.name}>{tab.name}</Tab>
))}
</TabList>
<TabPanels>
{tabs.map((tab) => (
<TabPanel>
<EncounterList
patientUuid={patientUuid}
formList={tab.formList}
columns={tab.columns}
encounterType={tab.encounterType}
launchOptions={tab.launchOptions}
headerTitle={tab.headerTitle}
description={tab.description}
/>
</TabPanel>
))}
</TabPanels>
</Tabs>
</div>
);
return <TabsComponent patientUuid={patientUuid} configSchema={tptProgramManagemetConfigSchema} config={config} />;
};

export default ProgramManagementSummary;
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -9,23 +9,8 @@ interface OverviewListProps {

const TbContactTracingList: React.FC<OverviewListProps> = ({ patientUuid }) => {
const config = useConfig();
const tabs = getMenuItemTabConfiguration(tbFollowupConfigSchema, config);

return (
<>
{tabs.map((tab) => (
<EncounterList
patientUuid={patientUuid}
encounterType={tab.encounterType}
formList={tab.formList}
columns={tab.columns}
description={tab.description}
headerTitle={tab.headerTitle}
launchOptions={tab.launchOptions}
/>
))}
</>
);
return <TabsComponent patientUuid={patientUuid} configSchema={tbFollowupConfigSchema} config={config} />;
};

export default TbContactTracingList;
Original file line number Diff line number Diff line change
@@ -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<OverviewListProps> = ({ patientUuid }) => {
const config = useConfig();
const tabs = getMenuItemTabConfiguration(tptProgramManagemetConfigSchema, config);

return (
<div className={styles.tabContainer}>
<Tabs>
<TabList contained>
{tabs.map((tab) => (
<Tab key={tab.name}>{tab.name}</Tab>
))}
</TabList>
<TabPanels>
{tabs.map((tab) => (
<TabPanel>
<EncounterList
patientUuid={patientUuid}
formList={tab.formList}
columns={tab.columns}
encounterType={tab.encounterType}
launchOptions={tab.launchOptions}
headerTitle={tab.headerTitle}
description={tab.description}
/>
</TabPanel>
))}
</TabPanels>
</Tabs>
</div>
);
return <TabsComponent patientUuid={patientUuid} configSchema={tptProgramManagemetConfigSchema} config={config} />;
};

export default TptProgramManagementSummary;
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -9,23 +9,8 @@ interface OverviewListProps {

const TbTreatmentFollowUpList: React.FC<OverviewListProps> = ({ patientUuid }) => {
const config = useConfig();
const tabs = getMenuItemTabConfiguration(tbFollowupConfigSchema, config);

return (
<>
{tabs.map((tab) => (
<EncounterList
patientUuid={patientUuid}
encounterType={tab.encounterType}
formList={tab.formList}
columns={tab.columns}
description={tab.description}
headerTitle={tab.headerTitle}
launchOptions={tab.launchOptions}
/>
))}
</>
);
return <TabsComponent patientUuid={patientUuid} configSchema={tbFollowupConfigSchema} config={config} />;
};

export default TbTreatmentFollowUpList;
Loading