@buerokratt-ria/menu 0.1.9 → 0.1.10

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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  All changes to this project will be documented in this file.
4
4
 
5
+ ## [0.1.10] - 30-05-2024
6
+
7
+ - Hide some menu items from production
8
+
5
9
  ## [0.1.9] - 28-04-2024
6
10
 
7
11
  - Merge previous code
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buerokratt-ria/menu",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "Generic MainNavigation component that would be injected as dependency.",
5
5
  "main": "index.js",
6
6
  "scripts": {},
@@ -0,0 +1,3 @@
1
+ export const isHiddenFeaturesEnabled =
2
+ import.meta.env.REACT_APP_ENABLE_HIDDEN_FEATURES?.toLowerCase().trim() == 'true' ||
3
+ import.meta.env.REACT_APP_ENABLE_HIDDEN_FEATURES?.toLowerCase().trim() == '1';
@@ -226,6 +226,7 @@
226
226
  },
227
227
  {
228
228
  "id": "services",
229
+ "hiddenMode": "production",
229
230
  "label": {
230
231
  "et": "Teenused",
231
232
  "en": "Services"
@@ -332,6 +333,7 @@
332
333
  },
333
334
  {
334
335
  "id": "monitoring",
336
+ "hiddenMode": "production",
335
337
  "label": {
336
338
  "et": "Seire",
337
339
  "en": "Monitoring"
@@ -17,6 +17,7 @@ import './main-navigation.scss';
17
17
  import { useQuery } from '@tanstack/react-query';
18
18
  import { useTranslation } from "react-i18next";
19
19
  import menuStructure from './data/menu-structure.json';
20
+ import { isHiddenFeaturesEnabled } from './constants';
20
21
 
21
22
  interface MenuItem {
22
23
  id?: string;
@@ -25,6 +26,7 @@ interface MenuItem {
25
26
  target?: '_blank' | '_self';
26
27
  children?: MenuItem[];
27
28
  hidden?: boolean;
29
+ hiddenMode?: 'production' | 'development' | 'staging' | 'testing';
28
30
  }
29
31
 
30
32
  interface TranslatedLabel {
@@ -106,7 +108,10 @@ const MainNavigation: FC<{items: MenuItem[], serviceId: string[]}> = ( {items, s
106
108
  };
107
109
 
108
110
  const renderMenuTree = (menuItems: MenuItem[]) => {
109
- return menuItems.filter(x => !x.hidden).map((menuItem) => (
111
+ return menuItems
112
+ .filter(x => !x.hidden)
113
+ .filter(x => isHiddenFeaturesEnabled || x.hiddenMode !== "production")
114
+ .map((menuItem) => (
110
115
  <li key={menuItem.label[currentlySelectedLanguage]}>
111
116
  {!!menuItem.children ? (
112
117
  <>
Binary file