Skip to content

Commit

Permalink
type refactors
Browse files Browse the repository at this point in the history
  • Loading branch information
pirupius committed Sep 25, 2023
1 parent 49f45da commit fd7e87b
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 7 deletions.
59 changes: 59 additions & 0 deletions packages/esm-commons-lib/src/api/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,3 +219,62 @@ export interface PatientListRow {
lastVisit?: string;
actions?: React.ReactNode;
}

export interface PatientChartMeta {
/**
* Defines the slot name in slug case e.g. "covid-chart-summary"
*/
slot: string;
columns: number;
title: string;
}

// OHRI Dashboard Types
export interface OhriDashboardMeta {
/**
* Used to generate the menu title displayed on the sidenav
* @example "Covid Cases"
*/
menuTitle: string;
slot: string;
config: {
columns?: number;
type: string;
/**
* Conditionally rendor icon on menu item
*/
icon?: React.Component;
};
/**
* Determines if the dashboard is a folder
*/
isFolder?: boolean;
}

export interface OhriDashboardLinkMeta {
/**
* Used to generate route and slot names
* @example "covid-cases"
*/
name: string;
slot: string;
/**
* Used to generate the menu title displayed on the sidenav
* @example "Covid Cases"
*/
title: string;
config: {
columns?: number;
type?: string;
programme: string;
/**
* Title displayed on the welcome section of the dashboard
*/
dashboardTitle?: string;
/**
* Conditionally rendor icon on menu item
*/
icon?: React.Component;
};
isLink?: boolean;
}
8 changes: 4 additions & 4 deletions packages/esm-covid-app/src/dashboard.meta.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Coronavirus } from '@carbon/react/icons';
import { OhriDashboardLinkMeta, OhriDashboardMeta } from '@ohri/openmrs-esm-ohri-commons-lib';

// Patient Chart Dashboards
export const covidPatientChartMeta = {
Expand Down Expand Up @@ -32,17 +33,16 @@ export const covidVaccinationsDashboardMeta = {
};

// Clinical Dashboards
export const covidClinicalViewDashboardMeta = {
export const covidClinicalViewDashboardMeta: OhriDashboardMeta = {
menuTitle: 'COVID',
slot: 'ohri-covid-dashboard-slot',
config: { columns: 1, type: 'grid', icon: Coronavirus },
isFolder: true,
title: 'COVID',
};

export const covid19CasesDashboardMeta = {
export const covid19CasesDashboardMeta: OhriDashboardLinkMeta = {
name: 'covid-cases',
slot: 'covid-cases-dashboard-slot',
config: { columns: 1, type: 'grid', programme: 'covid', icon: Coronavirus },
title: 'COVID-19 Cases',
dashboardIcon: Coronavirus,
};
19 changes: 17 additions & 2 deletions packages/esm-hiv-app/src/dashboard.meta.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Home, Pills } from '@carbon/react/icons';
import { OhriDashboardLinkMeta, OhriDashboardMeta } from '@ohri/openmrs-esm-ohri-commons-lib';

// Patient Chart Dashboards
export const hivPreventionDashboardMeta = {
Expand Down Expand Up @@ -92,16 +93,30 @@ export const hivPreventionFolderDashboardMeta = {
title: 'HIV Prevention',
};

export const htsDashboardMeta = {
export const hivFolderDashboardMeta: OhriDashboardMeta = {
slot: 'ohri-hiv-dashboard-slot',
config: { columns: 1, type: 'grid', icon: Home },
isFolder: true,
menuTitle: 'HIV',
};

export const htsDashboardMeta: OhriDashboardLinkMeta = {
name: 'hts',
slot: 'hts-dashboard-slot',
config: { columns: 1, type: 'grid', programme: 'hts', dashboardTitle: 'HTS Home Page' },
title: 'HIV Testing Services',
};

export const careAndTreatmentDashboardMeta = {
export const careAndTreatmentDashboardMeta: OhriDashboardLinkMeta = {
name: 'care-and-treatment',
slot: 'ct-dashboard-slot',
config: { columns: 1, type: 'grid', programme: 'ct', dashboardTitle: 'C&T Home Page' },
title: 'Care and Treatment',
};

export const labResultsDashboardMeta: OhriDashboardLinkMeta = {
name: 'lab-results',
slot: 'lab-results-dashboard-slot',
config: { columns: 1, type: 'grid', programme: 'lab-results', dashboardTitle: 'Lab Results Home Page' },
title: 'Lab Results',
};
2 changes: 1 addition & 1 deletion packages/esm-ohri-pmtct-app/src/dashboard.meta.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const childVisitsDashboardMeta = {
export const motherChildDashboardMeta = {
name: 'mother-child-health',
slot: 'mother-child-health-dashboard-slot',
menuTitle: 'Maternal & Child Health',
config: {
columns: 1,
type: 'grid',
Expand All @@ -45,5 +46,4 @@ export const motherChildDashboardMeta = {
icon: PedestrianChild,
},
isLink: true,
title: 'Maternal & Child Health',
};

0 comments on commit fd7e87b

Please sign in to comment.