Merge pull request #6515 from continuedev/pe/truncate-btn-styling
fix: use correct styling on truncate btn
This commit is contained in:
commit
3b9331b721
3 changed files with 21 additions and 32 deletions
|
|
@ -1,6 +1,5 @@
|
|||
import { ReactNode, useMemo } from "react";
|
||||
import { Tooltip } from "react-tooltip";
|
||||
import { getFontSize } from "../../../util";
|
||||
import { ToolTip } from "../../gui/Tooltip";
|
||||
|
||||
interface ToolbarButtonWithTooltipProps {
|
||||
onClick: () => void;
|
||||
|
|
@ -22,20 +21,20 @@ export function ToolbarButtonWithTooltip({
|
|||
|
||||
return (
|
||||
<>
|
||||
<button
|
||||
onClick={onClick}
|
||||
style={{
|
||||
fontSize: `${getFontSize() - 2}px`,
|
||||
<div
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
onClick();
|
||||
}}
|
||||
data-tooltip-id={tooltipId}
|
||||
data-testid={testId}
|
||||
className="text-foreground flex items-center border-none bg-transparent px-0.5 outline-none hover:cursor-pointer hover:brightness-125"
|
||||
className="hover:description-muted/30 cursor-pointer select-none rounded bg-transparent px-1 py-0.5 hover:opacity-80"
|
||||
>
|
||||
{children}
|
||||
</button>
|
||||
<Tooltip id={tooltipId} place="top">
|
||||
</div>
|
||||
<ToolTip id={tooltipId} place="top">
|
||||
{tooltipContent}
|
||||
</Tooltip>
|
||||
</ToolTip>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import { CodeBracketIcon } from "@heroicons/react/24/outline";
|
||||
import { useMemo } from "react";
|
||||
import { ToolTip } from "../../../components/gui/Tooltip";
|
||||
import { ToolbarButtonWithTooltip } from "../../../components/StyledMarkdownPreview/StepContainerPreToolbar/ToolbarButtonWithTooltip";
|
||||
|
||||
interface ArgsToggleIconProps {
|
||||
isShowing: boolean;
|
||||
|
|
@ -13,26 +12,15 @@ export const ArgsToggleIcon = ({
|
|||
setIsShowing,
|
||||
toolCallId,
|
||||
}: ArgsToggleIconProps) => {
|
||||
const argsTooltipId = useMemo(() => {
|
||||
return "args-hover-" + toolCallId;
|
||||
}, [toolCallId]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div
|
||||
data-tooltip-id={argsTooltipId}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
setIsShowing(!isShowing);
|
||||
}}
|
||||
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"}`}
|
||||
>
|
||||
<CodeBracketIcon className="h-3 w-3 flex-shrink-0 opacity-60" />
|
||||
</div>
|
||||
<ToolTip id={argsTooltipId}>
|
||||
{isShowing ? "Hide args" : "Show args"}
|
||||
</ToolTip>
|
||||
</>
|
||||
<ToolbarButtonWithTooltip
|
||||
tooltipContent={isShowing ? "Hide args" : "Show args"}
|
||||
onClick={() => {
|
||||
setIsShowing(!isShowing);
|
||||
}}
|
||||
>
|
||||
<CodeBracketIcon className="h-3 w-3 flex-shrink-0 opacity-60" />
|
||||
</ToolbarButtonWithTooltip>
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -19,9 +19,11 @@ export function ToolTruncateHistoryIcon({
|
|||
}, [history]);
|
||||
const dispatch = useAppDispatch();
|
||||
const { mainEditor } = useMainEditor();
|
||||
|
||||
if (historyIndex === lastMessageIndex) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<ToolbarButtonWithTooltip
|
||||
tooltipContent={isStreaming ? "" : "Trim chat to this message"}
|
||||
|
|
@ -38,7 +40,7 @@ export function ToolTruncateHistoryIcon({
|
|||
}}
|
||||
>
|
||||
<BarsArrowUpIcon
|
||||
className={`h-3 w-3 flex-shrink-0 ${isStreaming ? "cursor-not-allowed" : "cursor-pointer"}`}
|
||||
className={`h-3 w-3 flex-shrink-0 opacity-60 ${isStreaming ? "cursor-not-allowed" : ""}`}
|
||||
/>
|
||||
</ToolbarButtonWithTooltip>
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue