Elffuss BraidHub

kikocis/continue public

fix: use correct styling on truncate btn
Changeset80716f70899b1c06186fcad420e48ddd9f88408405d78460f92e4c028a34cf11
AuthorPatrick Erichsen <patrick.a.erichsen@gmail.com> · 2025-07-08 09:35 -07:00
CommitterPatrick Erichsen <patrick.a.erichsen@gmail.com> · 2025-07-08 09:35 -07:00
Parents68309fbd40d3

Browse the files at this changeset

1 file changed

modified gui/src/pages/gui/ToolCallDiv/ToolTruncateHistoryIcon.tsx +30 −19
@@ -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";
56 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
@@ -19,27 +19,38 @@
1919 }, [history]);
2020 const dispatch = useAppDispatch();
2121 const { mainEditor } = useMainEditor();
22+
23+ const truncateTooltipId = useMemo(() => {
24+ return "truncate-hover-" + historyIndex;
25+ }, [historyIndex]);
26+
2227 if (historyIndex === lastMessageIndex) {
2328 return null;
2429 }
30+
2531 return (
26- <ToolbarButtonWithTooltip
27- tooltipContent={isStreaming ? "" : "Trim chat to this message"}
28- onClick={() => {
29- if (isStreaming) {
30- return;
31- }
32- dispatch(
33- truncateHistoryToMessage({
34- index: historyIndex,
35- }),
36- );
37- mainEditor?.commands.focus();
38- }}
39- >
40- <BarsArrowUpIcon
41- className={`h-3 w-3 flex-shrink-0 ${isStreaming ? "cursor-not-allowed" : "cursor-pointer"}`}
42- />
43- </ToolbarButtonWithTooltip>
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+ </>
4455 );
4556 }