Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

fix(backends): tidy Settings → Backends UX (breadcrumb, Save, OAuth clutter)

cyh535fc28ff80c
diff --git a/ui/src/components/settings/SettingsClaudeProviderPage.tsx b/ui/src/components/settings/SettingsClaudeProviderPage.tsx
index 3a5234887..9cdd5d2c3 100644
--- a/ui/src/components/settings/SettingsClaudeProviderPage.tsx
+++ b/ui/src/components/settings/SettingsClaudeProviderPage.tsx
@@ -108,6 +108,11 @@ export const SettingsClaudeProviderPage: React.FC = () => {
// replace it; true = empty editable input ready for a fresh secret.
const [editingKey, setEditingKey] = useState(false);
const [baseUrl, setBaseUrl] = useState('');
+ // Snapshot the last loaded/saved auth-mode + base_url so we can hide
+ // the Save button when nothing has changed (page feedback: no-op
+ // Save buttons are noise).
+ const [savedAuthMode, setSavedAuthMode] = useState<ClaudeAuthMode>('oauth');
+ const [savedBaseUrl, setSavedBaseUrl] = useState('');
useEffect(() => {
let cancelled = false;
@@ -140,8 +145,13 @@ export const SettingsClaudeProviderPage: React.FC = () => {
// even when settings.json carries the actual key, so reading
// ``auth_mode`` alone would land the user on the wrong tab. Fall
// back to V2Config only when nothing on disk is configured.
- setAuthMode(data.active_auth_mode !== 'none' ? data.active_auth_mode : data.auth_mode);
- setBaseUrl(data.base_url || '');
+ const initialMode =
+ data.active_auth_mode !== 'none' ? data.active_auth_mode : data.auth_mode;
+ const initialBase = data.base_url || '';
+ setAuthMode(initialMode);
+ setBaseUrl(initialBase);
+ setSavedAuthMode(initialMode);
+ setSavedBaseUrl(initialBase);
// The masked preview lives in ``authState.api_key_masked``;
// ``apiKey`` stays empty until the user clicks "Replace".
setApiKey('');
@@ -254,8 +264,13 @@ export const SettingsClaudeProviderPage: React.FC = () => {
return;
}
setAuthState(result);
- setAuthMode(result.auth_mode);
- setBaseUrl(result.base_url || '');
+ const nextMode =
+ result.active_auth_mode !== 'none' ? result.active_auth_mode : result.auth_mode;
+ const nextBase = result.base_url || '';
+ setAuthMode(nextMode);
+ setBaseUrl(nextBase);
+ setSavedAuthMode(nextMode);
+ setSavedBaseUrl(nextBase);
setApiKey('');
setEditingKey(false);
// Claude restart is synthetic (one-shot CLI) so result.restart.ok
@@ -607,7 +622,11 @@ export const SettingsClaudeProviderPage: React.FC = () => {
</>
)}
- {authState?.settings_conflict && (
+ {/* The settings.json conflict warning + Info hint only
+ speak to the API-key flow (where saving collides with
+ a hand-edited ``env`` block, or writes into V2Config).
+ Showing them under OAuth is just clutter. */}
+ {authMode === 'api_key' && authState?.settings_conflict && (
// Claude Code applies its own ``env`` block on top of inherited
// env, so a hand-edited ``settings.json`` will override the
// V2Config-injected key at launch. Warn loudly — silently
@@ -628,25 +647,35 @@ export const SettingsClaudeProviderPage: React.FC = () => {
</div>
)}
- <div className="flex items-start gap-2 rounded-lg border border-border bg-surface-2/60 px-3 py-2.5">
- <Info className="mt-0.5 size-3.5 shrink-0 text-muted" />
- <p className="text-[12px] leading-relaxed text-muted">
- {t('settings.backends.claudeInfoHint')}
- </p>
- </div>
+ {authMode === 'api_key' && (
+ <div className="flex items-start gap-2 rounded-lg border border-border bg-surface-2/60 px-3 py-2.5">
+ <Info className="mt-0.5 size-3.5 shrink-0 text-muted" />
+ <p className="text-[12px] leading-relaxed text-muted">
+ {t('settings.backends.claudeInfoHint')}
+ </p>
+ </div>
+ )}
{/* OAuth mode persists ``auth_mode=oauth`` automatically on
successful sign-in (see ``_invoke_post_web_success_hook``),
so the Save button only needs to surface in API-key mode
- where the user still has to commit the key / Base URL. */}
- {authMode === 'api_key' && (
- <div className="flex justify-end">
- <Button variant="brand" size="default" onClick={onSaveAuth} disabled={authSaving}>
- <Save className="size-3.5" />
- {authSaving ? t('settings.backends.claudeSaving') : t('settings.backends.claudeSave')}
- </Button>
- </div>
- )}
+ where the user still has to commit the key / Base URL —
+ and even there, only when something has actually changed. */}
+ {authMode === 'api_key' && (() => {
+ const dirty =
+ authMode !== savedAuthMode ||
+ apiKey.trim().length > 0 ||
+ baseUrl.trim() !== savedBaseUrl.trim();
+ if (!dirty) return null;
+ return (
+ <div className="flex justify-end">
+ <Button variant="brand" size="default" onClick={onSaveAuth} disabled={authSaving}>
+ <Save className="size-3.5" />
+ {authSaving ? t('settings.backends.claudeSaving') : t('settings.backends.claudeSave')}
+ </Button>
+ </div>
+ );
+ })()}
</CardContent>
</Card>
)}
diff --git a/ui/src/components/settings/SettingsCodexProviderPage.tsx b/ui/src/components/settings/SettingsCodexProviderPage.tsx
index 250577dda..1504ac18e 100644
--- a/ui/src/components/settings/SettingsCodexProviderPage.tsx
+++ b/ui/src/components/settings/SettingsCodexProviderPage.tsx
@@ -68,6 +68,12 @@ export const SettingsCodexProviderPage: React.FC = () => {
// pencil button flips it on; saving or reloading flips it back off.
const [editingKey, setEditingKey] = useState(false);
const [baseUrl, setBaseUrl] = useState('');
+ // ``savedAuthMode`` / ``savedBaseUrl`` snapshot the last successfully
+ // loaded (or saved) values so we can show the Save button only when
+ // the user has actually changed something. Page feedback: a Save
+ // button that never has a no-op state is noisy and confusing.
+ const [savedAuthMode, setSavedAuthMode] = useState<CodexAuthMode>('oauth');
+ const [savedBaseUrl, setSavedBaseUrl] = useState('');
useEffect(() => {
let cancelled = false;
@@ -85,8 +91,13 @@ export const SettingsCodexProviderPage: React.FC = () => {
// config in ``config.toml`` still points at a custom endpoint).
// ``active_auth_mode === "none"`` means we have nothing on disk
// either, so honour V2Config's saved intent in that fallback case.
- setAuthMode(data.active_auth_mode !== 'none' ? data.active_auth_mode : data.auth_mode);
- setBaseUrl(data.base_url || '');
+ const initialMode =
+ data.active_auth_mode !== 'none' ? data.active_auth_mode : data.auth_mode;
+ const initialBase = data.base_url || '';
+ setAuthMode(initialMode);
+ setBaseUrl(initialBase);
+ setSavedAuthMode(initialMode);
+ setSavedBaseUrl(initialBase);
// Empty + read-only input + masked preview rendered separately
// (see below) reflects the saved state without leaking plaintext.
setApiKey('');
@@ -146,8 +157,13 @@ export const SettingsCodexProviderPage: React.FC = () => {
return;
}
setState(result);
- setAuthMode(result.auth_mode);
- setBaseUrl(result.base_url || '');
+ const nextMode =
+ result.active_auth_mode !== 'none' ? result.active_auth_mode : result.auth_mode;
+ const nextBase = result.base_url || '';
+ setAuthMode(nextMode);
+ setBaseUrl(nextBase);
+ setSavedAuthMode(nextMode);
+ setSavedBaseUrl(nextBase);
setApiKey('');
setEditingKey(false);
if (result.restart?.ok === false) {
@@ -356,24 +372,40 @@ export const SettingsCodexProviderPage: React.FC = () => {
</>
)}
- <div className="flex items-start gap-2 rounded-lg border border-border bg-surface-2/60 px-3 py-2.5">
- <Info className="mt-0.5 size-3.5 shrink-0 text-muted" />
- <p className="text-[12px] leading-relaxed text-muted">
- {t('settings.backends.codexInfoHint')}
- </p>
- </div>
-
- {/* OAuth mode persists ``auth_mode=oauth`` automatically on
- successful sign-in, so the Save button only surfaces for
- api_key mode. */}
+ {/* Info hint describes ``~/.codex/{auth.json,config.toml}``
+ writes that only happen on api_key saves. Skip it under
+ OAuth so the panel doesn't carry irrelevant copy. */}
{authMode === 'api_key' && (
- <div className="flex justify-end">
- <Button variant="brand" size="default" onClick={onSave} disabled={saving}>
- <Save className="size-3.5" />
- {saving ? t('settings.backends.codexSaving') : t('settings.backends.codexSave')}
- </Button>
+ <div className="flex items-start gap-2 rounded-lg border border-border bg-surface-2/60 px-3 py-2.5">
+ <Info className="mt-0.5 size-3.5 shrink-0 text-muted" />
+ <p className="text-[12px] leading-relaxed text-muted">
+ {t('settings.backends.codexInfoHint')}
+ </p>
</div>
)}
+
+ {/* OAuth mode persists ``auth_mode=oauth`` automatically on
+ successful sign-in, so the Save button only surfaces for
+ api_key mode — and even then only when something has
+ actually changed (page feedback: a permanent Save button
+ with no dirty signal is noisy). ``dirty`` watches the
+ three things this card mutates against their saved
+ snapshot. */}
+ {authMode === 'api_key' && (() => {
+ const dirty =
+ authMode !== savedAuthMode ||
+ apiKey.trim().length > 0 ||
+ baseUrl.trim() !== savedBaseUrl.trim();
+ if (!dirty) return null;
+ return (
+ <div className="flex justify-end">
+ <Button variant="brand" size="default" onClick={onSave} disabled={saving}>
+ <Save className="size-3.5" />
+ {saving ? t('settings.backends.codexSaving') : t('settings.backends.codexSave')}
+ </Button>
+ </div>
+ );
+ })()}
</CardContent>
</Card>
)}
diff --git a/ui/src/components/settings/SettingsPageShell.tsx b/ui/src/components/settings/SettingsPageShell.tsx
index 3f6c8c56e..b503b1652 100644
--- a/ui/src/components/settings/SettingsPageShell.tsx
+++ b/ui/src/components/settings/SettingsPageShell.tsx
@@ -50,8 +50,6 @@ export const SettingsPageShell: React.FC<SettingsPageShellProps> = ({
return (
<div className="flex flex-col gap-6">
- {breadcrumb && <div className="font-mono text-[11px] text-muted">{breadcrumb}</div>}
-
<div className="flex flex-wrap items-end justify-between gap-4">
<div className="flex flex-col gap-1.5">
<h1 className="text-[28px] font-bold leading-tight tracking-[-0.4px] text-foreground">{title}</h1>
@@ -84,6 +82,13 @@ export const SettingsPageShell: React.FC<SettingsPageShellProps> = ({
</nav>
</div>
+ {/* Breadcrumb lives below the tabs so it reads as sub-navigation
+ *within* the active tab (e.g. "← Back to backends" while on the
+ Backends tab). Placing it above the title/tabs would imply it
+ navigates out of Settings entirely — a hierarchy mismatch
+ flagged in page feedback for /settings/backends/{claude,codex}. */}
+ {breadcrumb && <div className="font-mono text-[11px] text-muted">{breadcrumb}</div>}
+
<div className="flex flex-col gap-4">{children}</div>
</div>
);