@visns-studio/visns-components 1.4.4 → 1.4.6

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.
@@ -130,14 +130,25 @@ function Navigation({ logo, logout, navConfig, setSystemAuth, userProfile }) {
130
130
  const permissions = userProfile.roles[0].permissions;
131
131
 
132
132
  setNavData((prevNavData) => {
133
- const updatedNavData = prevNavData.navigations.map((nav) => ({
133
+ const updatedNavigations = prevNavData.navigations.map((nav) => ({
134
134
  ...nav,
135
135
  permission: permissions.some(
136
136
  (permission) => permission.name === nav.permissionKey
137
137
  ),
138
138
  }));
139
139
 
140
- return { ...prevNavData, navigations: updatedNavData };
140
+ const updatedSettings = prevNavData.settings.map((nav) => ({
141
+ ...nav,
142
+ permission: permissions.some(
143
+ (permission) => permission.name === nav.permissionKey
144
+ ),
145
+ }));
146
+
147
+ return {
148
+ ...prevNavData,
149
+ navigations: updatedNavigations,
150
+ settings: updatedSettings,
151
+ };
141
152
  });
142
153
  }, [userProfile]);
143
154
 
@@ -174,7 +185,8 @@ function Navigation({ logo, logout, navConfig, setSystemAuth, userProfile }) {
174
185
  <div className="navwrap">
175
186
  <ul className={appNavClasses}>
176
187
  {navData.navigations.map((nav, navKey) =>
177
- nav.permission === true ? (
188
+ nav.permission === true ||
189
+ nav.permissionKey === "" ? (
178
190
  <React.Fragment key={`nav-item-${navKey}`}>
179
191
  {renderNav(nav)}
180
192
  </React.Fragment>
@@ -184,11 +196,14 @@ function Navigation({ logo, logout, navConfig, setSystemAuth, userProfile }) {
184
196
  </div>
185
197
  <div className="hactions">
186
198
  <ul>
187
- {navData.settings.map((setting, settingKey) => (
188
- <React.Fragment key={`setting-${settingKey}`}>
189
- {renderSetting(setting)}
190
- </React.Fragment>
191
- ))}
199
+ {navData.settings.map((setting, settingKey) =>
200
+ nav.permission === true ||
201
+ nav.permissionKey === "" ? (
202
+ <React.Fragment key={`setting-${settingKey}`}>
203
+ {renderSetting(setting)}
204
+ </React.Fragment>
205
+ ) : null
206
+ )}
192
207
  </ul>
193
208
  </div>
194
209
  </div>
package/package.json CHANGED
@@ -34,7 +34,7 @@
34
34
  "react-dom": "^17.0.1"
35
35
  },
36
36
  "name": "@visns-studio/visns-components",
37
- "version": "1.4.4",
37
+ "version": "1.4.6",
38
38
  "description": "Various packages to assist in the development of our Custom Applications.",
39
39
  "main": "index.js",
40
40
  "devDependencies": {},