@openmrs/esm-primary-navigation-app 3.2.1-pre.1144 → 3.2.1-pre.1155

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- import React, { useEffect, useRef } from "react";
1
+ import React, { useEffect, useMemo, useRef } from "react";
2
2
  import styles from "./side-menu-panel.component.scss";
3
- import { ExtensionSlot } from "@openmrs/esm-framework";
3
+ import { ExtensionSlot, usePatient } from "@openmrs/esm-framework";
4
4
  import { SideNav, SideNavProps } from "carbon-components-react";
5
5
 
6
6
  interface SideMenuPanelProps extends SideNavProps {
@@ -12,6 +12,12 @@ const SideMenuPanel: React.FC<SideMenuPanelProps> = ({
12
12
  hidePanel,
13
13
  }) => {
14
14
  const menuRef = useRef(null);
15
+ const { patientUuid } = usePatient();
16
+ const patientChartBasePath = `${window.spaBase}/patient/:patientUuid/chart`;
17
+ const basePath = useMemo(
18
+ () => patientChartBasePath.replace(":patientUuid", patientUuid),
19
+ [patientUuid]
20
+ );
15
21
 
16
22
  useEffect(() => {
17
23
  const handleClickOutside = (event: MouseEvent) => {
@@ -39,7 +45,10 @@ const SideMenuPanel: React.FC<SideMenuPanelProps> = ({
39
45
  className={styles.link}
40
46
  >
41
47
  <ExtensionSlot extensionSlotName="global-nav-menu-slot" />
42
- <ExtensionSlot extensionSlotName="patient-chart-dashboard-slot" />
48
+ <ExtensionSlot
49
+ extensionSlotName="patient-chart-dashboard-slot"
50
+ state={{ basePath }}
51
+ />
43
52
  </SideNav>
44
53
  )
45
54
  );