From 979c2473c61747157e65e1dcd33fd73ccfe404ad Mon Sep 17 00:00:00 2001 From: Test Date: Wed, 6 Nov 2024 20:35:29 -0800 Subject: [PATCH 1/9] feat: collapsed codeblock by default --- core/protocol/index.ts | 8 ++--- .../components/markdown/CodeBlockToolbar.tsx | 30 +++++++++++++++---- .../components/markdown/PreWithToolbar.tsx | 13 +++++++- 3 files changed, 40 insertions(+), 11 deletions(-) diff --git a/core/protocol/index.ts b/core/protocol/index.ts index 495c2fb90..522b52934 100644 --- a/core/protocol/index.ts +++ b/core/protocol/index.ts @@ -1,13 +1,13 @@ import { ToCoreFromWebviewProtocol, ToWebviewFromCoreProtocol, -} from "./coreWebview.js"; -import { ToWebviewOrCoreFromIdeProtocol } from "./ide.js"; -import { ToCoreFromIdeProtocol, ToIdeFromCoreProtocol } from "./ideCore.js"; +} from "./coreWebview"; +import { ToWebviewOrCoreFromIdeProtocol } from "./ide"; +import { ToCoreFromIdeProtocol, ToIdeFromCoreProtocol } from "./ideCore"; import { ToIdeFromWebviewProtocol, ToWebviewFromIdeProtocol, -} from "./ideWebview.js"; +} from "./ideWebview"; export type IProtocol = Record; diff --git a/gui/src/components/markdown/CodeBlockToolbar.tsx b/gui/src/components/markdown/CodeBlockToolbar.tsx index ac4c03bb2..74c8f46c0 100644 --- a/gui/src/components/markdown/CodeBlockToolbar.tsx +++ b/gui/src/components/markdown/CodeBlockToolbar.tsx @@ -5,6 +5,7 @@ import { CommandLineIcon, PlayIcon, XMarkIcon, + ChevronDownIcon, } from "@heroicons/react/24/outline"; import { getBasename } from "core/util"; import { useContext, useRef, useState } from "react"; @@ -87,6 +88,8 @@ interface CodeBlockToolBarProps { language: string | undefined; isNextCodeBlock: boolean; filepath?: string; + isExpanded: boolean; + onToggleExpand: () => void; } const terminalLanguages = ["bash", "sh"]; @@ -260,12 +263,27 @@ function CodeBlockToolBar(props: CodeBlockToolBarProps) { return ( -
- - {getBasename(props.filepath)} +
+
+ +
+ + {props.filepath && ( +
+ + {getBasename(props.filepath)} +
+ )}
diff --git a/gui/src/components/markdown/PreWithToolbar.tsx b/gui/src/components/markdown/PreWithToolbar.tsx index ec9297d54..2f592ea9e 100644 --- a/gui/src/components/markdown/PreWithToolbar.tsx +++ b/gui/src/components/markdown/PreWithToolbar.tsx @@ -42,6 +42,7 @@ function PreWithToolbar(props: { const [hovering, setHovering] = useState(false); const [copyValue, setCopyValue] = useState(""); + const [isExpanded, setIsExpanded] = useState(false); const nextCodeBlockIndex = useSelector( (state: RootState) => state.uiState.nextCodeBlockToApplyIndex, @@ -76,6 +77,8 @@ function PreWithToolbar(props: { bottom={toolbarBottom} language={props.language} filepath={props.filepath} + isExpanded={isExpanded} + onToggleExpand={() => setIsExpanded(!isExpanded)} /> ) : ( hovering && ( @@ -84,11 +87,19 @@ function PreWithToolbar(props: { text={copyValue} bottom={toolbarBottom} language={props.language} + isExpanded={isExpanded} + onToggleExpand={() => setIsExpanded(!isExpanded)} /> ) )} - {props.children} +
+ {props.children} +
); } From 39337910f125a71414cf2c39b96250fc512777be Mon Sep 17 00:00:00 2001 From: Test Date: Fri, 8 Nov 2024 09:10:41 -0800 Subject: [PATCH 2/9] feat: update PreToolbar --- .../src/ContinueGUIWebviewViewProvider.ts | 17 - .../{markdown => gui}/CopyButton.tsx | 0 gui/src/components/gui/StepContainer.tsx | 26 +- .../components/markdown/CodeBlockToolbar.tsx | 372 ------------------ .../markdown/CodeSnippetPreview.tsx | 7 +- gui/src/components/markdown/FilenameLink.tsx | 6 +- .../StepContainerPreToolbar/ApplyButton.tsx | 52 +++ .../AutoApplyStatusIndicators.tsx | 46 +++ .../CodeBlockActions.tsx | 106 +++++ .../CodeBlockToolbar(OLD).tsx | 119 ++++++ .../StepContainerPreToolbar/FileInfo.tsx | 55 +++ .../PreWithToolbar_OLD.tsx} | 15 +- .../StepContainerPreToolbar/Spinner.tsx | 27 ++ .../StepContainerPreToolbar.tsx | 177 +++++++++ .../ToolbarButtonWithTooltip.tsx | 4 +- .../markdown/StepContainerPreToolbar/index.ts | 1 + .../markdown/StepContainerPreToolbar/utils.ts | 54 +++ .../markdown/StyledMarkdownPreview.tsx | 67 +++- .../markdown/SyntaxHighlightedPre.tsx | 30 +- .../components/markdown/VSCodeFileLink.tsx | 18 - .../pages/AddNewModel/ConfigureProvider.tsx | 10 +- gui/src/pages/stats.tsx | 2 +- gui/tailwind.config.cjs | 2 +- 23 files changed, 739 insertions(+), 474 deletions(-) rename gui/src/components/{markdown => gui}/CopyButton.tsx (100%) delete mode 100644 gui/src/components/markdown/CodeBlockToolbar.tsx create mode 100644 gui/src/components/markdown/StepContainerPreToolbar/ApplyButton.tsx create mode 100644 gui/src/components/markdown/StepContainerPreToolbar/AutoApplyStatusIndicators.tsx create mode 100644 gui/src/components/markdown/StepContainerPreToolbar/CodeBlockActions.tsx create mode 100644 gui/src/components/markdown/StepContainerPreToolbar/CodeBlockToolbar(OLD).tsx create mode 100644 gui/src/components/markdown/StepContainerPreToolbar/FileInfo.tsx rename gui/src/components/markdown/{PreWithToolbar.tsx => StepContainerPreToolbar/PreWithToolbar_OLD.tsx} (86%) create mode 100644 gui/src/components/markdown/StepContainerPreToolbar/Spinner.tsx create mode 100644 gui/src/components/markdown/StepContainerPreToolbar/StepContainerPreToolbar.tsx rename gui/src/components/markdown/{ => StepContainerPreToolbar}/ToolbarButtonWithTooltip.tsx (86%) create mode 100644 gui/src/components/markdown/StepContainerPreToolbar/index.ts create mode 100644 gui/src/components/markdown/StepContainerPreToolbar/utils.ts delete mode 100644 gui/src/components/markdown/VSCodeFileLink.tsx diff --git a/extensions/vscode/src/ContinueGUIWebviewViewProvider.ts b/extensions/vscode/src/ContinueGUIWebviewViewProvider.ts index a923ca422..9f3b0095c 100644 --- a/extensions/vscode/src/ContinueGUIWebviewViewProvider.ts +++ b/extensions/vscode/src/ContinueGUIWebviewViewProvider.ts @@ -182,23 +182,6 @@ export class ContinueGUIWebviewViewProvider
- - ${``} ${ inDevelopmentMode ? `