Skip to content

Commit

Permalink
(fix) O3-1224 Tablet mode: Side navigation widgets fails to identify …
Browse files Browse the repository at this point in the history
…the user ID (#406)
  • Loading branch information
brandones authored Apr 22, 2022
1 parent c66b9f1 commit a2370ec
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useEffect, useRef } from "react";
import React, { useEffect, useMemo, useRef } from "react";
import styles from "./side-menu-panel.component.scss";
import { ExtensionSlot } from "@openmrs/esm-framework";
import { ExtensionSlot, usePatient } from "@openmrs/esm-framework";
import { SideNav, SideNavProps } from "carbon-components-react";

interface SideMenuPanelProps extends SideNavProps {
Expand All @@ -12,6 +12,12 @@ const SideMenuPanel: React.FC<SideMenuPanelProps> = ({
hidePanel,
}) => {
const menuRef = useRef(null);
const { patientUuid } = usePatient();
const patientChartBasePath = `${window.spaBase}/patient/:patientUuid/chart`;
const basePath = useMemo(
() => patientChartBasePath.replace(":patientUuid", patientUuid),
[patientUuid]
);

useEffect(() => {
const handleClickOutside = (event: MouseEvent) => {
Expand Down Expand Up @@ -39,7 +45,10 @@ const SideMenuPanel: React.FC<SideMenuPanelProps> = ({
className={styles.link}
>
<ExtensionSlot extensionSlotName="global-nav-menu-slot" />
<ExtensionSlot extensionSlotName="patient-chart-dashboard-slot" />
<ExtensionSlot
extensionSlotName="patient-chart-dashboard-slot"
state={{ basePath }}
/>
</SideNav>
)
);
Expand Down

0 comments on commit a2370ec

Please sign in to comment.