feat(settings): add enableLocalProxy toggle to gate main page proxy UI

New users often accidentally trigger ProxyToggle/FailoverToggle on the
main page. Add a settings toggle (default off) so the proxy controls
only appear when explicitly enabled. The proxy service start/stop in
settings remains independent of this visibility flag.
This commit is contained in:
Jason
2026-02-19 23:06:22 +08:00
parent 1b71dc721c
commit 0fa6b33b5e
9 changed files with 46 additions and 20 deletions
+16 -2
View File
@@ -55,6 +55,7 @@ import { useImportExport } from "@/hooks/useImportExport";
import { useTranslation } from "react-i18next";
import type { SettingsFormState } from "@/hooks/useSettings";
import { Switch } from "@/components/ui/switch";
import { ToggleRow } from "@/components/ui/toggle-row";
import { Badge } from "@/components/ui/badge";
import { useProxyStatus } from "@/hooks/useProxyStatus";
@@ -356,8 +357,21 @@ export function SettingsPage({
/>
</div>
</AccordionPrimitive.Header>
<AccordionContent className="px-6 pb-6 pt-0 border-t border-border/50">
<ProxyPanel />
<AccordionContent className="px-6 pb-6 pt-4 border-t border-border/50">
<ToggleRow
icon={<Zap className="h-4 w-4 text-green-500" />}
title={t("settings.advanced.proxy.enableFeature")}
description={t(
"settings.advanced.proxy.enableFeatureDescription",
)}
checked={settings?.enableLocalProxy ?? false}
onCheckedChange={(checked) =>
handleAutoSave({ enableLocalProxy: checked })
}
/>
<div className="mt-4">
<ProxyPanel />
</div>
</AccordionContent>
</AccordionItem>