From 207252aceeff801013857df105929405897127c5 Mon Sep 17 00:00:00 2001 From: m5r Date: Sat, 29 Aug 2026 12:40:01 +0200 Subject: [PATCH] admin: enable toggles become rac switches the upstream, blocklist source, and safe search enable controls mutate the row the moment they move, so they now carry the switch role via a shared drawn rac switch with a 44px hit area, a focus-visible ring, and naming modes made exclusive by a discriminated union. safe search supersedes its one-commit-old checkbox form, and the file-authority guard now names the switch role instead of relying on the bare input selector. --- .../configuration/ProtectionGroups.tsx | 6 +- .../configuration/ProtectionPage.test.tsx | 36 +++++- .../configuration/ProtectionSources.tsx | 9 +- .../features/configuration/UpstreamsTab.tsx | 9 +- .../features/configuration/authority.test.tsx | 2 +- admin/src/ui/Switch.test.tsx | 91 +++++++++++++ admin/src/ui/Switch.tsx | 121 ++++++++++++++++++ 7 files changed, 254 insertions(+), 20 deletions(-) create mode 100644 admin/src/ui/Switch.test.tsx create mode 100644 admin/src/ui/Switch.tsx diff --git a/admin/src/features/configuration/ProtectionGroups.tsx b/admin/src/features/configuration/ProtectionGroups.tsx index 1a41433..32c1f4e 100644 --- a/admin/src/features/configuration/ProtectionGroups.tsx +++ b/admin/src/features/configuration/ProtectionGroups.tsx @@ -18,10 +18,10 @@ import { rulesQuery, } from "@/lib/queries"; import type { Blocklist, ConfigStatus, Group, Rule, RuleAction, RuleKind } from "@/lib/types"; -import Checkbox from "@/ui/Checkbox"; import ConfirmDialog from "@/ui/ConfirmDialog"; import DefinitionList from "@/ui/DefinitionList"; import Select from "@/ui/Select"; +import Switch from "@/ui/Switch"; import { styles as shared } from "@/ui/styles"; import { colors } from "@/ui/tokens.stylex"; import AuthorityGate from "./AuthorityGate"; @@ -349,7 +349,7 @@ function GroupDetailEditable({ group }: { group: Group }) { )}
- @@ -357,7 +357,7 @@ function GroupDetailEditable({ group }: { group: Group }) { } > Safe search - + {!renaming && (