Skip to content

Commit fa460da

Browse files
committed
fix: remove onNavigateToSettings prop and update IndexingStatusDot to post settingsButtonClicked message
1 parent d69452f commit fa460da

File tree

5 files changed

+26
-21
lines changed

5 files changed

+26
-21
lines changed

webview-ui/src/App.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,6 @@ const App = () => {
166166
isHidden={tab !== "chat"}
167167
showAnnouncement={showAnnouncement}
168168
hideAnnouncement={() => setShowAnnouncement(false)}
169-
onNavigateToSettings={() => {
170-
switchTab("settings")
171-
setCurrentSection("experimental")
172-
}}
173169
/>
174170
<HumanRelayDialog
175171
isOpen={humanRelayDialogState.isOpen}

webview-ui/src/components/chat/ChatTextArea.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ interface ChatTextAreaProps {
4545
mode: Mode
4646
setMode: (value: Mode) => void
4747
modeShortcutText: string
48-
onNavigateToSettings?: () => void
4948
}
5049

5150
const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
@@ -65,7 +64,6 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
6564
mode,
6665
setMode,
6766
modeShortcutText,
68-
onNavigateToSettings,
6967
},
7068
ref,
7169
) => {
@@ -1175,9 +1173,7 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
11751173
</div>
11761174

11771175
<div className={cn("flex", "items-center", "gap-0.5", "shrink-0")}>
1178-
{codebaseIndexConfig?.codebaseIndexEnabled && (
1179-
<IndexingStatusDot onNavigateToSettings={onNavigateToSettings} />
1180-
)}
1176+
{codebaseIndexConfig?.codebaseIndexEnabled && <IndexingStatusDot />}
11811177
<IconButton
11821178
iconClass={isEnhancingPrompt ? "codicon-loading" : "codicon-sparkle"}
11831179
title={t("chat:enhancePrompt")}

webview-ui/src/components/chat/ChatView.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ export interface ChatViewProps {
4646
isHidden: boolean
4747
showAnnouncement: boolean
4848
hideAnnouncement: () => void
49-
onNavigateToSettings?: () => void
5049
}
5150

5251
export interface ChatViewRef {
@@ -58,7 +57,7 @@ export const MAX_IMAGES_PER_MESSAGE = 20 // Anthropic limits to 20 images
5857
const isMac = navigator.platform.toUpperCase().indexOf("MAC") >= 0
5958

6059
const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewProps> = (
61-
{ isHidden, showAnnouncement, hideAnnouncement, onNavigateToSettings },
60+
{ isHidden, showAnnouncement, hideAnnouncement },
6261
ref,
6362
) => {
6463
const isMountedRef = useRef(true)
@@ -1547,7 +1546,6 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
15471546
mode={mode}
15481547
setMode={setMode}
15491548
modeShortcutText={modeShortcutText}
1550-
onNavigateToSettings={onNavigateToSettings}
15511549
/>
15521550

15531551
{isProfileDisabled && (

webview-ui/src/components/chat/IndexingStatusBadge.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@ import { useTooltip } from "@/hooks/useTooltip"
66
import type { IndexingStatus, IndexingStatusUpdateMessage } from "@roo/ExtensionMessage"
77

88
interface IndexingStatusDotProps {
9-
onNavigateToSettings?: () => void
109
className?: string
1110
}
1211

13-
export const IndexingStatusDot: React.FC<IndexingStatusDotProps> = ({ onNavigateToSettings, className }) => {
12+
export const IndexingStatusDot: React.FC<IndexingStatusDotProps> = ({ className }) => {
1413
const { t } = useAppTranslation()
1514
const { showTooltip, handleMouseEnter, handleMouseLeave, cleanup } = useTooltip({ delay: 300 })
1615
const [isHovered, setIsHovered] = useState(false)
@@ -69,9 +68,14 @@ export const IndexingStatusDot: React.FC<IndexingStatusDotProps> = ({ onNavigate
6968

7069
// Navigate to settings when clicked
7170
const handleClick = () => {
72-
if (onNavigateToSettings) {
73-
onNavigateToSettings()
74-
}
71+
window.postMessage(
72+
{
73+
type: "action",
74+
action: "settingsButtonClicked",
75+
values: { section: "experimental" },
76+
},
77+
"*",
78+
)
7579
}
7680

7781
const handleMouseEnterButton = () => {

webview-ui/src/components/chat/__tests__/IndexingStatusBadge.test.tsx

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,25 @@ describe("IndexingStatusDot", () => {
124124
expect(button).toHaveAttribute("aria-label", "Index ready")
125125
})
126126

127-
it("calls onNavigateToSettings when clicked", () => {
128-
const onNavigateToSettings = jest.fn()
129-
renderComponent({ onNavigateToSettings })
127+
it("posts settingsButtonClicked message when clicked", () => {
128+
// Mock window.postMessage
129+
const postMessageSpy = jest.spyOn(window, "postMessage")
130+
131+
renderComponent()
130132

131133
const button = screen.getByRole("button")
132134
fireEvent.click(button)
133135

134-
expect(onNavigateToSettings).toHaveBeenCalled()
136+
expect(postMessageSpy).toHaveBeenCalledWith(
137+
{
138+
type: "action",
139+
action: "settingsButtonClicked",
140+
values: { section: "experimental" },
141+
},
142+
"*",
143+
)
144+
145+
postMessageSpy.mockRestore()
135146
})
136147

137148
it("requests indexing status on mount", () => {

0 commit comments

Comments
 (0)