Skip to content

Commit

Permalink
Review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
vasharma05 committed Oct 3, 2024
1 parent 1655c0d commit edee1d3
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions packages/esm-patient-banner-app/src/config-schema.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Type } from '@openmrs/esm-framework';
import _default from 'react-hook-form/dist/logic/appendErrors';

export const configSchema = {
contactAttributeTypes: {
Expand All @@ -21,7 +20,8 @@ export const configSchema = {
},
header: {
_type: Type.Object,
_description: 'The header to display on the patient sticker',
_description:
'Configuration properties for the patient sticker headerConfiguration properties for the patient sticker header',
showBarcode: {
_type: Type.Boolean,
_description: 'Whether to display a barcode on the patient sticker',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export const PatientIdentifier: React.FC<PatientDetailProps> = ({ patient }) =>
export const PatientContact: React.FC<PatientDetailProps> = ({ patient }) => {
const { t } = useTranslation();

if (patient.telecom.length == 0) {
if (!patient?.telecom?.length) {
return null;
}

Expand All @@ -104,7 +104,7 @@ export const PatientContact: React.FC<PatientDetailProps> = ({ patient }) => {
<span>
<strong className={styles.strong}>{t('telephoneNumberWithSeparator', 'Telephone number:')}</strong>
</span>
<span className={styles.patientDetail}>{patient.telecom[0]?.value}</span>
<span className={styles.patientDetail}>{patient.telecom?.[0]?.value}</span>
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { render, screen } from '@testing-library/react';
import PrintIdentifierSticker from './print-identifier-sticker.modal';
import { mockFhirPatient } from '../../../../__mocks__/patient.mock';
import { getDefaultsFromConfigSchema, useConfig } from '@openmrs/esm-framework';
import { age, getDefaultsFromConfigSchema, useConfig } from '@openmrs/esm-framework';
import { type ConfigObject, configSchema } from '../config-schema';
import { useReactToPrint } from 'react-to-print';
import userEvent from '@testing-library/user-event';
Expand Down Expand Up @@ -109,7 +109,7 @@ describe('Testing PrintIdentifierStickerModal', () => {
expect(getByTextWithMarkup(/Joshua Johnson/i)).toBeInTheDocument();
expect(getByTextWithMarkup(/\+255777053243/i)).toBeInTheDocument();
expect(getByTextWithMarkup(/100008E/i)).toBeInTheDocument();
expect(getByTextWithMarkup(/4 yrs, 11 mths/i)).toBeInTheDocument();
expect(getByTextWithMarkup(age(mockFhirPatient.birthDate))).toBeInTheDocument();
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ const PrintIdentifierSticker: React.FC<PrintIdentifierStickerProps> = ({ closeMo
const handleAfterPrint = useCallback(() => {
onBeforeGetContentResolve.current = null;
setIsPrinting(false);
// closeModal();
}, []);
closeModal();
}, [closeModal]);

const handlePrintError = useCallback((errorLocation, error) => {
onBeforeGetContentResolve.current = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {

export const defaultBarcodeParams: Options = {
width: 2,
format: 'CODE39',
background: '#f4f4f4',
displayValue: true,
renderer: 'img',
Expand Down

0 comments on commit edee1d3

Please sign in to comment.