Skip to content

Commit 495b5c6

Browse files
brunobergherroomote[bot]roomote
authored
ux: improve auto-approve timer visibility in follow-up suggestions (#10048)
Co-authored-by: roomote[bot] <219738659+roomote[bot]@users.noreply.github.com> Co-authored-by: Roo Code <[email protected]>
1 parent f97b515 commit 495b5c6

File tree

20 files changed

+40
-49
lines changed

20 files changed

+40
-49
lines changed

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

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import { useCallback, useEffect, useState } from "react"
2-
import { ClipboardCopy } from "lucide-react"
2+
import { ClipboardCopy, Timer } from "lucide-react"
33

44
import { Button, StandardTooltip } from "@/components/ui"
55

66
import { useAppTranslation } from "@src/i18n/TranslationContext"
77
import { useExtensionState } from "@src/context/ExtensionStateContext"
88
import { SuggestionItem } from "@roo-code/types"
9+
import { cn } from "@/lib/utils"
910

1011
const DEFAULT_FOLLOWUP_TIMEOUT_MS = 60000
1112
const COUNTDOWN_INTERVAL_MS = 1000
@@ -111,18 +112,24 @@ export const FollowUpSuggest = ({
111112
<div key={`${suggestion.answer}-${ts}`} className="w-full relative group">
112113
<Button
113114
variant="outline"
114-
className="text-left whitespace-normal break-words w-full h-auto px-3 py-2 justify-start pr-8 rounded-xl"
115+
className={cn(
116+
"text-left whitespace-normal break-words w-full h-auto px-3 py-2 justify-start pr-8 rounded-xl",
117+
isFirstSuggestion &&
118+
countdown !== null &&
119+
!suggestionSelected &&
120+
!isAnswered &&
121+
"border-vscode-foreground/60 rounded-b-none -mb-1",
122+
)}
115123
onClick={(event) => handleSuggestionClick(suggestion, event)}
116124
aria-label={suggestion.answer}>
117125
{suggestion.answer}
118-
{isFirstSuggestion && countdown !== null && !suggestionSelected && !isAnswered && (
119-
<span
120-
className="ml-2 px-1.5 py-0.5 text-xs rounded-full bg-vscode-badge-background text-vscode-badge-foreground"
121-
title={t("chat:followUpSuggest.autoSelectCountdown", { count: countdown })}>
122-
{t("chat:followUpSuggest.countdownDisplay", { count: countdown })}
123-
</span>
124-
)}
125126
</Button>
127+
{isFirstSuggestion && countdown !== null && !suggestionSelected && !isAnswered && (
128+
<p className="rounded-b-xl border-1 border-t-0 border-vscode-foreground/60 text-vscode-descriptionForeground text-xs m-0 mt-1 px-3 pt-2 pb-2">
129+
<Timer className="size-3 inline-block -mt-0.5 mr-1 animate-pulse" />
130+
{t("chat:followUpSuggest.timerPrefix", { seconds: countdown })}
131+
</p>
132+
)}
126133
{suggestion.mode && (
127134
<div className="absolute bottom-0 right-0 text-[10px] bg-vscode-badge-background text-vscode-badge-foreground px-1 py-0.5 border border-vscode-badge-background flex items-center gap-0.5">
128135
<span className="codicon codicon-arrow-right" style={{ fontSize: "8px" }} />

webview-ui/src/components/chat/__tests__/FollowUpSuggest.spec.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@ vi.mock("@src/i18n/TranslationContext", () => ({
1212
if (key === "chat:followUpSuggest.countdownDisplay" && options?.count !== undefined) {
1313
return `${options.count}s`
1414
}
15-
if (key === "chat:followUpSuggest.autoSelectCountdown" && options?.count !== undefined) {
16-
return `Auto-selecting in ${options.count} seconds`
17-
}
1815
if (key === "chat:followUpSuggest.copyToInput") {
1916
return "Copy to input"
2017
}
18+
if (key === "chat:followUpSuggest.timerPrefix" && options?.seconds !== undefined) {
19+
return "Auto-approve enabled. Selecting in " + options.seconds + "s…"
20+
}
21+
2122
return key
2223
},
2324
}),
@@ -93,8 +94,9 @@ describe("FollowUpSuggest", () => {
9394
defaultTestState,
9495
)
9596

96-
// Should show initial countdown (3 seconds)
97+
// Should countdown and mention
9798
expect(screen.getByText(/3s/)).toBeInTheDocument()
99+
expect(screen.getByText(/Selecting in 3s/)).toBeInTheDocument()
98100
})
99101

100102
it("should not display countdown timer when isAnswered is true", () => {

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

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,8 +341,7 @@
341341
},
342342
"followUpSuggest": {
343343
"copyToInput": "Copy to input (same as shift + click)",
344-
"autoSelectCountdown": "Auto-selecting in {{count}}s",
345-
"countdownDisplay": "{{count}}s"
344+
"timerPrefix": "Auto-approve enabled. Selecting in {{seconds}}s…"
346345
},
347346
"browser": {
348347
"session": "Browser Session",

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

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)