fix: use standard toggle component for permission controls

Replace the button ("Enabled"/"Disabled") for "Can create new agents" and
the custom oversized switch for "Can assign tasks" with the same toggle
style (h-5 w-9, bg-green-600/bg-muted) used throughout Run Policy.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
dotta 2026-03-20 06:27:52 -05:00
parent dfdd3784b9
commit 3de7d63ea9

View file

@ -1434,10 +1434,14 @@ function ConfigurationTab({
Lets this agent create or hire agents and implicitly assign tasks. Lets this agent create or hire agents and implicitly assign tasks.
</p> </p>
</div> </div>
<Button <button
variant={canCreateAgents ? "default" : "outline"} type="button"
size="sm" role="switch"
className="h-7 px-2.5 text-xs" aria-checked={canCreateAgents}
className={cn(
"relative inline-flex h-5 w-9 items-center rounded-full transition-colors shrink-0 disabled:cursor-not-allowed disabled:opacity-50",
canCreateAgents ? "bg-green-600" : "bg-muted",
)}
onClick={() => onClick={() =>
updatePermissions.mutate({ updatePermissions.mutate({
canCreateAgents: !canCreateAgents, canCreateAgents: !canCreateAgents,
@ -1446,8 +1450,13 @@ function ConfigurationTab({
} }
disabled={updatePermissions.isPending} disabled={updatePermissions.isPending}
> >
{canCreateAgents ? "Enabled" : "Disabled"} <span
</Button> className={cn(
"inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",
canCreateAgents ? "translate-x-4.5" : "translate-x-0.5",
)}
/>
</button>
</div> </div>
<div className="flex items-center justify-between gap-4 text-sm"> <div className="flex items-center justify-between gap-4 text-sm">
<div className="space-y-1"> <div className="space-y-1">
@ -1461,10 +1470,8 @@ function ConfigurationTab({
role="switch" role="switch"
aria-checked={canAssignTasks} aria-checked={canAssignTasks}
className={cn( className={cn(
"relative inline-flex h-6 w-11 shrink-0 rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", "relative inline-flex h-5 w-9 items-center rounded-full transition-colors shrink-0 disabled:cursor-not-allowed disabled:opacity-50",
canAssignTasks canAssignTasks ? "bg-green-600" : "bg-muted",
? "bg-green-500 focus-visible:ring-green-500/70"
: "bg-input/50 focus-visible:ring-ring",
)} )}
onClick={() => onClick={() =>
updatePermissions.mutate({ updatePermissions.mutate({
@ -1476,8 +1483,8 @@ function ConfigurationTab({
> >
<span <span
className={cn( className={cn(
"inline-block h-4 w-4 transform rounded-full bg-background transition-transform", "inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",
canAssignTasks ? "translate-x-6" : "translate-x-1", canAssignTasks ? "translate-x-4.5" : "translate-x-0.5",
)} )}
/> />
</button> </button>