Skip to content

Commit

Permalink
(fix) Make appointments app lazy-load anything in the chart (#1314)
Browse files Browse the repository at this point in the history
* (fix) Make appointments app lazy-load anything in the chart

* Fixup some component names

---------

Co-authored-by: Dennis Kigen <[email protected]>
  • Loading branch information
ibacher and denniskigen authored Sep 9, 2024
1 parent 07d0432 commit e30bfe3
Show file tree
Hide file tree
Showing 3 changed files with 129 additions and 416 deletions.
28 changes: 15 additions & 13 deletions packages/esm-appointments-app/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
} from '@openmrs/esm-framework';
import { configSchema } from './config-schema';
import { createDashboardLink } from './createDashboardLink.component';
import { createDashboardLink as createPatientChartDashboardLink } from '@openmrs/esm-patient-common-lib';
import { dashboardMeta, appointmentCalendarDashboardMeta, patientChartDashboardMeta } from './dashboard.meta';
import {
cancelledAppointmentsPanelConfigSchema,
Expand All @@ -22,10 +21,7 @@ import appointmentsDashboardComponent from './appointments.component';
import homeAppointmentsComponent from './home/home-appointments.component';
import appointmentsListComponent from './appointments/scheduled/appointments-list.component';
import earlyAppointmentsComponent from './appointments/scheduled/early-appointments.component';
import patientAppointmentsDetailedSummaryComponent from './patient-appointments/patient-appointments-detailed-summary.component';
import patientAppointmentsOverviewComponent from './patient-appointments/patient-appointments-overview.component';
import patientUpcomingAppointmentsComponent from './patient-appointments/patient-upcoming-appointments-card.component';
import appointementsForm from './form/appointments-form.component';
import appointmentsFormComponent from './form/appointments-form.component';
import patientSearch from './patient-search/patient-search.component';
export const importTranslation = require.context('../translations', false, /.json$/, 'lazy');

Expand Down Expand Up @@ -79,24 +75,30 @@ export const appointmentsList = getSyncLifecycle(appointmentsListComponent, opti

export const earlyAppointments = getSyncLifecycle(earlyAppointmentsComponent, options);

export const appointementForm = getSyncLifecycle(appointementsForm, options);
export const appointmentsForm = getSyncLifecycle(appointmentsFormComponent, options);

export const searchPatient = getSyncLifecycle(patientSearch, options);

// t('Appointments', 'Appointments')
export const patientAppointmentsSummaryDashboardLink = getSyncLifecycle(
createPatientChartDashboardLink({ ...patientChartDashboardMeta, moduleName }),
export const patientAppointmentsSummaryDashboardLink = getAsyncLifecycle(async () => {
const commonLib = await import('@openmrs/esm-patient-common-lib');
return { default: commonLib.createDashboardLink({ ...patientChartDashboardMeta, moduleName }) };
}, options);

export const patientAppointmentsDetailedSummary = getAsyncLifecycle(
() => import('./patient-appointments/patient-appointments-detailed-summary.component'),
options,
);

export const patientAppointmentsDetailedSummary = getSyncLifecycle(
patientAppointmentsDetailedSummaryComponent,
export const patientAppointmentsOverview = getAsyncLifecycle(
() => import('./patient-appointments/patient-appointments-overview.component'),
options,
);

export const patientAppointmentsOverview = getSyncLifecycle(patientAppointmentsOverviewComponent, options);

export const patientUpcomingAppointmentsWidget = getSyncLifecycle(patientUpcomingAppointmentsComponent, options);
export const patientUpcomingAppointmentsWidget = getAsyncLifecycle(
() => import('./patient-appointments/patient-upcoming-appointments-card.component'),
options,
);

export const patientAppointmentsCancelConfirmationDialog = getAsyncLifecycle(
() => import('./patient-appointments/patient-appointments-cancel.modal'),
Expand Down
6 changes: 3 additions & 3 deletions packages/esm-appointments-app/src/routes.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
},
{
"name": "edit-appointments-form",
"component": "appointementForm",
"component": "appointmentsForm",
"meta": {
"title":{
"key":"editAppointment",
Expand All @@ -131,7 +131,7 @@
},
{
"name": "create-appointment",
"component": "appointementForm",
"component": "appointmentsForm",
"meta": {
"title": {
"key":"appointmentForm",
Expand All @@ -141,7 +141,7 @@
},
{
"name": "add-appointment",
"component": "appointementForm",
"component": "appointmentsForm",
"meta": {
"title": {
"key": "createNewAppointment",
Expand Down
Loading

0 comments on commit e30bfe3

Please sign in to comment.