Elffuss BraidHub

kikocis/continue public

fix: update toolbar btn stylings
Changesetcd600673bdf6c95992edb7d4e2d218bf004f0a376283574896014bab9ff891cb
AuthorPatrick Erichsen <patrick.a.erichsen@gmail.com> · 2025-07-08 09:38 -07:00
CommitterPatrick Erichsen <patrick.a.erichsen@gmail.com> · 2025-07-08 09:38 -07:00
Parents80716f70899b

Browse the files at this changeset

3 files changed

modified gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/ToolbarButtonWithTooltip.tsx +9 −10
@@ -1,6 +1,5 @@
11 import { ReactNode, useMemo } from "react";
2-import { Tooltip } from "react-tooltip";
3-import { getFontSize } from "../../../util";
2+import { ToolTip } from "../../gui/Tooltip";
43
54 interface ToolbarButtonWithTooltipProps {
65 onClick: () => void;
@@ -22,20 +21,20 @@
2221
2322 return (
2423 <>
25- <button
26- onClick={onClick}
27- style={{
28- fontSize: `${getFontSize() - 2}px`,
24+ <div
25+ onClick={(e) => {
26+ e.stopPropagation();
27+ onClick();
2928 }}
3029 data-tooltip-id={tooltipId}
3130 data-testid={testId}
32- className="text-foreground flex items-center border-none bg-transparent px-0.5 outline-none hover:cursor-pointer hover:brightness-125"
31+ className="hover:description-muted/30 cursor-pointer select-none rounded bg-transparent px-1 py-0.5 hover:opacity-80"
3332 >
3433 {children}
35- </button>
36- <Tooltip id={tooltipId} place="top">
34+ </div>
35+ <ToolTip id={tooltipId} place="top">
3736 {tooltipContent}
38- </Tooltip>
37+ </ToolTip>
3938 </>
4039 );
4140 }
modified gui/src/pages/gui/ToolCallDiv/ToolCallArgs.tsx +9 −21
@@ -1,6 +1,5 @@
11 import { CodeBracketIcon } from "@heroicons/react/24/outline";
2-import { useMemo } from "react";
3-import { ToolTip } from "../../../components/gui/Tooltip";
2+import { ToolbarButtonWithTooltip } from "../../../components/StyledMarkdownPreview/StepContainerPreToolbar/ToolbarButtonWithTooltip";
43
54 interface ArgsToggleIconProps {
65 isShowing: boolean;
@@ -13,26 +12,15 @@
1312 setIsShowing,
1413 toolCallId,
1514 }: ArgsToggleIconProps) => {
16- const argsTooltipId = useMemo(() => {
17- return "args-hover-" + toolCallId;
18- }, [toolCallId]);
19-
2015 return (
21- <>
22- <div
23- data-tooltip-id={argsTooltipId}
24- onClick={(e) => {
25- e.stopPropagation();
26- setIsShowing(!isShowing);
27- }}
28- className={`hover:description-muted/30 cursor-pointer select-none rounded px-1 py-0.5 hover:opacity-80 ${isShowing ? "bg-description-muted/30" : "bg-transparent"}`}
29- >
30- <CodeBracketIcon className="h-3 w-3 flex-shrink-0 opacity-60" />
31- </div>
32- <ToolTip id={argsTooltipId}>
33- {isShowing ? "Hide args" : "Show args"}
34- </ToolTip>
35- </>
16+ <ToolbarButtonWithTooltip
17+ tooltipContent={isShowing ? "Hide args" : "Show args"}
18+ onClick={() => {
19+ setIsShowing(!isShowing);
20+ }}
21+ >
22+ <CodeBracketIcon className="h-3 w-3 flex-shrink-0 opacity-60" />
23+ </ToolbarButtonWithTooltip>
3624 );
3725 };
3826
modified gui/src/pages/gui/ToolCallDiv/ToolTruncateHistoryIcon.tsx +19 −28
@@ -2,8 +2,8 @@
22 import { chatMessageIsEmpty } from "core/llm/messages";
33 import { findLastIndex } from "core/util/findLast";
44 import { useMemo } from "react";
5-import { ToolTip } from "../../../components/gui/Tooltip";
65 import { useMainEditor } from "../../../components/mainInput/TipTapEditor";
6+import { ToolbarButtonWithTooltip } from "../../../components/StyledMarkdownPreview/StepContainerPreToolbar/ToolbarButtonWithTooltip";
77 import { useAppDispatch, useAppSelector } from "../../../redux/hooks";
88 import { truncateHistoryToMessage } from "../../../redux/slices/sessionSlice";
99
@@ -20,37 +20,28 @@
2020 const dispatch = useAppDispatch();
2121 const { mainEditor } = useMainEditor();
2222
23- const truncateTooltipId = useMemo(() => {
24- return "truncate-hover-" + historyIndex;
25- }, [historyIndex]);
26-
2723 if (historyIndex === lastMessageIndex) {
2824 return null;
2925 }
3026
3127 return (
32- <>
33- <div
34- data-tooltip-id={truncateTooltipId}
35- onClick={(e) => {
36- e.stopPropagation();
37- if (isStreaming) {
38- return;
39- }
40- dispatch(
41- truncateHistoryToMessage({
42- index: historyIndex,
43- }),
44- );
45- mainEditor?.commands.focus();
46- }}
47- className={`hover:description-muted/30 cursor-pointer select-none rounded px-1 py-0.5 hover:opacity-80 ${isStreaming ? "cursor-not-allowed opacity-50" : "bg-transparent"}`}
48- >
49- <BarsArrowUpIcon className="h-3 w-3 flex-shrink-0 opacity-60" />
50- </div>
51- <ToolTip id={truncateTooltipId}>
52- {isStreaming ? "" : "Trim chat to this message"}
53- </ToolTip>
54- </>
28+ <ToolbarButtonWithTooltip
29+ tooltipContent={isStreaming ? "" : "Trim chat to this message"}
30+ onClick={() => {
31+ if (isStreaming) {
32+ return;
33+ }
34+ dispatch(
35+ truncateHistoryToMessage({
36+ index: historyIndex,
37+ }),
38+ );
39+ mainEditor?.commands.focus();
40+ }}
41+ >
42+ <BarsArrowUpIcon
43+ className={`h-3 w-3 flex-shrink-0 opacity-60 ${isStreaming ? "cursor-not-allowed" : ""}`}
44+ />
45+ </ToolbarButtonWithTooltip>
5546 );
5647 }