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

(feat) O3-4400 - add a way to identify where the patient banner is be… #1292

Merged
merged 1 commit into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion packages/framework/esm-framework/docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -7098,7 +7098,7 @@ ___

#### Defined in

[packages/framework/esm-styleguide/src/patient-banner/patient-info/patient-banner-patient-info.component.tsx:54](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/patient-banner/patient-info/patient-banner-patient-info.component.tsx#L54)
[packages/framework/esm-styleguide/src/patient-banner/patient-info/patient-banner-patient-info.component.tsx:61](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/patient-banner/patient-info/patient-banner-patient-info.component.tsx#L61)

___

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ import styles from './patient-banner-patient-info.module.scss';

interface PatientBannerPatientInfoProps {
patient: fhir.Patient;

/**
* A unique string to identify where the PatientInfo is rendered from.
* (ex: Patient Chart, search app, etc...). This string is passed into extensions to
* affect how / if they should be rendered
*/
renderedFrom?: string;
}

type Gender = 'female' | 'male' | 'other' | 'unknown';
Expand Down Expand Up @@ -51,11 +58,14 @@ const getGender = (gender: string) => {
};
};

export function PatientBannerPatientInfo({ patient }: PatientBannerPatientInfoProps) {
export function PatientBannerPatientInfo({ patient, renderedFrom }: PatientBannerPatientInfoProps) {
const name = `${patient?.name?.[0]?.given?.join(' ')} ${patient?.name?.[0]?.family}`;
const genderInfo = patient?.gender && getGender(patient.gender);

const extensionState = useMemo(() => ({ patientUuid: patient.id, patient }), [patient.id, patient]);
const extensionState = useMemo(
() => ({ patientUuid: patient.id, patient, renderedFrom }),
[patient.id, patient, renderedFrom],
);

return (
<div className={styles.patientInfo}>
Expand Down Expand Up @@ -83,6 +93,7 @@ export function PatientBannerPatientInfo({ patient }: PatientBannerPatientInfoPr
</>
)}
<PatientBannerPatientIdentifiers identifiers={patient.identifier} showIdentifierLabel />
<ExtensionSlot className={styles.extensionSlot} name="patient-banner-bottom-slot" state={extensionState} />
</div>
</div>
);
Expand Down
Loading