diff --git a/packages/esm-patient-chart-app/src/index.ts b/packages/esm-patient-chart-app/src/index.ts index b5f843804c..cb8a8eb260 100644 --- a/packages/esm-patient-chart-app/src/index.ts +++ b/packages/esm-patient-chart-app/src/index.ts @@ -6,7 +6,6 @@ import { defineExtensionConfigSchema, } from '@openmrs/esm-framework'; import { createDashboardLink } from '@openmrs/esm-patient-common-lib'; -import { capitalize } from 'lodash-es'; import { esmPatientChartSchema } from './config-schema'; import { moduleName, spaBasePath } from './constants'; import { setupCacheableRoutes, setupOfflineVisitsSync } from './offline'; diff --git a/packages/esm-patient-common-lib/src/dashboards/DashboardExtension.tsx b/packages/esm-patient-common-lib/src/dashboards/DashboardExtension.tsx index 0a664fa121..7442508570 100644 --- a/packages/esm-patient-common-lib/src/dashboards/DashboardExtension.tsx +++ b/packages/esm-patient-common-lib/src/dashboards/DashboardExtension.tsx @@ -1,17 +1,17 @@ import React, { useMemo } from 'react'; +import { useLocation } from 'react-router-dom'; import { last } from 'lodash'; - import { ConfigurableLink } from '@openmrs/esm-framework'; import styles from './dashboardextension.scss'; export interface DashboardExtensionProps { title: string; basePath: string; - currentPath: string; } -export const DashboardExtension = ({ title, basePath, currentPath }: DashboardExtensionProps) => { - const navLink = useMemo(() => decodeURIComponent(last(currentPath.split('/'))), [currentPath]); +export const DashboardExtension = ({ title, basePath }: DashboardExtensionProps) => { + const location = useLocation(); + const navLink = useMemo(() => decodeURIComponent(last(location.pathname.split('/'))), [location.pathname]); const activeClassName = title === navLink ? 'active-left-nav-link' : 'non-active'; diff --git a/packages/esm-patient-common-lib/src/dashboards/createDashboardLink.tsx b/packages/esm-patient-common-lib/src/dashboards/createDashboardLink.tsx index 4302d346ea..3f3e774ec5 100644 --- a/packages/esm-patient-common-lib/src/dashboards/createDashboardLink.tsx +++ b/packages/esm-patient-common-lib/src/dashboards/createDashboardLink.tsx @@ -3,8 +3,7 @@ import { DashboardLinkConfig } from '../types'; import { DashboardExtension } from './DashboardExtension'; export const createDashboardLink = (db: DashboardLinkConfig) => { - const Dashboard = ({ basePath, currentPath }: { basePath: string; currentPath: string }) => { - return ; + return ({ basePath }: { basePath: string }) => { + return ; }; - return Dashboard; };