diff --git a/webview-ui/src/components/chat/ChatTextArea.tsx b/webview-ui/src/components/chat/ChatTextArea.tsx index cdb176ddc0..ab6d3b282b 100644 --- a/webview-ui/src/components/chat/ChatTextArea.tsx +++ b/webview-ui/src/components/chat/ChatTextArea.tsx @@ -246,6 +246,11 @@ export const ChatTextArea = forwardRef( const allModes = useMemo(() => getAllModes(customModes), [customModes]) + // Memoized check for whether the input has content + const hasInputContent = useMemo(() => { + return inputValue.trim().length > 0 + }, [inputValue]) + const queryItems = useMemo(() => { return [ { type: ContextMenuOptionType.Problems, value: "problems" }, @@ -1088,12 +1093,16 @@ export const ChatTextArea = forwardRef( "relative inline-flex items-center justify-center", "bg-transparent border-none p-1.5", "rounded-md min-w-[28px] min-h-[28px]", - "opacity-60 hover:opacity-100 text-vscode-descriptionForeground hover:text-vscode-foreground", - "transition-all duration-150", - "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)]", + "text-vscode-descriptionForeground hover:text-vscode-foreground", + "transition-all duration-1000", "cursor-pointer", + hasInputContent + ? "opacity-50 hover:opacity-100 delay-750 pointer-events-auto" + : "opacity-0 pointer-events-none duration-200 delay-0", + hasInputContent && + "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", + hasInputContent && "active:bg-[rgba(255,255,255,0.1)]", )}> @@ -1131,12 +1140,16 @@ export const ChatTextArea = forwardRef( "relative inline-flex items-center justify-center", "bg-transparent border-none p-1.5", "rounded-md min-w-[28px] min-h-[28px]", - "opacity-60 hover:opacity-100 text-vscode-descriptionForeground hover:text-vscode-foreground", - "transition-all duration-150", - "hover:bg-[rgba(255,255,255,0.03)] hover:border-[rgba(255,255,255,0.15)]", + "text-vscode-descriptionForeground hover:text-vscode-foreground", + "transition-all duration-200", + hasInputContent + ? "opacity-100 hover:opacity-100 pointer-events-auto" + : "opacity-0 pointer-events-none", + hasInputContent && + "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", + hasInputContent && "active:bg-[rgba(255,255,255,0.1)]", + hasInputContent && "cursor-pointer", )}>