-
Notifications
You must be signed in to change notification settings - Fork 223
feat(permissions): Adding the permission shield overlay to Sistent base components #1686
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rishiraj38
wants to merge
11
commits into
layer5io:master
Choose a base branch
from
rishiraj38:feat/unified-permission-components
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+427
−28
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
ba15a63
feat(permissions): integrate unified permission API in core components
rishiraj38 3eac2bc
Merge branch 'master' into feat/unified-permission-components
Rajesh-Nagarajan-11 c59cc66
[Permissions] Simplify permission shield components to be visual-only
rishiraj38 933c886
[Permissions] Fix explicit any type lint errors in permissions.tsx
rishiraj38 6cd176b
Merge branch 'master' into feat/unified-permission-components
rishiraj38 8d0d2e1
[Permissions] Fix transitive dependency pollution by using base Toolt…
rishiraj38 33253e9
[Permissions] Format tooltip as a structured card and coordinate acti…
rishiraj38 c49d107
fixing-missing-names
rishiraj38 99c00d5
applying-gemini-suggestions
rishiraj38 78a26e8
fix-build
rishiraj38 464f35a
update-the-tooltip
rishiraj38 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,29 @@ | ||
| import { ListItem as MuiListItem, ListItemProps as MuiListItemProps } from '@mui/material'; | ||
| import React from 'react'; | ||
| import { Key, PermissionShield } from '../../custom/permissions'; | ||
|
|
||
| const ListItem = React.forwardRef<HTMLLIElement, MuiListItemProps>((props, ref) => { | ||
| return <MuiListItem {...props} ref={ref} />; | ||
| export interface ListItemProps extends MuiListItemProps { | ||
| permissionKey?: Key; | ||
| disabled?: boolean; | ||
| } | ||
|
|
||
| const ListItem = React.forwardRef<HTMLLIElement, ListItemProps>((props, ref) => { | ||
| const { permissionKey, disabled, ...rest } = props; | ||
|
|
||
| // When disabled AND permissionKey is provided, show the shield overlay | ||
| // Note: MUI ListItem doesn't have a native `disabled` prop, so we only use | ||
| // it as a custom guard for the PermissionShield wrapper | ||
| if (disabled && permissionKey) { | ||
| return ( | ||
| <PermissionShield permissionKey={permissionKey} variant="inline"> | ||
| <MuiListItem {...rest} ref={ref} /> | ||
| </PermissionShield> | ||
| ); | ||
| } | ||
|
|
||
| return <MuiListItem {...rest} ref={ref} />; | ||
| }); | ||
|
|
||
| ListItem.displayName = 'ListItem'; | ||
|
|
||
| export default ListItem; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,24 @@ | ||
| import { MenuItem as MuiMenuItem, MenuItemProps as MuiMenuItemProps } from '@mui/material'; | ||
| import React from 'react'; | ||
| import { Key, PermissionShield } from '../../custom/permissions'; | ||
|
|
||
| export function MenuItem(props: MuiMenuItemProps): JSX.Element { | ||
| return <MuiMenuItem {...props} />; | ||
| export interface MenuItemProps extends MuiMenuItemProps { | ||
| permissionKey?: Key; | ||
| } | ||
|
|
||
| export function MenuItem(props: MenuItemProps): JSX.Element { | ||
| const { permissionKey, disabled, ...rest } = props; | ||
|
|
||
| // When disabled AND permissionKey is provided, show the shield overlay | ||
| if (disabled && permissionKey) { | ||
| return ( | ||
| <PermissionShield permissionKey={permissionKey} variant="inline"> | ||
| <MuiMenuItem {...rest} disabled={true} /> | ||
| </PermissionShield> | ||
| ); | ||
| } | ||
|
|
||
| return <MuiMenuItem {...rest} disabled={disabled} />; | ||
| } | ||
|
|
||
| export default MenuItem; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.