@campxdev/shared 0.5.8 → 0.5.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@campxdev/shared",
3
- "version": "0.5.8",
3
+ "version": "0.5.9",
4
4
  "main": "./exports.ts",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
@@ -52,7 +52,7 @@ const RenderMenuItem = ({menuItem}) => {
52
52
  const permissions = PermissionsStore.useState((s) => s).permissions
53
53
  const hasAccess = permissionKey ? permissions[permissionKey] : accessIfNoKey
54
54
 
55
- if (!hasAccess) return null
55
+ if (!hasAccess && !children?.length) return null
56
56
  if (children?.length)
57
57
  return (
58
58
  <Box
@@ -86,24 +86,22 @@ const DropDownMenu = ({path, title, icon, menuItems, permissionKey}) => {
86
86
  const [open, setOpen] = useState(false)
87
87
  const permissions = PermissionsStore.useState((s) => s).permissions
88
88
 
89
- // const validateDropdownAccess = () => {
90
- // if (accessIfNoKey && !permissions) return true
91
- // let arr = []
89
+ const validateDropdownAccess = () => {
90
+ if (accessIfNoKey && !permissions) return true
91
+ let arr = []
92
92
 
93
- // for (let i = 0; i < menuItems.length; i++) {
94
- // if (permissions[menuItems[i].permissionKey]) {
95
- // arr.push(true)
96
- // } else {
97
- // arr.push(accessIfNoKey)
98
- // }
99
- // }
93
+ for (let i = 0; i < menuItems.length; i++) {
94
+ if (permissions[menuItems[i].permissionKey]) {
95
+ arr.push(true)
96
+ } else {
97
+ arr.push(accessIfNoKey)
98
+ }
99
+ }
100
100
 
101
- // return arr.includes(true)
102
- // }
101
+ return arr.includes(true)
102
+ }
103
103
 
104
- // const dropdownAccess = validateDropdownAccess()
105
-
106
- // if (!dropdownAccess) return null
104
+ if (!validateDropdownAccess()) return null
107
105
  return (
108
106
  <>
109
107
  <Box