From 56ab293ba1427c1cfaf9c6c98960a713f738c92f Mon Sep 17 00:00:00 2001 From: Jazzcort Date: Fri, 2 May 2025 14:58:32 -0400 Subject: [PATCH] Add tooltips for buttons in code display Before this fix, the functionality of the Insert and Copy buttons was unclear, as their icons alone did not provide enough information. Users had to interact with the buttons to understand their purpose. By adding tooltips, users now receive immediate context about each button's functionality. This not only improves usability but also ensures a more consistent user experience, as most other UI components already include tooltips. I also added tooltips to Create File and Apply buttons to maintain consistency across the UI. --- .../StepContainerPreToolbar/ApplyActions.tsx | 28 ++++++++++++------ .../StepContainerPreToolbar/CopyButton.tsx | 29 ++++++++++++------- .../CreateFileButton.tsx | 12 ++++++-- .../StepContainerPreToolbar/InsertButton.tsx | 22 ++++++++++---- 4 files changed, 63 insertions(+), 28 deletions(-) diff --git a/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/ApplyActions.tsx b/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/ApplyActions.tsx index 17bbc5802..cd86c4c60 100644 --- a/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/ApplyActions.tsx +++ b/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/ApplyActions.tsx @@ -3,6 +3,8 @@ import { ApplyState } from "core"; import { useEffect, useState } from "react"; import { getMetaKeyLabel } from "../../../util"; import Spinner from "../../gui/Spinner"; +import { ToolTip } from "../../gui/Tooltip"; +import HoverItem from "../../mainInput/InputToolbar/HoverItem"; import { ToolbarButtonWithTooltip } from "./ToolbarButtonWithTooltip"; interface ApplyActionsProps { @@ -35,16 +37,24 @@ export function ApplyActions(props: ApplyActionsProps) { } const applyButton = (text: string) => ( - + + + {text} Code + + ); switch (props.applyState ? props.applyState.status : null) { diff --git a/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/CopyButton.tsx b/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/CopyButton.tsx index 8b06ad03f..024439c1f 100644 --- a/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/CopyButton.tsx +++ b/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/CopyButton.tsx @@ -1,5 +1,7 @@ import { CheckIcon, ClipboardIcon } from "@heroicons/react/24/outline"; import useCopy from "../../../hooks/useCopy"; +import { ToolTip } from "../../gui/Tooltip"; +import HoverItem from "../../mainInput/InputToolbar/HoverItem"; interface CopyButtonProps { text: string; @@ -9,17 +11,22 @@ export function CopyButton({ text }: CopyButtonProps) { const { copyText, copied } = useCopy(text); return ( -
-
- {copied ? ( - - ) : ( - - )} + +
+
+ {copied ? ( + + ) : ( + + )} +
-
+ + Copy Code + + ); } diff --git a/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/CreateFileButton.tsx b/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/CreateFileButton.tsx index 113221b06..a8db04292 100644 --- a/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/CreateFileButton.tsx +++ b/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/CreateFileButton.tsx @@ -1,5 +1,7 @@ import { DocumentPlusIcon } from "@heroicons/react/24/outline"; import { vscForeground } from "../.."; +import { ToolTip } from "../../gui/Tooltip"; +import HoverItem from "../../mainInput/InputToolbar/HoverItem"; interface CreateFileButtonProps { onClick: () => void; @@ -7,7 +9,10 @@ interface CreateFileButtonProps { export function CreateFileButton({ onClick }: CreateFileButtonProps) { return ( - <> +
- + + Create File with Code + + ); } diff --git a/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/InsertButton.tsx b/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/InsertButton.tsx index b8784dd07..6373673b6 100644 --- a/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/InsertButton.tsx +++ b/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/InsertButton.tsx @@ -1,4 +1,6 @@ import { ArrowLeftEndOnRectangleIcon } from "@heroicons/react/24/outline"; +import { ToolTip } from "../../gui/Tooltip"; +import HoverItem from "../../mainInput/InputToolbar/HoverItem"; /** * Button that inserts code at the current cursor position @@ -9,13 +11,21 @@ interface InsertButtonProps { export function InsertButton({ onInsert }: InsertButtonProps) { return ( -
-
- +
+
+ +
-
+ + Insert Code + + ); }