Files
CC-Switch/src/components/settings/AuthCenterPanel.tsx
T

95 lines
3.5 KiB
TypeScript

import { Github, ShieldCheck } from "lucide-react";
import { useTranslation } from "react-i18next";
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();
return (
<div className="space-y-6">
<section className="rounded-xl border border-border/60 bg-card/60 p-6">
<div className="flex items-start justify-between gap-4">
<div className="space-y-2">
<div className="flex items-center gap-2">
<ShieldCheck className="h-5 w-5 text-primary" />
<h3 className="text-base font-semibold">
{t("settings.authCenter.title", {
defaultValue: "OAuth 认证中心",
})}
</h3>
</div>
<p className="text-sm text-muted-foreground">
{t("settings.authCenter.description", {
defaultValue:
"在 Claude Code 中使用您的其他订阅,请注意合规风险。",
})}
</p>
</div>
<Badge variant="secondary">
{t("settings.authCenter.beta", { defaultValue: "Beta" })}
</Badge>
</div>
</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">
<Github className="h-5 w-5" />
</div>
<div>
<h4 className="font-medium">GitHub Copilot</h4>
<p className="text-sm text-muted-foreground">
{t("settings.authCenter.copilotDescription", {
defaultValue: "管理 GitHub Copilot 账号",
})}
</p>
</div>
</div>
<CopilotAuthSection />
</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">
<CodexIcon size={20} />
</div>
<div>
<h4 className="font-medium">ChatGPT (Codex OAuth)</h4>
<p className="text-sm text-muted-foreground">
{t("settings.authCenter.codexOauthDescription", {
defaultValue: "管理 ChatGPT 账号",
})}
</p>
</div>
</div>
<CodexOAuthSection showAccountQuota />
</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>
);
}