Skip to content

Commit

Permalink
rename close back since we dont close SwitchRoles dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
fiskus committed May 24, 2024
1 parent ce9aa46 commit af88c94
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions catalog/app/containers/NavBar/NavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ function UserDropdown({ user }: UserDropdownProps) {
[setAnchor],
)

const closeDropdown = React.useCallback(() => {
const close = React.useCallback(() => {
setVisible(false)
setAnchor(null)
}, [setAnchor])
Expand All @@ -296,13 +296,13 @@ function UserDropdown({ user }: UserDropdownProps) {
const showBookmarks = React.useCallback(() => {
if (!bookmarks) return
bookmarks.show()
closeDropdown()
}, [bookmarks, closeDropdown])
close()
}, [bookmarks, close])

const showRolesSwitcher = React.useCallback(
() => openDialog(() => <RolesSwitcher user={user} />, SWITCH_ROLES_DIALOG_PROPS),
[openDialog, user],
)
const showRolesSwitcher = React.useCallback(() => {
openDialog(() => <RolesSwitcher user={user} />, SWITCH_ROLES_DIALOG_PROPS)
close()

Check warning on line 304 in catalog/app/containers/NavBar/NavBar.tsx

View check run for this annotation

Codecov / codecov/patch/informational

catalog/app/containers/NavBar/NavBar.tsx#L302-L304

Added lines #L302 - L304 were not covered by tests
}, [openDialog, close, user])

React.useEffect(() => {
const hasUpdates = bookmarks?.hasUpdates || false
Expand All @@ -319,7 +319,7 @@ function UserDropdown({ user }: UserDropdownProps) {
</M.Button>

<M.MuiThemeProvider theme={style.appTheme}>
<M.Menu anchorEl={anchor} open={!!anchor} onClose={closeDropdown}>
<M.Menu anchorEl={anchor} open={!!anchor} onClose={close}>
{bookmarks && (
<Item onClick={showBookmarks}>
<Badge color="secondary" invisible={!visible}>
Expand All @@ -334,16 +334,16 @@ function UserDropdown({ user }: UserDropdownProps) {
</Item>
)}
{user.isAdmin && (
<Item to={urls.admin()} onClick={closeDropdown} selected={isAdmin} divider>
<Item to={urls.admin()} onClick={close} selected={isAdmin} divider>
<M.Icon fontSize="small">security</M.Icon>&nbsp;Admin settings
</Item>
)}
{cfg.mode === 'OPEN' && (
<Item to={urls.profile()} onClick={closeDropdown} selected={isProfile}>
<Item to={urls.profile()} onClick={close} selected={isProfile}>
Profile
</Item>
)}
<Item to={urls.signOut()} onClick={closeDropdown}>
<Item to={urls.signOut()} onClick={close}>
Sign Out
</Item>
</M.Menu>
Expand Down

0 comments on commit af88c94

Please sign in to comment.