diff --git a/packages/sanity/src/core/studio/components/navbar/workspace/WorkspaceMenuButton.tsx b/packages/sanity/src/core/studio/components/navbar/workspace/WorkspaceMenuButton.tsx index 47f03bc42b9..da850e6ded4 100644 --- a/packages/sanity/src/core/studio/components/navbar/workspace/WorkspaceMenuButton.tsx +++ b/packages/sanity/src/core/studio/components/navbar/workspace/WorkspaceMenuButton.tsx @@ -10,6 +10,7 @@ import { import {styled} from 'styled-components' import {MenuButton, type MenuButtonProps, MenuItem, Tooltip} from '../../../../../ui-components' +import {CapabilityGate} from '../../../../components/CapabilityGate' import {useTranslation} from '../../../../i18n' import {useActiveWorkspace} from '../../../activeWorkspaceMatcher' import {useWorkspaces} from '../../../workspaces' @@ -53,9 +54,11 @@ export function WorkspaceMenuButton() { {activeWorkspace.title} - - - + + + + + @@ -64,39 +67,41 @@ export function WorkspaceMenuButton() { id="workspace-menu" menu={ !disabled && authStates ? ( - - {workspaces.map((workspace) => { - const authState = authStates[workspace.name] + + + {workspaces.map((workspace) => { + const authState = authStates[workspace.name] - // eslint-disable-next-line no-nested-ternary - const state = authState.authenticated - ? 'logged-in' - : workspace.auth.LoginComponent - ? 'logged-out' - : 'no-access' + // eslint-disable-next-line no-nested-ternary + const state = authState.authenticated + ? 'logged-in' + : workspace.auth.LoginComponent + ? 'logged-out' + : 'no-access' - const isSelected = workspace.name === activeWorkspace.name + const isSelected = workspace.name === activeWorkspace.name - // we have a temporary need to make a hard direct link to the workspace - // because of possibly shared context between workspaces. When this is resolved, - // we can remove this and use setActiveWorkspace instead - return ( - } - selected={isSelected} - __unstable_subtitle={workspace.subtitle} - __unstable_space={1} - text={workspace?.title || workspace.name} - /> - ) - })} - + // we have a temporary need to make a hard direct link to the workspace + // because of possibly shared context between workspaces. When this is resolved, + // we can remove this and use setActiveWorkspace instead + return ( + } + selected={isSelected} + __unstable_subtitle={workspace.subtitle} + __unstable_space={1} + text={workspace?.title || workspace.name} + /> + ) + })} + + ) : undefined } popover={POPOVER_PROPS}