Skip to content

Commit 06cd55d

Browse files
committed
fix: incorporate PR feedback for cloud URL indicator
- Fixed href syntax error (removed quotes around curly braces) - Added translation support for "Roo Code Cloud URL:" label - Extracted production URL as a constant (PRODUCTION_CLOUD_URL) - Implemented proper link handling using vscode.postMessage - Updated tests to match new implementation
1 parent 2c1ff36 commit 06cd55d

File tree

3 files changed

+23
-7
lines changed

3 files changed

+23
-7
lines changed

webview-ui/src/components/account/AccountView.tsx

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ type AccountViewProps = {
1818
onDone: () => void
1919
}
2020

21+
const PRODUCTION_CLOUD_URL = "https://app.roocode.com"
22+
2123
export const AccountView = ({ userInfo, isAuthenticated, cloudApiUrl, onDone }: AccountViewProps) => {
2224
const { t } = useAppTranslation()
2325
const { remoteControlEnabled, setRemoteControlEnabled } = useExtensionState()
@@ -51,10 +53,16 @@ export const AccountView = ({ userInfo, isAuthenticated, cloudApiUrl, onDone }:
5153
const handleVisitCloudWebsite = () => {
5254
// Send telemetry for cloud website visit
5355
telemetryClient.capture(TelemetryEventName.ACCOUNT_CONNECT_CLICKED)
54-
const cloudUrl = cloudApiUrl || "https://app.roocode.com"
56+
const cloudUrl = cloudApiUrl || PRODUCTION_CLOUD_URL
5557
vscode.postMessage({ type: "openExternal", url: cloudUrl })
5658
}
5759

60+
const handleOpenCloudUrl = () => {
61+
if (cloudApiUrl) {
62+
vscode.postMessage({ type: "openExternal", url: cloudApiUrl })
63+
}
64+
}
65+
5866
const handleRemoteControlToggle = () => {
5967
const newValue = !remoteControlEnabled
6068
setRemoteControlEnabled(newValue)
@@ -181,11 +189,15 @@ export const AccountView = ({ userInfo, isAuthenticated, cloudApiUrl, onDone }:
181189
</div>
182190
</>
183191
)}
184-
{cloudApiUrl && cloudApiUrl !== "https://app.roocode.com" && (
192+
{cloudApiUrl && cloudApiUrl !== PRODUCTION_CLOUD_URL && (
185193
<div className="mt-6 flex justify-center">
186194
<div className="inline-flex items-center px-3 py-1 gap-1 rounded-full bg-vscode-badge-background/50 text-vscode-badge-foreground text-xs">
187-
<span className="text-vscode-foreground/75">Roo Code Cloud URL: </span>
188-
<a href="{cloudApiUrl}">{cloudApiUrl}</a>
195+
<span className="text-vscode-foreground/75">{t("account:cloudUrlPillLabel")}</span>
196+
<button
197+
onClick={handleOpenCloudUrl}
198+
className="text-vscode-textLink-foreground hover:text-vscode-textLink-activeForeground underline cursor-pointer bg-transparent border-none p-0">
199+
{cloudApiUrl}
200+
</button>
189201
</div>
190202
</div>
191203
)}

webview-ui/src/components/account/__tests__/AccountView.spec.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ vi.mock("@src/i18n/TranslationContext", () => ({
2121
"account:remoteControlDescription":
2222
"Enable following and interacting with tasks in this workspace with Roo Code Cloud",
2323
"account:profilePicture": "Profile picture",
24+
"account:cloudUrlPillLabel": "Roo Code Cloud URL: ",
2425
}
2526
return translations[key] || key
2627
},
@@ -184,7 +185,8 @@ describe("AccountView", () => {
184185
)
185186

186187
// Check that the cloud URL pill is displayed with the staging URL
187-
expect(screen.getByText("Roo Code Cloud URL: https://staging.roocode.com")).toBeInTheDocument()
188+
expect(screen.getByText(/Roo Code Cloud URL:/)).toBeInTheDocument()
189+
expect(screen.getByText("https://staging.roocode.com")).toBeInTheDocument()
188190
})
189191

190192
it("should display cloud URL pill for non-authenticated users when not pointing to production", () => {
@@ -198,7 +200,8 @@ describe("AccountView", () => {
198200
)
199201

200202
// Check that the cloud URL pill is displayed even when not authenticated
201-
expect(screen.getByText("Roo Code Cloud URL: https://dev.roocode.com")).toBeInTheDocument()
203+
expect(screen.getByText(/Roo Code Cloud URL:/)).toBeInTheDocument()
204+
expect(screen.getByText("https://dev.roocode.com")).toBeInTheDocument()
202205
})
203206

204207
it("should not display cloud URL pill when cloudApiUrl is undefined", () => {

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
"cloudBenefitMetrics": "Get a holistic view of your token consumption",
1313
"visitCloudWebsite": "Visit Roo Code Cloud",
1414
"remoteControl": "Roomote Control",
15-
"remoteControlDescription": "Enable following and interacting with tasks in this workspace with Roo Code Cloud"
15+
"remoteControlDescription": "Enable following and interacting with tasks in this workspace with Roo Code Cloud",
16+
"cloudUrlPillLabel": "Roo Code Cloud URL: "
1617
}

0 commit comments

Comments
 (0)