Skip to content

Commit ab31a16

Browse files
committed
UI improvements for a more guided flow
1 parent af27a16 commit ab31a16

File tree

19 files changed

+81
-35
lines changed

19 files changed

+81
-35
lines changed

webview-ui/src/components/cloud/CloudView.tsx

Lines changed: 44 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useEffect, useRef, useState } from "react"
2-
import { VSCodeButton, VSCodeTextField } from "@vscode/webview-ui-toolkit/react"
2+
import { VSCodeButton, VSCodeProgressRing, VSCodeTextField } from "@vscode/webview-ui-toolkit/react"
33

44
import { type CloudUserInfo, TelemetryEventName } from "@roo-code/types"
55

@@ -26,6 +26,7 @@ export const CloudView = ({ userInfo, isAuthenticated, cloudApiUrl, onDone }: Cl
2626
const { remoteControlEnabled, setRemoteControlEnabled } = useExtensionState()
2727
const wasAuthenticatedRef = useRef(false)
2828
const timeoutRef = useRef<NodeJS.Timeout | null>(null)
29+
const manualUrlInputRef = useRef<HTMLInputElement | null>(null)
2930

3031
// Manual URL entry state
3132
const [authInProgress, setAuthInProgress] = useState(false)
@@ -54,6 +55,16 @@ export const CloudView = ({ userInfo, isAuthenticated, cloudApiUrl, onDone }: Cl
5455
}
5556
}, [isAuthenticated])
5657

58+
// Focus the manual URL input when it becomes visible
59+
useEffect(() => {
60+
if (showManualEntry && manualUrlInputRef.current) {
61+
// Small delay to ensure the DOM is ready
62+
setTimeout(() => {
63+
manualUrlInputRef.current?.focus()
64+
}, 50)
65+
}
66+
}, [showManualEntry])
67+
5768
// Cleanup timeout on unmount
5869
useEffect(() => {
5970
return () => {
@@ -98,6 +109,12 @@ export const CloudView = ({ userInfo, isAuthenticated, cloudApiUrl, onDone }: Cl
98109
setShowManualEntry(true)
99110
}
100111

112+
const handleReset = () => {
113+
setAuthInProgress(false)
114+
setShowManualEntry(false)
115+
setManualUrl("")
116+
}
117+
101118
const handleLogoutClick = () => {
102119
// Send telemetry for cloud logout action
103120
// NOTE: Using ACCOUNT_* telemetry events for backward compatibility with analytics
@@ -239,39 +256,50 @@ export const CloudView = ({ userInfo, isAuthenticated, cloudApiUrl, onDone }: Cl
239256
</div>
240257

241258
<div className="flex flex-col items-center gap-4">
242-
<VSCodeButton appearance="primary" onClick={handleConnectClick} className="w-1/2">
243-
{t("cloud:connect")}
244-
</VSCodeButton>
259+
{!authInProgress && (
260+
<VSCodeButton appearance="primary" onClick={handleConnectClick} className="w-1/2">
261+
{t("cloud:connect")}
262+
</VSCodeButton>
263+
)}
245264

246265
{/* Manual entry section */}
247266
{authInProgress && !showManualEntry && (
248267
// Timeout message with "Having trouble?" link
249-
<div className="flex flex-col items-center gap-2">
250-
<div className="text-sm text-vscode-descriptionForeground">
268+
<div className="flex flex-col items-center gap-1">
269+
<div className="flex items-center gap-2 text-sm text-vscode-descriptionForeground">
270+
<VSCodeProgressRing className="size-3 text-vscode-foreground" />
251271
{t("cloud:authWaiting")}
252272
</div>
253-
<button
254-
onClick={handleShowManualEntry}
255-
className="text-sm text-vscode-textLink-foreground hover:text-vscode-textLink-activeForeground underline cursor-pointer bg-transparent border-none p-0">
256-
{t("cloud:havingTrouble")}
257-
</button>
273+
{!showManualEntry && (
274+
<button
275+
onClick={handleShowManualEntry}
276+
className="text-sm text-vscode-textLink-foreground hover:text-vscode-textLink-activeForeground underline cursor-pointer bg-transparent border-none p-0">
277+
{t("cloud:havingTrouble")}
278+
</button>
279+
)}
258280
</div>
259281
)}
260282

261283
{showManualEntry && (
262284
// Manual URL entry form
263-
<>
264-
<div className="text-xs text-vscode-descriptionForeground">
285+
<div className="space-y-2 text-center border-border/50 border-t px-2 pt-8 mt-3">
286+
<p className="text-xs text-vscode-descriptionForeground">
265287
{t("cloud:pasteCallbackUrl")}
266-
</div>
288+
</p>
267289
<VSCodeTextField
290+
ref={manualUrlInputRef as any}
268291
value={manualUrl}
269292
onChange={handleManualUrlChange}
270293
onKeyDown={handleKeyDown}
271294
placeholder="vscode://RooVeterinaryInc.roo-cline/auth/clerk/callback?state=..."
272-
className="w-1/2"
295+
className="w-full"
273296
/>
274-
</>
297+
<button
298+
onClick={handleReset}
299+
className="text-sm text-vscode-textLink-foreground hover:text-vscode-textLink-activeForeground underline cursor-pointer bg-transparent border-none p-0">
300+
{t("cloud:startOver")}
301+
</button>
302+
</div>
275303
)}
276304
</div>
277305
</>

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

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

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

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

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"remoteControl": "Roomote Control",
1515
"remoteControlDescription": "Enable following and interacting with tasks in this workspace with Roo Code Cloud",
1616
"cloudUrlPillLabel": "Roo Code Cloud URL",
17-
"authWaiting": "Waiting for authentication to complete...",
17+
"authWaiting": "Waiting for browser authentication...",
1818
"havingTrouble": "Having trouble?",
19-
"pasteCallbackUrl": "Copy the redirect URL from your browser and paste it here:"
19+
"pasteCallbackUrl": "Copy the redirect URL from your browser and paste it here:",
20+
"startOver": "Start over"
2021
}

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

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

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

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

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

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

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

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

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

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

webview-ui/src/i18n/locales/ja/cloud.json

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

0 commit comments

Comments
 (0)