@openmrs/esm-appointments-app 9.2.1-pre.6716 → 9.2.1-pre.6726

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,5 +0,0 @@
1
- /*!
2
- Copyright (c) 2018 Jed Watson.
3
- Licensed under the MIT License (MIT), see
4
- http://jedwatson.github.io/classnames
5
- */
@@ -1,39 +0,0 @@
1
- import React, { useMemo } from 'react';
2
- import classNames from 'classnames';
3
- import { ConfigurableLink } from '@openmrs/esm-framework';
4
- import { BrowserRouter, useLocation } from 'react-router-dom';
5
- import { useTranslation } from 'react-i18next';
6
-
7
- export interface DashboardLinkConfig {
8
- name: string;
9
- title: string;
10
- }
11
-
12
- function DashboardExtension({ dashboardLinkConfig }: { dashboardLinkConfig: DashboardLinkConfig }) {
13
- const { t } = useTranslation();
14
- const { name } = dashboardLinkConfig;
15
- const location = useLocation();
16
- const spaBasePath = `${window.spaBase}/home`;
17
-
18
- const navLink = useMemo(() => {
19
- const pathArray = location.pathname.split('/home');
20
- const lastElement = pathArray[pathArray.length - 1];
21
- return decodeURIComponent(lastElement);
22
- }, [location.pathname]);
23
-
24
- return (
25
- <ConfigurableLink
26
- className={classNames('cds--side-nav__link', {
27
- 'active-left-nav-link': navLink.match(name),
28
- })}
29
- to={`${spaBasePath}/${name}`}>
30
- {t('appointments', 'Appointments')}
31
- </ConfigurableLink>
32
- );
33
- }
34
-
35
- export const createDashboardLink = (dashboardLinkConfig: DashboardLinkConfig) => () => (
36
- <BrowserRouter>
37
- <DashboardExtension dashboardLinkConfig={dashboardLinkConfig} />
38
- </BrowserRouter>
39
- );