Env dialog hotkey

This commit is contained in:
Gregory Schier
2023-11-21 22:35:28 -08:00
parent 15aa93f5f9
commit 4f9d1278f7
5 changed files with 45 additions and 7 deletions

View File

@@ -3,6 +3,7 @@ import { memo, useCallback, useMemo } from 'react';
import { useActiveEnvironment } from '../hooks/useActiveEnvironment';
import { useAppRoutes } from '../hooks/useAppRoutes';
import { useEnvironments } from '../hooks/useEnvironments';
import { useHotkey } from '../hooks/useHotkey';
import type { ButtonProps } from './core/Button';
import { Button } from './core/Button';
import type { DropdownItem } from './core/Dropdown';
@@ -25,12 +26,15 @@ export const EnvironmentActionsDropdown = memo(function EnvironmentActionsDropdo
const routes = useAppRoutes();
const showEnvironmentDialog = useCallback(() => {
dialog.show({
dialog.toggle({
id: 'environment-editor',
title: 'Manage Environments',
render: () => <EnvironmentEditDialog initialEnvironment={activeEnvironment} />,
});
}, [dialog, activeEnvironment]);
useHotkey('environmentEditor.show', showEnvironmentDialog);
const items: DropdownItem[] = useMemo(
() => [
...environments.map(