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

(fix) O3-1224 Tablet mode: Side navigation widgets fails to identify the user ID #406

Merged
merged 1 commit into from
Apr 22, 2022
Merged
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
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