feat(xai): add Grok account management UI with four-locale strings

Add XaiOAuthSection (device-code login, account list, default selection)
backed by the generalized useManagedAuth hook, wire it into the Auth
Center and both Claude provider forms, and expose model fetching for
signed-in accounts.

- Accounts requiring re-auth stay visible in the account selector as
  disabled items with an expired badge instead of silently vanishing.
- Auth status refetches periodically so a revoked refresh token surfaces
  without reloading the panel.
- All strings ship in zh/en/ja/zh-TW; a locale coverage test pins every
  required key in all four locales.
This commit is contained in:
Jason
2026-07-19 00:20:17 +08:00
parent 615c99c62b
commit e9317f476e
16 changed files with 936 additions and 68 deletions
@@ -4,6 +4,8 @@ import { Badge } from "@/components/ui/badge";
import { CodexIcon } from "@/components/BrandIcons";
import { CopilotAuthSection } from "@/components/providers/forms/CopilotAuthSection";
import { CodexOAuthSection } from "@/components/providers/forms/CodexOAuthSection";
import { XaiOAuthSection } from "@/components/providers/forms/XaiOAuthSection";
import { ProviderIcon } from "@/components/ProviderIcon";
export function AuthCenterPanel() {
const { t } = useTranslation();
@@ -69,6 +71,24 @@ export function AuthCenterPanel() {
<CodexOAuthSection />
</section>
<section className="rounded-xl border border-border/60 bg-card/60 p-6">
<div className="mb-4 flex items-center gap-3">
<div className="flex h-10 w-10 items-center justify-center rounded-xl bg-muted">
<ProviderIcon icon="xai" name="xAI" size={20} />
</div>
<div>
<h4 className="font-medium">xAI (Grok OAuth)</h4>
<p className="text-sm text-muted-foreground">
{t("settings.authCenter.xaiOauthDescription", {
defaultValue: "管理 xAI / Grok 账号",
})}
</p>
</div>
</div>
<XaiOAuthSection />
</section>
</div>
);
}