@buerokratt-ria/menu 0.1.9 → 0.1.11

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,14 @@
2
2
 
3
3
  All changes to this project will be documented in this file.
4
4
 
5
+ ## [0.1.11] - 30-05-2024
6
+
7
+ - Hide some Training Module menu items from production
8
+
9
+ ## [0.1.10] - 30-05-2024
10
+
11
+ - Hide some menu items from production
12
+
5
13
  ## [0.1.9] - 28-04-2024
6
14
 
7
15
  - 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.11",
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';
@@ -60,6 +60,7 @@
60
60
  "path": "/training/intents"
61
61
  },
62
62
  {
63
+ "hiddenMode": "production",
63
64
  "label": {
64
65
  "et": "Avalikud teemad",
65
66
  "en": "Public themes"
@@ -88,6 +89,7 @@
88
89
  "path": "/training/stories"
89
90
  },
90
91
  {
92
+ "hiddenMode": "production",
91
93
  "label": {
92
94
  "et": "Konfiguratsioon",
93
95
  "en": "Configuration"
@@ -109,6 +111,7 @@
109
111
  "path": "/training/slots"
110
112
  },
111
113
  {
114
+ "hiddenMode": "production",
112
115
  "label": {
113
116
  "et": "Automatic Teenused",
114
117
  "en": "Automatic Services"
@@ -132,6 +135,7 @@
132
135
  "path": "/history/history"
133
136
  },
134
137
  {
138
+ "hiddenMode": "production",
135
139
  "label": {
136
140
  "et": "Pöördumised",
137
141
  "en": "Appeals"
@@ -162,6 +166,7 @@
162
166
  "path": "/analytics/models"
163
167
  },
164
168
  {
169
+ "hiddenMode": "production",
165
170
  "label": {
166
171
  "et": "Testlood",
167
172
  "en": "testTracks"
@@ -226,6 +231,7 @@
226
231
  },
227
232
  {
228
233
  "id": "services",
234
+ "hiddenMode": "production",
229
235
  "label": {
230
236
  "et": "Teenused",
231
237
  "en": "Services"
@@ -332,6 +338,7 @@
332
338
  },
333
339
  {
334
340
  "id": "monitoring",
341
+ "hiddenMode": "production",
335
342
  "label": {
336
343
  "et": "Seire",
337
344
  "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