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

OHRI-1994 Add TB Program menu and tabs shell on the patient chart #1695

Merged
merged 3 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"start:cervical-cancer": "openmrs develop --backend https://ohri-dev.globalhealthapp.net --sources packages/esm-cervical-cancer-app",
"start:pmtct": "openmrs develop --backend https://ohri-namibia-dev.globalhealthapp.net --sources 'packages/esm-ohri-pmtct-app/'",
"start:form-render": "openmrs develop --backend https://ohri-dev.globalhealthapp.net --sources packages/esm-form-render-app",
"start:tb": "openmrs develop --backend https://ohri-dev.globalhealthapp.net --sources packages/esm-tb-app",
"prettier": "prettier --fix --config prettier.config.js --write \"packages/**/*.{ts,tsx}\"",
"prepare": "husky install",
"test": "jest --config jest.config.js --verbose false --passWithNoTests",
Expand Down
38 changes: 38 additions & 0 deletions packages/esm-tb-app/src/dashboard.meta.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,41 @@ export const tuberclosisMeta = {
title: 'Tuberclosis',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please delete this. I had added it as a place holder

slotName: 'tuberclosis-slot',
};

export const TbDashboardDMeta = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export const TbDashboardDMeta = {
export const tbPatientChartMeta = {

title: 'TB Program',
slotName: 'ohri-tb-slot',
isExpanded: false,
};

export const tbPatientSummaryDashboardMeta = {
slot: 'tb-patient-summary-dashboard-slot',
columns: 1,
title: 'Patient Summary',
path: 'tb-patient-summary',
layoutMode: 'anchored',
};

export const tbProgramManagementDashboardMeta = {
slot: 'tb-program-management-summary-slot',
columns: 1,
title: 'Program Management',
path: 'tb-program-management',
layoutMode: 'anchored',
};

export const tbTreatmentFollowUpDashboardMeta = {
slot: 'tb-treatment-follow-up-summary-slot',
columns: 1,
title: 'Treatment and follow-up',
path: 'tb-treatment-follow-up',
layoutMode: 'anchored',
};

export const tbContactListingDashboardMeta = {
slot: 'tb-contact-listing-summary-slot',
columns: 1,
title: 'Tb Contact Listing',
path: 'tb-contact-listing',
layoutMode: 'anchored',
};
57 changes: 57 additions & 0 deletions packages/esm-tb-app/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import { defineConfigSchema, getAsyncLifecycle, getSyncLifecycle } from '@openmrs/esm-framework';
import { createDashboardGroup, createDashboardLink } from '@openmrs/esm-patient-common-lib';
import {
TbDashboardDMeta,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update this name after meta change

tbContactListingDashboardMeta,
tbPatientSummaryDashboardMeta,
tbProgramManagementDashboardMeta,
tbTreatmentFollowUpDashboardMeta,
} from './dashboard.meta';

export const importTranslation = require.context('../translations', false, /.json$/, 'lazy');

Expand All @@ -15,3 +22,53 @@ const options = {
export function startupApp() {
defineConfigSchema(moduleName, {});
}

export const patientChartTbDashboard = getSyncLifecycle(createDashboardGroup(TbDashboardDMeta), options);

export const tbPatientSummaryDashboardLink = getSyncLifecycle(
createDashboardLink({ ...tbPatientSummaryDashboardMeta, moduleName }),
options,
);
export const tbPatientSummaryList = getAsyncLifecycle(
() => import('./views/patient-summary/tb-patient-summary.component'),
{
featureName: 'hts-service-summary-list',
moduleName,
},
);

export const tbProgramManagementDashboardLink = getSyncLifecycle(
createDashboardLink({ ...tbProgramManagementDashboardMeta, moduleName }),
options,
);
export const tbProgramManagementDashboard = getAsyncLifecycle(
() => import('./views/program-management/maternal-health.component'),
{
featureName: 'tb-program-management-summary',
moduleName,
},
);

export const tbTreatmentFollowUpDashboardLink = getSyncLifecycle(
createDashboardLink({ ...tbTreatmentFollowUpDashboardMeta, moduleName }),
options,
);
export const tbTreatmentFollowUpDashboard = getAsyncLifecycle(
() => import('./views/treatment-and-follow-up/tb-treatment-follow-up.component'),
{
featureName: 'tb-treatment-follow-up-summary',
moduleName,
},
);

export const tbContactListingDashboardLink = getSyncLifecycle(
createDashboardLink({ ...tbContactListingDashboardMeta, moduleName }),
options,
);
export const tbContactListingDashboard = getAsyncLifecycle(
() => import('./views/tb-contact-listing/tb-contact-list.component'),
{
featureName: 'tb-contact-listing-summary',
moduleName,
},
);
84 changes: 84 additions & 0 deletions packages/esm-tb-app/src/routes.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,89 @@
"pages": [
],
"extensions": [
{
"name": "tb-dashboard-link",
"slot": "dashboard-slot",
"component": "tbFolderLink",
"meta": {
"slot": "ohri-tb-dashboard-slot",
"isFolder": true,
"title": "TB Program"
}
},
{
"name": "ohri-tb",
"slot": "patient-chart-dashboard-slot",
"component": "patientChartTbDashboard",
"order": 21
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change this to 24 so that it appears HIV and COVID

},

{
"name": "tb-summary-dashboard",
"slot": "ohri-tb-slot",
"component": "tbPatientSummaryDashboardLink",
"meta": {
"slot": "tb-patient-summary-dashboard-slot",
"columns": 1,
"path": "tb-patient-summary",
"layoutMode": "anchored"
}
},
{
"name": "tb-patient-summary-ext",
"slot": "tb-patient-summary-dashboard-slot",
"component": "tbPatientSummaryList"
},

{
"name": "tb-program-management-summary",
"slot": "ohri-tb-slot",
"component": "tbProgramManagementDashboardLink",
"meta": {
"slot": "tb-program-management-summary-slot",
"columns": 1,
"path": "tb-program-management",
"layoutMode": "anchored"
}
},
{
"name": "tb-program-management-summary-ext",
"slot": "tb-program-management-summary-slot",
"component": "tbProgramManagementDashboard"
},

{
"name": "tb-treatment-follow-up-summary",
"slot": "ohri-tb-slot",
"component": "tbTreatmentFollowUpDashboardLink",
"meta": {
"slot": "tb-treatment-follow-up-summary-slot",
"columns": 1,
"path": "tb-treatment-follow-up",
"layoutMode": "anchored"
}
},
{
"name": "tb-treatment-follow-up-summary-ext",
"slot": "tb-treatment-follow-up-summary-slot",
"component": "tbTreatmentFollowUpDashboard"
},

{
"name": "tb-contact-listing-summary",
"slot": "ohri-tb-slot",
"component": "tbContactListingDashboardLink",
"meta": {
"slot": "tb-contact-listing-summary-slot",
"columns": 1,
"path": "tb-contact-listing",
"layoutMode": "anchored"
}
},
{
"name": "tb-contact-listing-summary-ext",
"slot": "tb-contact-listing-summary-slot",
"component": "tbContactListingDashboard"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { EmptyStateComingSoon } from '@ohri/openmrs-esm-ohri-commons-lib';
import React, { useMemo } from 'react';
import { useTranslation } from 'react-i18next';
interface OverviewListProps {
patientUuid: string;
}

const TBSummaryOverviewList: React.FC<OverviewListProps> = ({ patientUuid }) => {
const { t } = useTranslation();

const headerRecentTB = t('recentTuberculosis');
const headerPreviousCases = t('previousCases');
const headerVisit = t('visits');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add default incase a translation doesn't exist for example we don't have translations for this in Amaric


return (
<>
<EmptyStateComingSoon displayText={headerRecentTB} headerTitle={headerRecentTB} />
<EmptyStateComingSoon displayText={headerPreviousCases} headerTitle={headerPreviousCases} />
<EmptyStateComingSoon displayText={headerVisit} headerTitle={headerVisit} />
</>
);
};

export default TBSummaryOverviewList;
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import React from 'react';
import { Tabs, Tab, TabList, TabPanels, TabPanel } from '@carbon/react';
import styles from '../common.scss';
import { useTranslation } from 'react-i18next';
import MdrTbList from './tabs/mdr-tb.component';
import TbPatientTracing from './tabs/tb-patient-tracing.component';

interface OverviewListProps {
patientUuid: string;
}

const ProgramManagementSummary: React.FC<OverviewListProps> = ({ patientUuid }) => {
const { t } = useTranslation();
return (
<div className={styles.tabContainer}>
<Tabs>
<TabList contained>
<Tab>{t('MdrTbEnrolment')}</Tab>
<Tab>{t('PatientTracing')}</Tab>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment applies here. Change all occurrences of this within this PR

</TabList>
<TabPanels>
<TabPanel>
<MdrTbList patientUuid={patientUuid} />
</TabPanel>
<TabPanel>
<TbPatientTracing patientUuid={patientUuid} />
</TabPanel>
</TabPanels>
</Tabs>
</div>
);
};

export default ProgramManagementSummary;
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React, { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { EmptyStateComingSoon } from '@ohri/openmrs-esm-ohri-commons-lib';

interface MdrTbListProps {
patientUuid: string;
}

const MdrTbList: React.FC<MdrTbListProps> = ({ patientUuid }) => {
const { t } = useTranslation();
const headerTitle = t('MdrTbEnrolment');

return (
<>
<EmptyStateComingSoon displayText={headerTitle} headerTitle={headerTitle} />
</>
);
};

export default MdrTbList;
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React, { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { EmptyStateComingSoon } from '@ohri/openmrs-esm-ohri-commons-lib';

interface TbPatientTracingProps {
patientUuid: string;
}

const TbPatientTracing: React.FC<TbPatientTracingProps> = ({ patientUuid }) => {
const { t } = useTranslation();
const headerTitle = t('PatientTracing', 'Patient Tracing');

return (
<>
<EmptyStateComingSoon displayText={headerTitle} headerTitle={headerTitle} />
</>
);
};

export default TbPatientTracing;
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React, { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { EmptyStateComingSoon } from '@ohri/openmrs-esm-ohri-commons-lib';

interface TbContactTracingListProps {
patientUuid: string;
}

const TbContactTracingList: React.FC<TbContactTracingListProps> = ({ patientUuid }) => {
const { t } = useTranslation();
const headerTitle = t('TbContactListing');

return (
<>
<EmptyStateComingSoon displayText={headerTitle} headerTitle={headerTitle} />
</>
);
};

export default TbContactTracingList;
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React, { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { EmptyStateComingSoon } from '@ohri/openmrs-esm-ohri-commons-lib';

interface TbTreatmentFollowUpListProps {
patientUuid: string;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reuse the interface defined in the commons. I think it's PatientChartProps to avoid repetition


const TbTreatmentFollowUpList: React.FC<TbTreatmentFollowUpListProps> = ({ patientUuid }) => {
const { t } = useTranslation();
const headerTitle = t('TbTreatmentFollowUp');

return (
<>
<EmptyStateComingSoon displayText={headerTitle} headerTitle={headerTitle} />
</>
);
};

export default TbTreatmentFollowUpList;
9 changes: 8 additions & 1 deletion packages/esm-tb-app/translations/en.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
{
"tuberclosis": "Tuberclosis"
"tuberclosis": "Tuberclosis",
"MdrTbEnrolment": "TB/MDR TB Enrolment",
"PatientTracing": "Patient Tracing",
"TbTreatmentFollowUp": "TB Follow Up",
"TbContactListing": "TB Contact Listing",
"recentTuberculosis": "Recent Tuberclosis",
"previousCases": "Previous Case",
"visits": "Visits"
}