Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 40 additions & 1 deletion webview-ui/src/components/chat/ChatTextArea.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { forwardRef, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react"
import { useEvent } from "react-use"
import DynamicTextArea from "react-textarea-autosize"
import { VolumeX, Image, WandSparkles, SendHorizontal } from "lucide-react"
import { VolumeX, Image, WandSparkles, SendHorizontal, Server } from "lucide-react"

import { mentionRegex, mentionRegexGlobal, commandRegexGlobal, unescapeSpaces } from "@roo/context-mentions"
import { WebviewMessage } from "@roo/WebviewMessage"
Expand Down Expand Up @@ -82,6 +82,7 @@ export const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
taskHistory,
clineMessages,
commands,
mcpServers,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mcpServers property is destructured from useExtensionState() but doesn't appear to be typed in the hook's return type. Could this cause TypeScript errors if strict typing is enabled? Consider adding the proper type definition to ensure type safety.

} = useExtensionState()

// Find the ID and display text for the currently selected API configuration.
Expand Down Expand Up @@ -1194,6 +1195,44 @@ export const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
</StandardTooltip>
)}
<SlashCommandsPopover />
{mcpServers && mcpServers.length > 0 && (
<StandardTooltip content={t("chat:mcpServers")}>
<button
aria-label={t("chat:mcpServers")}
onClick={() => {
window.postMessage(
{
type: "action",
action: "mcpButtonClicked",
},
"*",
)
}}
className={cn(
"relative inline-flex items-center justify-center",
"bg-transparent border-none p-1.5",
"rounded-md min-w-[28px] min-h-[28px]",
"text-vscode-foreground opacity-85",
"transition-all duration-150",
"hover:opacity-100 hover:bg-[rgba(255,255,255,0.03)] hover:border-[rgba(255,255,255,0.15)]",
"focus:outline-none focus-visible:ring-1 focus-visible:ring-vscode-focusBorder",
"active:bg-[rgba(255,255,255,0.1)]",
"cursor-pointer",
)}>
<Server className="w-4 h-4" />
{mcpServers.some(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For better readability, consider extracting the error detection logic to a variable:

Suggested change
{mcpServers.some(
const hasErroringServers = mcpServers.some(
(server) => server.status === "disconnected" && !server.disabled,
);
{hasErroringServers && (

(server) => server.status === "disconnected" && !server.disabled,
) && (
<span
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error indicator (red dot) doesn't have any accessible text for screen reader users. Consider adding an aria-label to the button or the error indicator span to improve accessibility:

Suggested change
<span
{mcpServers.some(
(server) => server.status === "disconnected" && !server.disabled,
) && (
<span
aria-label="MCP server error"
className={cn(
"absolute top-1 right-1 w-1.5 h-1.5 rounded-full",
"bg-red-500",
)}
/>
)}

className={cn(
"absolute top-1 right-1 w-1.5 h-1.5 rounded-full",
"bg-red-500",
)}
/>
)}
</button>
</StandardTooltip>
)}
<IndexingStatusBadge />
<StandardTooltip content={t("chat:addImages")}>
<button
Expand Down
1 change: 1 addition & 0 deletions webview-ui/src/i18n/locales/en/chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
},
"enhancePromptDescription": "The 'Enhance Prompt' button helps improve your prompt by providing additional context, clarification, or rephrasing. Try typing a prompt in here and clicking the button again to see how it works.",
"addImages": "Add images to message",
"mcpServers": "MCP Servers",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "mcpServers" translation key should be added to all other locale files to maintain i18n consistency. Currently it's only in the English locale. Could we ensure all locale files are updated?

"sendMessage": "Send message",
"stopTts": "Stop text-to-speech",
"typeMessage": "Type a message...",
Expand Down
Loading