Skip to content

feat(ui): paint card Base button red when a custom Base Url is set#26

Merged
Cmochance merged 1 commit into
mainfrom
feat/baseurl-button-warning-style
May 9, 2026
Merged

feat(ui): paint card Base button red when a custom Base Url is set#26
Cmochance merged 1 commit into
mainfrom
feat/baseurl-button-warning-style

Conversation

@Cmochance
Copy link
Copy Markdown
Owner

What

Visual cue on each profile card: the Base button turns red whenever a custom Base Url is set on that profile.

Why

A non-OpenAI Base Url breaks ChatGPT / OAuth accounts — the OAuth callback can't reach the redirected endpoint, so login / refresh fail. The Base button currently looks identical regardless of state, making it easy to forget that a profile's Base Url is overridden when switching.

How

  • Reuse the existing `profile-action-button-danger` class (soft red border + hover background — same look as the Delete button) when `profile.openai_base_url` is non-null. No new CSS; theme variables already pick this up across light / dark / etc.
  • Tooltip swaps to a new `profileBaseConfigured` copy explaining the OAuth-breakage risk and the workaround (clear Base Url before switching to a ChatGPT / OAuth profile).

i18n

en + zh-CN strings added for `profileBaseConfigured`.

Test plan

  • `npx tsc --noEmit` clean.
  • `npm run build` produces clean vite output.
  • Live: rebuild app, set a Base Url on one card, confirm only that card's Base button shows red and the hover tooltip explains the risk; clear the Base Url, button reverts.

🤖 Generated with Claude Code

Setting a non-OpenAI Base Url breaks ChatGPT / OAuth accounts because
the OAuth callback can't reach the redirected endpoint. The Base
button on each card looks identical whether a custom Base Url is set
or not, which makes it easy to forget that "this profile's Base Url
is overridden" state when switching.

Visual signal:
- Reuse the existing `profile-action-button-danger` styling (soft
  red border + hover background) on the Base button when
  `profile.openai_base_url` is non-null. No new CSS — the variable
  themes already pick this up.
- Tooltip swaps to the new `profileBaseConfigured` copy explaining
  the OAuth-breakage risk and the suggested workaround (clear the
  Base Url before switching to a ChatGPT / OAuth account).

Locale: zh-CN + en strings added.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@Cmochance
Copy link
Copy Markdown
Owner Author

本地 3-agent review 汇总(pre-push)

feedback_pre_push_local_review 默认起 code-reviewer + silent-failure-hunter + pr-test-analyzer 三路并行,结论:clean,可合并

各 agent 共识

  • code-reviewer:条件 class + tooltip 正确只挂在 Base 按钮(data-base-url-profile)上;profile-action-button-dangerbase.css:1473/2097/2103 已有类,无新 CSS;profileBaseConfigured i18n 在 en + zh-CN 都补齐,locale fallback 不会缺键。
  • silent-failure-hunter:truthy 检查 profile.openai_base_url 安全。Rust 写入路径在 mac/win/runtime/profile_actions.rs:27normalize_openai_base_url 会把 trim 后空字符串转 None,所以前端不可能看到 stale ""。preview mock fixture 也都是 null / 真实 URL,无 undefined 漏入。
  • pr-test-analyzer:UI 视觉变更,仓库无前端测试基建。但 Rust 侧 profile_actions.rs 已断言"清空 Base URL → 落 None"的契约(见 line 505/572),是这条 UI 条件的回归网。无 gap。

唯一观察(不阻塞)

  • 当一个 profile 既被设了 Base URL 又是非 active(可删除)时,卡片上 Delete 和 Base 两个红按钮会同时出现。code-reviewer 确认这是预期视觉警示,可接受。

剩余在你侧

  1. 完成 PR description 的 hand-test checklist 最后一项(设 Base URL → 看红按钮 + tooltip → 清空 → 按钮回灰)。
  2. 如果想跟 main 当前 head(v1.5.6 + PR fix(login): hold Child handle and reap on cancel to close PID-reuse race #29 的 cancel 修复)合并,可能要先 rebase / 合 PR fix(login): hold Child handle and reap on cancel to close PID-reuse race #29 后再合本 PR;或者本 PR 先合,PR fix(login): hold Child handle and reap on cancel to close PID-reuse race #29 之后会自动 rebase。

🤖 review summary by Claude Code

@Cmochance Cmochance merged commit d9f14ab into main May 9, 2026
3 checks passed
@Cmochance Cmochance deleted the feat/baseurl-button-warning-style branch May 9, 2026 19:07
Cmochance added a commit that referenced this pull request May 9, 2026
Bumps package.json to 1.5.7 (and lets `version-sync.mjs` propagate
to Cargo.toml + Cargo.lock + package-lock.json) and adds the 1.5.7
CHANGELOG entry covering #26, #29, #30, #31:

- #29 critical: PID-reuse race + buffer-fill hang in login cancel
- #26 baseurl button red warning style
- #30 InstallState + codex CLI helpers refactor to shared
- #31 a11y aria-label + bounded mac PATH probe

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant