Skip to content

Commit

Permalink
(fix) Pass patient object to the banner action buttons (#1158)
Browse files Browse the repository at this point in the history
* Pass patient object to the banner action buttons

* Update documentation
  • Loading branch information
vasharma05 authored Sep 26, 2024
1 parent ce1346d commit 0e40c94
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
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 @@ -6675,7 +6675,7 @@ ___

#### Defined in

[packages/framework/esm-styleguide/src/patient-banner/actions-menu/patient-banner-actions-menu.component.tsx:20](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/patient-banner/actions-menu/patient-banner-actions-menu.component.tsx#L20)
[packages/framework/esm-styleguide/src/patient-banner/actions-menu/patient-banner-actions-menu.component.tsx:21](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/patient-banner/actions-menu/patient-banner-actions-menu.component.tsx#L21)

___

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- [actionsSlotName](PatientBannerActionsMenuProps.md#actionsslotname)
- [additionalActionsSlotState](PatientBannerActionsMenuProps.md#additionalactionsslotstate)
- [isDeceased](PatientBannerActionsMenuProps.md#isdeceased)
- [patient](PatientBannerActionsMenuProps.md#patient)
- [patientUuid](PatientBannerActionsMenuProps.md#patientuuid)

## UI Properties
Expand All @@ -19,7 +20,7 @@

#### Defined in

[packages/framework/esm-styleguide/src/patient-banner/actions-menu/patient-banner-actions-menu.component.tsx:12](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/patient-banner/actions-menu/patient-banner-actions-menu.component.tsx#L12)
[packages/framework/esm-styleguide/src/patient-banner/actions-menu/patient-banner-actions-menu.component.tsx:13](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/patient-banner/actions-menu/patient-banner-actions-menu.component.tsx#L13)

___

Expand All @@ -32,7 +33,7 @@ so as to keep the PatientBannerActionsMenu API clean.

#### Defined in

[packages/framework/esm-styleguide/src/patient-banner/actions-menu/patient-banner-actions-menu.component.tsx:17](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/patient-banner/actions-menu/patient-banner-actions-menu.component.tsx#L17)
[packages/framework/esm-styleguide/src/patient-banner/actions-menu/patient-banner-actions-menu.component.tsx:18](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/patient-banner/actions-menu/patient-banner-actions-menu.component.tsx#L18)

___

Expand All @@ -42,7 +43,17 @@ ___

#### Defined in

[packages/framework/esm-styleguide/src/patient-banner/actions-menu/patient-banner-actions-menu.component.tsx:11](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/patient-banner/actions-menu/patient-banner-actions-menu.component.tsx#L11)
[packages/framework/esm-styleguide/src/patient-banner/actions-menu/patient-banner-actions-menu.component.tsx:12](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/patient-banner/actions-menu/patient-banner-actions-menu.component.tsx#L12)

___

### patient

**patient**: `Patient`

#### Defined in

[packages/framework/esm-styleguide/src/patient-banner/actions-menu/patient-banner-actions-menu.component.tsx:10](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/patient-banner/actions-menu/patient-banner-actions-menu.component.tsx#L10)

___

Expand All @@ -52,4 +63,4 @@ ___

#### Defined in

[packages/framework/esm-styleguide/src/patient-banner/actions-menu/patient-banner-actions-menu.component.tsx:10](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/patient-banner/actions-menu/patient-banner-actions-menu.component.tsx#L10)
[packages/framework/esm-styleguide/src/patient-banner/actions-menu/patient-banner-actions-menu.component.tsx:11](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/patient-banner/actions-menu/patient-banner-actions-menu.component.tsx#L11)
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
/** @module @category UI */
import React, { useMemo } from 'react';
import { OverflowMenuVertical } from '@carbon/react/icons';
import { ExtensionSlot, useConnectedExtensions } from '@openmrs/esm-react-utils';
import { ExtensionSlot, useConnectedExtensions, usePatient } from '@openmrs/esm-react-utils';
import { getCoreTranslation } from '@openmrs/esm-translations';
import { CustomOverflowMenu } from '../../custom-overflow-menu/custom-overflow-menu.component';
import styles from './patient-banner-actions-menu.module.scss';

export interface PatientBannerActionsMenuProps {
patient: fhir.Patient;
patientUuid: string;
isDeceased: boolean;
actionsSlotName: string;
Expand All @@ -18,14 +19,15 @@ export interface PatientBannerActionsMenuProps {
}

export function PatientBannerActionsMenu({
patient,
patientUuid,
actionsSlotName,
isDeceased,
additionalActionsSlotState,
}: PatientBannerActionsMenuProps) {
const patientActions = useConnectedExtensions(actionsSlotName);
const patientActionsSlotState = useMemo(
() => ({ patientUuid, ...additionalActionsSlotState }),
() => ({ patientUuid, patient, ...additionalActionsSlotState }),
[patientUuid, additionalActionsSlotState],
);

Expand Down

0 comments on commit 0e40c94

Please sign in to comment.