Skip to content

Commit 6b17ae3

Browse files
committed
Fixes #5293: Add share button next to send button and shorten 'Start New Task' to 'Start Task'
- Added ShareButton component to ChatTextArea bottom toolbar next to send button - Modified ShareButton to support allowNoItem prop for rendering without current task - Updated all 18 translation files to change 'Start New Task' to 'Start Task' - ShareButton is disabled when send is disabled to maintain consistent UX - Reuses existing share functionality for improved discoverability
1 parent 3a8ba27 commit 6b17ae3

File tree

20 files changed

+26
-21
lines changed

20 files changed

+26
-21
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import { IconButton } from "./IconButton"
3030
import { IndexingStatusDot } from "./IndexingStatusBadge"
3131
import { cn } from "@/lib/utils"
3232
import { usePromptHistory } from "./hooks/usePromptHistory"
33+
import { ShareButton } from "./ShareButton"
3334

3435
interface ChatTextAreaProps {
3536
inputValue: string
@@ -1147,6 +1148,7 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
11471148
disabled={shouldDisableImages}
11481149
onClick={onSelectImages}
11491150
/>
1151+
<ShareButton allowNoItem={true} disabled={sendingDisabled} />
11501152
<IconButton
11511153
iconClass="codicon-send"
11521154
title={t("chat:sendMessage")}

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@ import {
2626
interface ShareButtonProps {
2727
item?: HistoryItem
2828
disabled?: boolean
29+
allowNoItem?: boolean // Allow sharing even when there's no current task
2930
}
3031

31-
export const ShareButton = ({ item, disabled = false }: ShareButtonProps) => {
32+
export const ShareButton = ({ item, disabled = false, allowNoItem = false }: ShareButtonProps) => {
3233
const [shareDropdownOpen, setShareDropdownOpen] = useState(false)
3334
const [connectModalOpen, setConnectModalOpen] = useState(false)
3435
const [shareSuccess, setShareSuccess] = useState<{ visibility: ShareVisibility; url: string } | null>(null)
@@ -81,6 +82,8 @@ export const ShareButton = ({ item, disabled = false }: ShareButtonProps) => {
8182
telemetryClient.capture(TelemetryEventName.SHARE_PUBLIC_CLICKED)
8283
}
8384

85+
// If there's no current task but allowNoItem is true, we still try to share
86+
// The extension will handle this case appropriately
8487
vscode.postMessage({
8588
type: "shareCurrentTask",
8689
visibility,
@@ -135,8 +138,8 @@ export const ShareButton = ({ item, disabled = false }: ShareButtonProps) => {
135138

136139
const shareButtonState = getShareButtonState()
137140

138-
// Don't render if no item ID
139-
if (!item?.id) {
141+
// Don't render if no item ID unless allowNoItem is true
142+
if (!item?.id && !allowNoItem) {
140143
return null
141144
}
142145

webview-ui/src/i18n/locales/ca/chat.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"tooltip": "Torna a provar l'operació"
3636
},
3737
"startNewTask": {
38-
"title": "Començar una nova tasca",
38+
"title": "Començar tasca",
3939
"tooltip": "Comença una nova tasca"
4040
},
4141
"proceedAnyways": {

webview-ui/src/i18n/locales/de/chat.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"tooltip": "Versuch erneut starten"
3636
},
3737
"startNewTask": {
38-
"title": "Neue Aufgabe starten",
38+
"title": "Aufgabe starten",
3939
"tooltip": "Beginne eine neue Aufgabe"
4040
},
4141
"proceedAnyways": {

webview-ui/src/i18n/locales/en/chat.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"tooltip": "Try the operation again"
3131
},
3232
"startNewTask": {
33-
"title": "Start New Task",
33+
"title": "Start Task",
3434
"tooltip": "Begin a new task"
3535
},
3636
"proceedAnyways": {

webview-ui/src/i18n/locales/es/chat.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"tooltip": "Intenta la operación de nuevo"
3131
},
3232
"startNewTask": {
33-
"title": "Iniciar nueva tarea",
33+
"title": "Iniciar tarea",
3434
"tooltip": "Comienza una nueva tarea"
3535
},
3636
"proceedAnyways": {

webview-ui/src/i18n/locales/fr/chat.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"tooltip": "Tenter à nouveau l'opération"
3636
},
3737
"startNewTask": {
38-
"title": "Commencer une nouvelle tâche",
38+
"title": "Commencer tâche",
3939
"tooltip": "Démarrer une nouvelle tâche"
4040
},
4141
"proceedAnyways": {

webview-ui/src/i18n/locales/hi/chat.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"tooltip": "ऑपरेशन फिर से प्रयास करें"
3636
},
3737
"startNewTask": {
38-
"title": "नया कार्य शुरू करें",
38+
"title": "कार्य शुरू करें",
3939
"tooltip": "नया कार्य शुरू करें"
4040
},
4141
"proceedAnyways": {

webview-ui/src/i18n/locales/id/chat.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"tooltip": "Coba operasi lagi"
3434
},
3535
"startNewTask": {
36-
"title": "Mulai Tugas Baru",
36+
"title": "Mulai Tugas",
3737
"tooltip": "Mulai tugas baru"
3838
},
3939
"reportBug": {

webview-ui/src/i18n/locales/it/chat.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"tooltip": "Prova di nuovo l'operazione"
3636
},
3737
"startNewTask": {
38-
"title": "Inizia nuova attività",
38+
"title": "Inizia attività",
3939
"tooltip": "Inizia una nuova attività"
4040
},
4141
"proceedAnyways": {

0 commit comments

Comments
 (0)