Add Codex auth preservation setting

This commit is contained in:
Jason
2026-05-30 14:13:58 +08:00
parent 8f83fa2063
commit 2683af57cb
12 changed files with 171 additions and 3 deletions
@@ -0,0 +1,35 @@
import { useTranslation } from "react-i18next";
import { KeyRound } from "lucide-react";
import type { SettingsFormState } from "@/hooks/useSettings";
import { ToggleRow } from "@/components/ui/toggle-row";
interface CodexAuthSettingsProps {
settings: SettingsFormState;
onChange: (updates: Partial<SettingsFormState>) => void;
}
export function CodexAuthSettings({
settings,
onChange,
}: CodexAuthSettingsProps) {
const { t } = useTranslation();
return (
<section className="space-y-4">
<div className="flex items-center gap-2 pb-2 border-b border-border/40">
<KeyRound className="h-4 w-4 text-primary" />
<h3 className="text-sm font-medium">{t("settings.codexAuth")}</h3>
</div>
<ToggleRow
icon={<KeyRound className="h-4 w-4 text-emerald-500" />}
title={t("settings.preserveCodexOfficialAuthOnSwitch")}
description={t("settings.preserveCodexOfficialAuthOnSwitchDescription")}
checked={settings.preserveCodexOfficialAuthOnSwitch ?? true}
onCheckedChange={(value) =>
onChange({ preserveCodexOfficialAuthOnSwitch: value })
}
/>
</section>
);
}