mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-24 12:44:18 +08:00
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:
@@ -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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user