mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-24 17:58:27 +02:00
Fix environment dialog hotkey
This commit is contained in:
@@ -68,23 +68,6 @@ export const EnvironmentActionsDropdown = memo(function EnvironmentActionsDropdo
|
|||||||
const hasWorkspaceVars =
|
const hasWorkspaceVars =
|
||||||
(activeWorkspace?.variables ?? []).filter((v) => v.enabled && (v.name || v.value)).length > 0;
|
(activeWorkspace?.variables ?? []).filter((v) => v.enabled && (v.name || v.value)).length > 0;
|
||||||
|
|
||||||
if (environments.length === 0) {
|
|
||||||
return (
|
|
||||||
<Button
|
|
||||||
size="sm"
|
|
||||||
className={classNames(
|
|
||||||
className,
|
|
||||||
'text !px-2 truncate',
|
|
||||||
!hasWorkspaceVars && 'text-text-subtlest italic',
|
|
||||||
)}
|
|
||||||
onClick={showEnvironmentDialog}
|
|
||||||
{...buttonProps}
|
|
||||||
>
|
|
||||||
Environment
|
|
||||||
</Button>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dropdown items={items}>
|
<Dropdown items={items}>
|
||||||
<Button
|
<Button
|
||||||
@@ -94,6 +77,9 @@ export const EnvironmentActionsDropdown = memo(function EnvironmentActionsDropdo
|
|||||||
'text !px-2 truncate',
|
'text !px-2 truncate',
|
||||||
!activeEnvironment && !hasWorkspaceVars && 'text-text-subtlest italic',
|
!activeEnvironment && !hasWorkspaceVars && 'text-text-subtlest italic',
|
||||||
)}
|
)}
|
||||||
|
// If no environments, the button simply opens the dialog.
|
||||||
|
// NOTE: We don't create a new button because we want to reuse the hotkey from the menu items
|
||||||
|
onClick={environments.length === 0 ? showEnvironmentDialog : undefined}
|
||||||
{...buttonProps}
|
{...buttonProps}
|
||||||
>
|
>
|
||||||
{activeEnvironment?.name ?? (hasWorkspaceVars ? 'Environment' : 'No Environment')}
|
{activeEnvironment?.name ?? (hasWorkspaceVars ? 'Environment' : 'No Environment')}
|
||||||
|
|||||||
Reference in New Issue
Block a user