@openmrs/esm-primary-navigation-app 3.2.0 → 3.2.1-pre.933

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.
@@ -7,6 +7,7 @@ import {
7
7
  } from "@openmrs/esm-framework";
8
8
  import { HeaderPanel } from "carbon-components-react";
9
9
  import Launch16 from "@carbon/icons-react/es/launch/16";
10
+ import { useTranslation } from "react-i18next";
10
11
 
11
12
  interface AppMenuProps {
12
13
  expanded: boolean;
@@ -16,6 +17,7 @@ interface AppMenuProps {
16
17
  const AppMenuPanel: React.FC<AppMenuProps> = ({ expanded, hidePanel }) => {
17
18
  const appMenuRef = useOnClickOutside<HTMLDivElement>(hidePanel, expanded);
18
19
  const config = useConfig();
20
+ const { t } = useTranslation();
19
21
 
20
22
  return (
21
23
  <HeaderPanel
@@ -28,24 +30,16 @@ const AppMenuPanel: React.FC<AppMenuProps> = ({ expanded, hidePanel }) => {
28
30
  className={styles.menuLink}
29
31
  extensionSlotName="app-menu-slot"
30
32
  />
31
- {config?.externalRefLinks?.enabled &&
32
- config?.externalRefLinks?.links.length > 0 && (
33
- <div className={`${styles.menuLink} ${styles.externalLinks}`}>
34
- {config?.externalRefLinks?.links?.map(
35
- (link) =>
36
- link?.visible && (
37
- <a
38
- target="_blank"
39
- rel="noopener noreferrer"
40
- href={link?.redirect}
41
- >
42
- {link?.title}
43
- <Launch16 className={styles.launchIcon} />
44
- </a>
45
- )
46
- )}
47
- </div>
48
- )}
33
+ {config?.externalRefLinks?.length > 0 && (
34
+ <div className={`${styles.menuLink} ${styles.externalLinks}`}>
35
+ {config?.externalRefLinks?.map((link) => (
36
+ <a target="_blank" rel="noopener noreferrer" href={link?.redirect}>
37
+ {t(link?.title)}
38
+ <Launch16 className={styles.launchIcon} />
39
+ </a>
40
+ ))}
41
+ </div>
42
+ )}
49
43
  </HeaderPanel>
50
44
  );
51
45
  };
@@ -1,4 +1,4 @@
1
- import { Type } from "@openmrs/esm-framework";
1
+ import { Type, validators } from "@openmrs/esm-framework";
2
2
 
3
3
  export const configSchema = {
4
4
  logo: {
@@ -20,36 +20,19 @@ export const configSchema = {
20
20
  },
21
21
  },
22
22
  externalRefLinks: {
23
- enabled: {
24
- _type: Type.Boolean,
25
- _default: true,
26
- _description: "Whether to show external links in the app menu",
27
- },
28
- links: {
29
- _type: Type.Array,
30
- _elements: {
31
- visible: {
32
- _type: Type.Boolean,
33
- _description: "Whether to show a link in the menu",
34
- _default: true,
35
- },
36
- title: {
37
- _type: Type.String,
38
- _description: "Title of the link",
39
- },
40
- redirect: {
41
- _type: Type.String,
42
- _description: "Link to redirect to (must be an external link)",
43
- },
23
+ _type: Type.Array,
24
+ _elements: {
25
+ title: {
26
+ _type: Type.String,
27
+ _description: "Title of the link",
28
+ },
29
+ redirect: {
30
+ _type: Type.String,
31
+ _description: "Link to redirect to (must be an external link)",
32
+ _validators: [validators.isUrl],
44
33
  },
45
- _default: [
46
- {
47
- visible: false,
48
- title: "External link",
49
- redirect: "/external-link",
50
- },
51
- ],
52
- _description: "The links to be showcased in the app menu",
53
34
  },
35
+ _default: [],
36
+ _description: "The external links to be showcased in the app menu",
54
37
  },
55
38
  };