mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-09 22:31:08 +00:00
Improve Mode Tooltip (#1839)
* feat: Improve Mode Tooltip * Update webview-ui/src/components/chat/ChatTextArea.tsx Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> * fix: typo --------- Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
This commit is contained in:
parent
cb02277b45
commit
a20a2444b3
3 changed files with 24 additions and 10 deletions
5
.changeset/chilly-pandas-retire.md
Normal file
5
.changeset/chilly-pandas-retire.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"claude-dev": minor
|
||||
---
|
||||
|
||||
tooltip for each mode can be shown no matter what the current mode is
|
||||
|
|
@ -22,6 +22,7 @@ import Tooltip from "../common/Tooltip"
|
|||
import ApiOptions, { normalizeApiConfiguration } from "../settings/ApiOptions"
|
||||
import { MAX_IMAGES_PER_MESSAGE } from "./ChatView"
|
||||
import ContextMenu from "./ContextMenu"
|
||||
import { ChatSettings } from "../../../../src/shared/ChatSettings"
|
||||
|
||||
interface ChatTextAreaProps {
|
||||
inputValue: string
|
||||
|
|
@ -236,6 +237,7 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
|
|||
const buttonRef = useRef<HTMLDivElement>(null)
|
||||
const [arrowPosition, setArrowPosition] = useState(0)
|
||||
const [menuPosition, setMenuPosition] = useState(0)
|
||||
const [shownTooltipMode, setShownTooltipMode] = useState<ChatSettings["mode"] | null>(null)
|
||||
|
||||
const [, metaKeyChar] = useMetaKeyDetection(platform)
|
||||
|
||||
|
|
@ -1130,12 +1132,23 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
|
|||
</ModelContainer>
|
||||
</ButtonGroup>
|
||||
<Tooltip
|
||||
tipText={`In ${chatSettings.mode === "act" ? "Act" : "Plan"} mode, Cline will ${chatSettings.mode === "act" ? "complete the task immediately" : "gather information to architect a plan"}`}
|
||||
visible={shownTooltipMode !== null}
|
||||
tipText={`In ${shownTooltipMode === "act" ? "Act" : "Plan"} mode, Cline will ${shownTooltipMode === "act" ? "complete the task immediately" : "gather information to architect a plan"}`}
|
||||
hintText={`Toggle w/ ${metaKeyChar}+Shift+A`}>
|
||||
<SwitchContainer data-testid="mode-switch" disabled={false} onClick={onModeToggle}>
|
||||
<Slider isAct={chatSettings.mode === "act"} isPlan={chatSettings.mode === "plan"} />
|
||||
<SwitchOption isActive={chatSettings.mode === "plan"}>Plan</SwitchOption>
|
||||
<SwitchOption isActive={chatSettings.mode === "act"}>Act</SwitchOption>
|
||||
<SwitchOption
|
||||
isActive={chatSettings.mode === "plan"}
|
||||
onMouseOver={() => setShownTooltipMode("plan")}
|
||||
onMouseLeave={() => setShownTooltipMode(null)}>
|
||||
Plan
|
||||
</SwitchOption>
|
||||
<SwitchOption
|
||||
isActive={chatSettings.mode === "act"}
|
||||
onMouseOver={() => setShownTooltipMode("act")}
|
||||
onMouseLeave={() => setShownTooltipMode(null)}>
|
||||
Act
|
||||
</SwitchOption>
|
||||
</SwitchContainer>
|
||||
</Tooltip>
|
||||
</ControlsContainer>
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import {
|
|||
} from "../../utils/vscStyles"
|
||||
|
||||
interface TooltipProps {
|
||||
visible: boolean
|
||||
hintText: string
|
||||
tipText: string
|
||||
children: React.ReactNode
|
||||
|
|
@ -38,14 +39,9 @@ const Hint = styled.div`
|
|||
margin-top: 2px;
|
||||
`
|
||||
|
||||
const Tooltip: React.FC<TooltipProps> = ({ tipText, hintText, children }) => {
|
||||
const [visible, setVisible] = useState(false)
|
||||
|
||||
const showTooltip = () => setVisible(true)
|
||||
const hideTooltip = () => setVisible(false)
|
||||
|
||||
const Tooltip: React.FC<TooltipProps> = ({ visible, tipText, hintText, children }) => {
|
||||
return (
|
||||
<div style={{ position: "relative", display: "inline-block" }} onMouseEnter={showTooltip} onMouseLeave={hideTooltip}>
|
||||
<div style={{ position: "relative", display: "inline-block" }}>
|
||||
{children}
|
||||
{visible && (
|
||||
<TooltipBody>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue