From 22ecda23a923d30b64f4c74cc9a90bfabeb6a695 Mon Sep 17 00:00:00 2001 From: usrnk1 <7547651+usrnk1@users.noreply.github.com> Date: Fri, 20 Nov 2026 14:44:55 +0100 Subject: [PATCH] fix(browser): show browser profiles inline and tidy settings copy (#65174) --- .../component-tests/browser-settings.spec.ts | 14 ++++---- packages/gui-plugins/src/browser/i18n/en.ts | 16 ++++----- packages/gui-plugins/src/browser/settings.tsx | 36 +++++++++++-------- 3 files changed, 37 insertions(+), 29 deletions(-) diff --git a/packages/app/component-tests/browser-settings.spec.ts b/packages/app/component-tests/browser-settings.spec.ts index bd3edb0c261..376004ab36f 100644 --- a/packages/app/component-tests/browser-settings.spec.ts +++ b/packages/app/component-tests/browser-settings.spec.ts @@ -106,9 +106,9 @@ story("each switch is named by its row's title, and each row says what it does i // The switch's accessible name is the row's title, so a screen reader hears what the row shows. for (const [id, title, description] of [ - ["settings-browser-links", "Open links in OpenCode", "Hold Shift and click a link to use your default browser."], - ["settings-browser-remote", "Share sign-ins with remote servers", "Only turn on for servers you trust, since they can access your signed\u2011in sites."], - ["settings-browser-agent-pages", "Open browser automatically", "Show the tab when the agent opens a page or file for you."], + ["settings-browser-links", "Open links in OpenCode", "Hold Shift and click a link to use your default browser"], + ["settings-browser-remote", "Share sign-ins with remote servers", "Only turn on for servers you trust, since they can access your signed\u2011in sites"], + ["settings-browser-agent-pages", "Open browser automatically", "Show the tab when the agent opens a page or file for you"], ] as const) { await expect(row(id).locator('[data-slot="settings-row-title"]')).toHaveText(title) await expect(row(id).locator('[data-slot="settings-row-description"]')).toHaveText(description) @@ -116,7 +116,7 @@ story("each switch is named by its row's title, and each row says what it does i } await expect(row("settings-browser-extensions").locator('[data-slot="settings-row-description"]')).toHaveText( - "Install from the Chrome Web Store, Edge Add-ons, or your other browsers.", + "Install from the Chrome Web Store, Edge Add-ons, or your other browsers", ) const sites = view.root.getByRole("region", { name: "Site permissions", exact: true }) await expect(sites.locator('[data-slot="settings-row-title"]')).toHaveText("No saved permissions") @@ -128,7 +128,7 @@ story("the red button asks first: Cancel, Escape, Enter on Cancel and a click ou const cancel = view.confirm.getByRole("button", { name: "Cancel", exact: true }) const confirm = view.confirm.getByRole("button", { name: "Clear data", exact: true }) - await expect(view.data.getByText("0 cookies. Sign-ins are shared across sessions.", { exact: true })).toBeVisible() + await expect(view.data.getByText("0 cookies. Sign-ins are shared across sessions", { exact: true })).toBeVisible() await view.clear.click() // One title, one line, two buttons: no close button, as the app's other confirmations. await expect(view.confirm.getByText("This signs you out of all sites and deletes history in OpenCode, leaving your other browsers untouched.", { exact: true })).toBeVisible() @@ -156,7 +156,7 @@ story("the red button asks first: Cancel, Escape, Enter on Cancel and a click ou } // Nothing ran: the row still shows the count, the window's last pages are there, and the button is ready again. - await expect(view.data.getByText("0 cookies. Sign-ins are shared across sessions.", { exact: true })).toBeVisible() + await expect(view.data.getByText("0 cookies. Sign-ins are shared across sessions", { exact: true })).toBeVisible() await expect(view.visits).toHaveText("1") await expect(view.clear).toBeEnabled() @@ -203,7 +203,7 @@ for (const [name, file, line] of [ const view = await open(page, { target: "settings-browser-cookies", file }) await expect(view.root.getByText("Import cookie file", { exact: true })).toBeVisible() - await expect(view.root.getByText("Supports cookies.txt or JSON from browser extensions or Playwright.", { exact: true })).toBeVisible() + await expect(view.root.getByText("Supports cookies.txt or JSON from browser extensions or Playwright", { exact: true })).toBeVisible() await view.root.getByRole("button", { name: "Choose file", exact: true }).click() await expect(view.root.getByText(line, { exact: true })).toBeVisible() }) diff --git a/packages/gui-plugins/src/browser/i18n/en.ts b/packages/gui-plugins/src/browser/i18n/en.ts index 3c0daab63da..04f85a62260 100644 --- a/packages/gui-plugins/src/browser/i18n/en.ts +++ b/packages/gui-plugins/src/browser/i18n/en.ts @@ -191,9 +191,9 @@ export default { "settings.open": "Browser settings", "settings.unavailable": "The browser is available in the desktop app.", "settings.links.title": "Open links in OpenCode", - "settings.links.description": "Hold Shift and click a link to use your default browser.", + "settings.links.description": "Hold Shift and click a link to use your default browser", "settings.remote.title": "Share sign-ins with remote servers", - "settings.remote.description": "Only turn on for servers you trust, since they can access your signed\u2011in sites.", + "settings.remote.description": "Only turn on for servers you trust, since they can access your signed\u2011in sites", "settings.import.title": "Import from another browser", "settings.import.none": "No other browser found on this computer", "settings.import.choose": "Choose sites", @@ -211,14 +211,14 @@ export default { "sites.empty": "This profile has no sites to import.", "sites.unmatched": "No site matches your search.", "settings.import.file.title": "Import cookie file", - "settings.import.file.description": "Supports cookies.txt or JSON from browser extensions or Playwright.", + "settings.import.file.description": "Supports cookies.txt or JSON from browser extensions or Playwright", "settings.import.file.action": "Choose file", "settings.import.file.pick": "Choose a cookie file", "settings.extensions.title": "Extensions", - "settings.extensions.note": "Some extensions may not work here yet.", + "settings.extensions.note": "Some extensions may not work here yet", "settings.extensions.add.title": "Add an extension", "settings.extensions.confirm.title": 'Add "{{name}}"?', - "settings.extensions.add.description": "Install from the Chrome Web Store, Edge Add-ons, or your other browsers.", + "settings.extensions.add.description": "Install from the Chrome Web Store, Edge Add-ons, or your other browsers", "settings.extensions.dialog.description": "Extensions run on every page in this browser.", "settings.extensions.store.label": "Link to the extension", "settings.extensions.store.placeholder": "Paste a Chrome Web Store or Edge Add-ons link", @@ -235,8 +235,8 @@ export default { "settings.extensions.enable": "Turn on {{name}}", "settings.data.title": "Browser data", "settings.cookies.title": "Cookies and site data", - "settings.cookies.count.one": "{{count}} cookie. Sign-ins are shared across sessions.", - "settings.cookies.count.other": "{{count}} cookies. Sign-ins are shared across sessions.", + "settings.cookies.count.one": "{{count}} cookie. Sign-ins are shared across sessions", + "settings.cookies.count.other": "{{count}} cookies. Sign-ins are shared across sessions", "settings.cookies.clear": "Clear browsing data", "settings.cleared": "Cleared browsing data.", "settings.cleared.history": "Cleared sign-ins and site data, but history could not be cleared.", @@ -254,7 +254,7 @@ export default { "menu.pageUnavailable": "This page can't open in your default browser", "menu.privateAddress": "This address only works in OpenCode's browser.", "settings.agentPages.title": "Open browser automatically", - "settings.agentPages.description": "Show the tab when the agent opens a page or file for you.", + "settings.agentPages.description": "Show the tab when the agent opens a page or file for you", "tab.activity": "The agent used this tab", "menu.failed": "Couldn't open this page in your default browser.", "menu.copyLink": "Copy link address", diff --git a/packages/gui-plugins/src/browser/settings.tsx b/packages/gui-plugins/src/browser/settings.tsx index d7ab9718459..ed9a056885a 100644 --- a/packages/gui-plugins/src/browser/settings.tsx +++ b/packages/gui-plugins/src/browser/settings.tsx @@ -109,8 +109,7 @@ export default function BrowserSettings(props: { target?: string }) { image={choice.source.icon} fallback="outline-globe" name={choice.source.name} - detail={choice.source.profiles.length > 1 ? choice.profile.name : undefined} - keep + aside={choice.source.profiles.length > 1 ? choice.profile.name : undefined} message={ jobs.importing(choice) ? jobs.notice() : results().get(resultKey(choice.source.id, choice.profile.id)) } @@ -230,13 +229,18 @@ export default function BrowserSettings(props: { target?: string }) { + title={ctx.t("settings.import.file.title")} + description={ + + {(message) => ( + + {message().text} + + )} + } > props.note) @@ -854,7 +858,12 @@ function Identity(props: { - {props.name} + + {props.name} + + {(aside) => {aside()}} + + {(message) => ( - {(detail) => {detail()} ยท }