Skip to content
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

feat(sanity): hide global user menu inside Core UI Rendering Context #8591

Draft
wants to merge 1 commit into
base: feat/sapp-2363/studio-rendering-content-capability-gate
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {type RouterState, useRouterState} from 'sanity/router'
import {styled} from 'styled-components'

import {Button, TooltipDelayGroupProvider} from '../../../../ui-components'
import {CapabilityGate} from '../../../components/CapabilityGate'
import {type NavbarProps} from '../../../config/studio/types'
import {isDev} from '../../../environment'
import {useTranslation} from '../../../i18n'
Expand Down Expand Up @@ -285,9 +286,11 @@ export function StudioNavbar(props: Omit<NavbarProps, 'renderDefault'>) {
{actionNodes}

{shouldRender.tools && (
<Box flex="none" marginLeft={1}>
<UserMenu />
</Box>
<CapabilityGate capability="globalUserMenu">
<Box flex="none" marginLeft={1}>
<UserMenu />
</Box>
</CapabilityGate>
)}
</Flex>
</TooltipDelayGroupProvider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {styled} from 'styled-components'

import {Button} from '../../../../../ui-components'
import {UserAvatar} from '../../../../components'
import {CapabilityGate} from '../../../../components/CapabilityGate'
import {type NavbarAction, type Tool} from '../../../../config'
import {useTranslation} from '../../../../i18n'
import {useColorSchemeSetValue} from '../../../colorScheme'
Expand Down Expand Up @@ -162,18 +163,20 @@ export const NavDrawer = memo(function NavDrawer(props: NavDrawerProps) {
<Flex align="center">
{/* Current user */}
<Flex flex={1} align="center" paddingRight={2}>
<Flex flex={1} align="center">
<UserAvatar size={1} user="me" />
<Box
flex={1}
marginLeft={3}
title={currentUser?.name || currentUser?.email}
>
<Text size={1} textOverflow="ellipsis" weight="medium">
{currentUser?.name || currentUser?.email}
</Text>
</Box>
</Flex>
<CapabilityGate capability="globalUserMenu">
<Flex flex={1} align="center">
<UserAvatar size={1} user="me" />
<Box
flex={1}
marginLeft={3}
title={currentUser?.name || currentUser?.email}
>
<Text size={1} textOverflow="ellipsis" weight="medium">
{currentUser?.name || currentUser?.email}
</Text>
</Box>
</Flex>
</CapabilityGate>
</Flex>

<Button
Expand Down
Loading