Skip to content

Commit cb518fe

Browse files
committed
cli: Disable mode toggle hover when unfocused, mute directory link
1 parent 76a6924 commit cb518fe

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

cli/src/app.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ import { useChatStore } from './state/chat-store'
2020
import { openFileAtPath } from './utils/open-file'
2121

2222
import type { MultilineInputHandle } from './components/multiline-input'
23-
import type { AuthStatus } from './utils/status-indicator-state'
2423
import type { AgentMode } from './utils/constants'
24+
import type { AuthStatus } from './utils/status-indicator-state'
2525
import type { FileTreeNode } from '@codebuff/common/util/file'
2626

2727
interface AppProps {
@@ -141,6 +141,7 @@ export const App = ({
141141
Directory{' '}
142142
<TerminalLink
143143
text={displayPath}
144+
color={theme.muted}
144145
inline={true}
145146
underlineOnHover={true}
146147
onActivate={() => openFileAtPath(repoRoot)}

cli/src/components/agent-mode-toggle.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import React, { useEffect, useRef, useState } from 'react'
33
import { Button } from './button'
44
import { SegmentedControl } from './segmented-control'
55
import { useTheme } from '../hooks/use-theme'
6+
import { useChatStore } from '../state/chat-store'
67
import { AGENT_MODES } from '../utils/constants'
78
import { BORDER_CHARS } from '../utils/ui-constants'
89

@@ -156,10 +157,13 @@ export const AgentModeToggle = ({
156157
onSelectMode?: (mode: AgentMode) => void
157158
}) => {
158159
const theme = useTheme()
160+
const inputFocused = useChatStore((state) => state.inputFocused)
159161
const [isCollapsedHovered, setIsCollapsedHovered] = useState(false)
160162
const hoverToggle = useHoverToggle()
161163

162164
const handleMouseOver = () => {
165+
// Don't open on hover if terminal is not focused
166+
if (!inputFocused) return
163167
hoverToggle.clearCloseTimer()
164168
hoverToggle.scheduleOpen()
165169
}
@@ -199,11 +203,14 @@ export const AgentModeToggle = ({
199203
customBorderChars: BORDER_CHARS,
200204
}}
201205
onClick={() => {
206+
if (!inputFocused) return
202207
hoverToggle.clearAllTimers()
203208
hoverToggle.openNow()
204209
}}
205210
onMouseOver={() => {
206-
setIsCollapsedHovered(true)
211+
if (inputFocused) {
212+
setIsCollapsedHovered(true)
213+
}
207214
handleMouseOver()
208215
}}
209216
onMouseOut={handleMouseOut}

0 commit comments

Comments
 (0)