@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
|
Binary file
|
package/package.json
CHANGED
|
@@ -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"
|
package/src/menu/index.tsx
CHANGED
|
@@ -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
|
|
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
|