From cd06a72d6f448beb810e6cfd3ee01e2ca4f02ffe Mon Sep 17 00:00:00 2001 From: Gregory Schier Date: Mon, 6 Nov 2023 10:42:59 -0800 Subject: [PATCH] Rework workspace header --- .../components/EnvironmentActionsDropdown.tsx | 6 +- src-web/components/EnvironmentEditDialog.tsx | 32 ++--- src-web/components/RecentRequestsDropdown.tsx | 13 +- src-web/components/RequestActionsDropdown.tsx | 117 +++--------------- .../components/WorkspaceActionsDropdown.tsx | 94 ++++++++++++-- src-web/components/WorkspaceHeader.tsx | 20 ++- src-web/components/core/Button.tsx | 1 + src-web/components/core/Dropdown.tsx | 3 +- src-web/components/core/Editor/Editor.css | 9 +- tailwind.config.cjs | 2 +- 10 files changed, 160 insertions(+), 137 deletions(-) diff --git a/src-web/components/EnvironmentActionsDropdown.tsx b/src-web/components/EnvironmentActionsDropdown.tsx index 14b75fd1..7d95da1f 100644 --- a/src-web/components/EnvironmentActionsDropdown.tsx +++ b/src-web/components/EnvironmentActionsDropdown.tsx @@ -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 type { ButtonProps } from './core/Button'; import { Button } from './core/Button'; import type { DropdownItem } from './core/Dropdown'; import { Dropdown } from './core/Dropdown'; @@ -12,10 +13,11 @@ import { EnvironmentEditDialog } from './EnvironmentEditDialog'; type Props = { className?: string; -}; +} & Pick; export const EnvironmentActionsDropdown = memo(function EnvironmentActionsDropdown({ className, + ...buttonProps }: Props) { const environments = useEnvironments(); const activeEnvironment = useActiveEnvironment(); @@ -62,13 +64,13 @@ export const EnvironmentActionsDropdown = memo(function EnvironmentActionsDropdo return ( diff --git a/src-web/components/EnvironmentEditDialog.tsx b/src-web/components/EnvironmentEditDialog.tsx index d5f8d03b..13b0ceb2 100644 --- a/src-web/components/EnvironmentEditDialog.tsx +++ b/src-web/components/EnvironmentEditDialog.tsx @@ -1,27 +1,27 @@ +import classNames from 'classnames'; +import { useCallback, useMemo, useState } from 'react'; +import { useWindowSize } from 'react-use'; +import { useActiveWorkspace } from '../hooks/useActiveWorkspace'; import { useCreateEnvironment } from '../hooks/useCreateEnvironment'; +import { useDeleteEnvironment } from '../hooks/useDeleteEnvironment'; import { useEnvironments } from '../hooks/useEnvironments'; +import { usePrompt } from '../hooks/usePrompt'; +import { useUpdateEnvironment } from '../hooks/useUpdateEnvironment'; +import { useUpdateWorkspace } from '../hooks/useUpdateWorkspace'; import type { Environment, Workspace } from '../lib/models'; import { Button } from './core/Button'; -import classNames from 'classnames'; -import { PairEditor } from './core/PairEditor'; -import type { PairEditorProps } from './core/PairEditor'; -import { useCallback, useMemo, useState } from 'react'; -import { useUpdateEnvironment } from '../hooks/useUpdateEnvironment'; -import { HStack, VStack } from './core/Stacks'; -import { IconButton } from './core/IconButton'; -import { useDeleteEnvironment } from '../hooks/useDeleteEnvironment'; import type { DropdownItem } from './core/Dropdown'; import { Dropdown } from './core/Dropdown'; -import { Icon } from './core/Icon'; -import { usePrompt } from '../hooks/usePrompt'; -import { InlineCode } from './core/InlineCode'; -import { useWindowSize } from 'react-use'; import type { GenericCompletionConfig, GenericCompletionOption, } from './core/Editor/genericCompletion'; -import { useActiveWorkspace } from '../hooks/useActiveWorkspace'; -import { useUpdateWorkspace } from '../hooks/useUpdateWorkspace'; +import { Icon } from './core/Icon'; +import { IconButton } from './core/IconButton'; +import { InlineCode } from './core/InlineCode'; +import type { PairEditorProps } from './core/PairEditor'; +import { PairEditor } from './core/PairEditor'; +import { HStack, VStack } from './core/Stacks'; interface Props { initialEnvironment: Environment | null; @@ -54,7 +54,7 @@ export const EnvironmentEditDialog = function ({ initialEnvironment }: Props) {