11import { clsx } from 'clsx' ;
22import { forwardRef , useState } from 'react' ;
3- import { Shield , ShieldAlert , ShieldCheck , AlertCircle , CheckCircle2 } from '@phosphor-icons/react' ;
4- import { Card , CardContent , CardHeader , CardTitle , Badge , Button , Slider , Switch } from '@spaceui/primitives' ;
3+ import { Shield , ShieldCheck , WarningCircle , XCircle , CheckCircle } from '@phosphor-icons/react' ;
4+ import { Card , CardContent , CardHeader , CardTitle , Badge , Button , Slider } from '@spaceui/primitives' ;
55
66interface AutonomyLevel {
77 level : 'manual' | 'assisted' | 'semi' | 'full' ;
@@ -27,13 +27,13 @@ const autonomyLevels: AutonomyLevel[] = [
2727 level : 'semi' ,
2828 label : 'Semi-Autonomous' ,
2929 description : 'Execute safe actions, ask for permission on destructive ones' ,
30- icon : ShieldAlert ,
30+ icon : WarningCircle ,
3131 } ,
3232 {
3333 level : 'full' ,
3434 label : 'Full Autonomy' ,
3535 description : 'Execute all actions independently' ,
36- icon : AlertCircle ,
36+ icon : WarningCircle ,
3737 } ,
3838] ;
3939
@@ -58,9 +58,10 @@ const AutonomyPanel = forwardRef<HTMLDivElement, AutonomyPanelProps>(
5858 const currentLevelIndex = autonomyLevels . findIndex ( ( l ) => l . level === currentLevel ) ;
5959 const [ selectedLevel , setSelectedLevel ] = useState ( currentLevelIndex ) ;
6060
61- const handleLevelChange = ( value : number ) => {
62- setSelectedLevel ( value ) ;
63- onLevelChange ?.( autonomyLevels [ value ] . level ) ;
61+ const handleLevelChange = ( value : number [ ] ) => {
62+ const nextLevel = value [ 0 ] ?? 0 ;
63+ setSelectedLevel ( nextLevel ) ;
64+ onLevelChange ?.( autonomyLevels [ nextLevel ] . level ) ;
6465 } ;
6566
6667 return (
@@ -71,8 +72,8 @@ const AutonomyPanel = forwardRef<HTMLDivElement, AutonomyPanelProps>(
7172 </ CardHeader >
7273 < CardContent className = "space-y-4" >
7374 < Slider
74- value = { selectedLevel }
75- onChange = { handleLevelChange }
75+ value = { [ selectedLevel ] }
76+ onValueChange = { handleLevelChange }
7677 min = { 0 }
7778 max = { 3 }
7879 step = { 1 }
@@ -147,7 +148,7 @@ const AutonomyPanel = forwardRef<HTMLDivElement, AutonomyPanelProps>(
147148 className = "size-7 text-status-error hover:text-status-error"
148149 onClick = { ( ) => onDeny ( request . id ) }
149150 >
150- < AlertCircle className = "size-4" />
151+ < XCircle className = "size-4" />
151152 </ Button >
152153 ) }
153154 { onApprove && (
@@ -157,7 +158,7 @@ const AutonomyPanel = forwardRef<HTMLDivElement, AutonomyPanelProps>(
157158 className = "size-7 text-status-success hover:text-status-success"
158159 onClick = { ( ) => onApprove ( request . id ) }
159160 >
160- < CheckCircle2 className = "size-4" />
161+ < CheckCircle className = "size-4" />
161162 </ Button >
162163 ) }
163164 </ div >
0 commit comments