feat: Replace title attributes with StandardTooltip in ChatTextArea (#5528)

feat: Replace title attributes with StandardTooltip in ChatTextArea buttons

- Added StandardTooltip wrapper for Stop TTS button
- Replaced title attributes with StandardTooltip for Enhance Prompt button
- Replaced title attributes with StandardTooltip for Send Message button
- Replaced title attributes with StandardTooltip for Add Images button

Note: The stopTts translation key needs to be added to the localization files
This commit is contained in:
Daniel 2025-07-09 16:24:53 -05:00 committed by GitHub
parent 8824a719eb
commit dd00fc8a0f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 91 additions and 68 deletions

View file

@ -951,59 +951,63 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
/>
{isTtsPlaying && (
<Button
variant="ghost"
size="icon"
className="absolute top-0 right-0 opacity-25 hover:opacity-100 z-10"
onClick={() => vscode.postMessage({ type: "stopTts" })}>
<VolumeX className="size-4" />
</Button>
<StandardTooltip content={t("chat:stopTts")}>
<Button
variant="ghost"
size="icon"
className="absolute top-0 right-0 opacity-25 hover:opacity-100 z-10"
onClick={() => vscode.postMessage({ type: "stopTts" })}>
<VolumeX className="size-4" />
</Button>
</StandardTooltip>
)}
<div className="absolute top-1 right-1 z-30">
<button
aria-label={t("chat:enhancePrompt")}
title={t("chat:enhancePrompt")}
disabled={sendingDisabled}
onClick={!sendingDisabled ? handleEnhancePrompt : undefined}
className={cn(
"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)]",
!sendingDisabled && "cursor-pointer",
sendingDisabled &&
"opacity-40 cursor-not-allowed grayscale-[30%] hover:bg-transparent hover:border-[rgba(255,255,255,0.08)] active:bg-transparent",
)}>
<WandSparkles className={cn("w-4 h-4", isEnhancingPrompt && "animate-spin")} />
</button>
<StandardTooltip content={t("chat:enhancePrompt")}>
<button
aria-label={t("chat:enhancePrompt")}
disabled={sendingDisabled}
onClick={!sendingDisabled ? handleEnhancePrompt : undefined}
className={cn(
"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)]",
!sendingDisabled && "cursor-pointer",
sendingDisabled &&
"opacity-40 cursor-not-allowed grayscale-[30%] hover:bg-transparent hover:border-[rgba(255,255,255,0.08)] active:bg-transparent",
)}>
<WandSparkles className={cn("w-4 h-4", isEnhancingPrompt && "animate-spin")} />
</button>
</StandardTooltip>
</div>
<div className="absolute bottom-1 right-1 z-30">
<button
aria-label={t("chat:sendMessage")}
title={t("chat:sendMessage")}
disabled={sendingDisabled}
onClick={!sendingDisabled ? onSend : undefined}
className={cn(
"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)]",
!sendingDisabled && "cursor-pointer",
sendingDisabled &&
"opacity-40 cursor-not-allowed grayscale-[30%] hover:bg-transparent hover:border-[rgba(255,255,255,0.08)] active:bg-transparent",
)}>
<SendHorizontal className="w-4 h-4" />
</button>
<StandardTooltip content={t("chat:sendMessage")}>
<button
aria-label={t("chat:sendMessage")}
disabled={sendingDisabled}
onClick={!sendingDisabled ? onSend : undefined}
className={cn(
"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)]",
!sendingDisabled && "cursor-pointer",
sendingDisabled &&
"opacity-40 cursor-not-allowed grayscale-[30%] hover:bg-transparent hover:border-[rgba(255,255,255,0.08)] active:bg-transparent",
)}>
<SendHorizontal className="w-4 h-4" />
</button>
</StandardTooltip>
</div>
{!inputValue && (
@ -1170,27 +1174,28 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
<div className={cn("flex", "items-center", "gap-0.5", "shrink-0")}>
<IndexingStatusBadge />
<button
aria-label={t("chat:addImages")}
title={t("chat:addImages")}
disabled={shouldDisableImages}
onClick={!shouldDisableImages ? onSelectImages : undefined}
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)]",
!shouldDisableImages && "cursor-pointer",
shouldDisableImages &&
"opacity-40 cursor-not-allowed grayscale-[30%] hover:bg-transparent hover:border-[rgba(255,255,255,0.08)] active:bg-transparent",
"mr-1",
)}>
<Image className="w-4 h-4" />
</button>
<StandardTooltip content={t("chat:addImages")}>
<button
aria-label={t("chat:addImages")}
disabled={shouldDisableImages}
onClick={!shouldDisableImages ? onSelectImages : undefined}
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)]",
!shouldDisableImages && "cursor-pointer",
shouldDisableImages &&
"opacity-40 cursor-not-allowed grayscale-[30%] hover:bg-transparent hover:border-[rgba(255,255,255,0.08)] active:bg-transparent",
"mr-1",
)}>
<Image className="w-4 h-4" />
</button>
</StandardTooltip>
</div>
</div>
</div>

View file

@ -105,6 +105,7 @@
"enhancePrompt": "Millora la sol·licitud amb context addicional",
"addImages": "Afegeix imatges al missatge",
"sendMessage": "Envia el missatge",
"stopTts": "Atura la síntesi de veu",
"typeMessage": "Escriu un missatge...",
"typeTask": "Escriu la teva tasca aquí...",
"addContext": "@ per afegir context, / per canviar de mode",

View file

@ -105,6 +105,7 @@
"enhancePrompt": "Prompt mit zusätzlichem Kontext verbessern",
"addImages": "Bilder zur Nachricht hinzufügen",
"sendMessage": "Nachricht senden",
"stopTts": "Text-in-Sprache beenden",
"typeMessage": "Nachricht eingeben...",
"typeTask": "Gib deine Aufgabe hier ein...",
"addContext": "@ für Kontext, / zum Moduswechsel",

View file

@ -120,6 +120,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",
"sendMessage": "Send message",
"stopTts": "Stop text-to-speech",
"typeMessage": "Type a message...",
"typeTask": "Type your task here...",
"addContext": "@ to add context, / to switch modes",

View file

@ -105,6 +105,7 @@
"enhancePrompt": "Mejorar el mensaje con contexto adicional",
"addImages": "Agregar imágenes al mensaje",
"sendMessage": "Enviar mensaje",
"stopTts": "Detener texto a voz",
"typeMessage": "Escribe un mensaje...",
"typeTask": "Escribe tu tarea aquí...",
"addContext": "@ para agregar contexto, / para cambiar modos",

View file

@ -105,6 +105,7 @@
"enhancePrompt": "Améliorer la requête avec un contexte supplémentaire",
"addImages": "Ajouter des images au message",
"sendMessage": "Envoyer le message",
"stopTts": "Arrêter la synthèse vocale",
"typeMessage": "Écrivez un message...",
"typeTask": "Écrivez votre tâche ici...",
"addContext": "@ pour ajouter du contexte, / pour changer de mode",

View file

@ -105,6 +105,7 @@
"enhancePrompt": "अतिरिक्त संदर्भ के साथ प्रॉम्प्ट बढ़ाएँ",
"addImages": "संदेश में चित्र जोड़ें",
"sendMessage": "संदेश भेजें",
"stopTts": "टेक्स्ट-टू-स्पीच बंद करें",
"typeMessage": "एक संदेश लिखें...",
"typeTask": "अपना कार्य यहां लिखें...",
"addContext": "संदर्भ जोड़ने के लिए @, मोड बदलने के लिए /",

View file

@ -126,6 +126,7 @@
},
"addImages": "Tambahkan gambar ke pesan",
"sendMessage": "Kirim pesan",
"stopTts": "Hentikan text-to-speech",
"typeMessage": "Ketik pesan...",
"typeTask": "Bangun, cari, tanya sesuatu",
"addContext": "@ untuk menambah konteks, / untuk ganti mode",

View file

@ -105,6 +105,7 @@
"enhancePrompt": "Migliora prompt con contesto aggiuntivo",
"addImages": "Aggiungi immagini al messaggio",
"sendMessage": "Invia messaggio",
"stopTts": "Interrompi sintesi vocale",
"typeMessage": "Scrivi un messaggio...",
"typeTask": "Scrivi la tua attività qui...",
"addContext": "@ per aggiungere contesto, / per cambiare modalità",

View file

@ -105,6 +105,7 @@
"enhancePrompt": "追加コンテキストでプロンプトを強化",
"addImages": "メッセージに画像を追加",
"sendMessage": "メッセージを送信",
"stopTts": "テキスト読み上げを停止",
"typeMessage": "メッセージを入力...",
"typeTask": "ここにタスクを入力...",
"addContext": "コンテキスト追加は@、モード切替は/",

View file

@ -105,6 +105,7 @@
"enhancePrompt": "추가 컨텍스트로 프롬프트 향상",
"addImages": "메시지에 이미지 추가",
"sendMessage": "메시지 보내기",
"stopTts": "텍스트 음성 변환 중지",
"typeMessage": "메시지 입력...",
"typeTask": "여기에 작업 입력...",
"addContext": "컨텍스트 추가는 @, 모드 전환은 /",

View file

@ -112,6 +112,7 @@
},
"addImages": "Afbeeldingen toevoegen aan bericht",
"sendMessage": "Bericht verzenden",
"stopTts": "Stop tekst-naar-spraak",
"typeMessage": "Typ een bericht...",
"typeTask": "Typ hier je taak...",
"addContext": "@ om context toe te voegen, / om van modus te wisselen",

View file

@ -105,6 +105,7 @@
"enhancePrompt": "Ulepsz podpowiedź dodatkowym kontekstem",
"addImages": "Dodaj obrazy do wiadomości",
"sendMessage": "Wyślij wiadomość",
"stopTts": "Zatrzymaj syntezę mowy",
"typeMessage": "Wpisz wiadomość...",
"typeTask": "Wpisz swoje zadanie tutaj...",
"addContext": "@ aby dodać kontekst, / aby zmienić tryb",

View file

@ -105,6 +105,7 @@
"enhancePrompt": "Aprimorar prompt com contexto adicional",
"addImages": "Adicionar imagens à mensagem",
"sendMessage": "Enviar mensagem",
"stopTts": "Parar conversão de texto em fala",
"typeMessage": "Digite uma mensagem...",
"typeTask": "Digite sua tarefa aqui...",
"addContext": "@ para adicionar contexto, / para alternar modos",

View file

@ -112,6 +112,7 @@
},
"addImages": "Добавить изображения к сообщению",
"sendMessage": "Отправить сообщение",
"stopTts": "Остановить синтез речи",
"typeMessage": "Введите сообщение...",
"typeTask": "Введите вашу задачу здесь...",
"addContext": "@ для добавления контекста, / для смены режима",

View file

@ -105,6 +105,7 @@
"enhancePrompt": "Ek bağlamla istemi geliştir",
"addImages": "Mesaja resim ekle",
"sendMessage": "Mesaj gönder",
"stopTts": "Metin okumayı durdur",
"typeMessage": "Bir mesaj yazın...",
"typeTask": "Görevinizi buraya yazın...",
"addContext": "Bağlam eklemek için @, mod değiştirmek için /",

View file

@ -105,6 +105,7 @@
"enhancePrompt": "Nâng cao yêu cầu với ngữ cảnh bổ sung",
"addImages": "Thêm hình ảnh vào tin nhắn",
"sendMessage": "Gửi tin nhắn",
"stopTts": "Dừng chuyển văn bản thành giọng nói",
"typeMessage": "Nhập tin nhắn...",
"typeTask": "Nhập nhiệm vụ của bạn tại đây...",
"addContext": "@ để thêm ngữ cảnh, / để chuyển chế độ",

View file

@ -105,6 +105,7 @@
"enhancePrompt": "增强提示词",
"addImages": "添加图片到消息",
"sendMessage": "发送消息",
"stopTts": "停止文本转语音",
"typeMessage": "输入消息...",
"typeTask": "在此处输入您的任务...",
"addContext": "@添加上下文,/切换模式",

View file

@ -105,6 +105,7 @@
"enhancePrompt": "使用額外內容增強提示",
"addImages": "新增圖片到訊息中",
"sendMessage": "傳送訊息",
"stopTts": "停止文字轉語音",
"typeMessage": "輸入訊息...",
"typeTask": "在此處輸入您的工作...",
"addContext": "輸入 @ 新增內容,輸入 / 切換模式",