@@ -81,54 +81,17 @@ function WorkspaceRow({ workspace, onClick }: { workspace: WorkspaceInfo; onClic
8181 )
8282}
8383
84- function HostSection ( { hostInfo, onNavigate, onToggle , isToggling } : {
84+ function HostSection ( { hostInfo, onNavigate } : {
8585 hostInfo : HostInfo
8686 onNavigate : ( ) => void
87- onToggle : ( ) => void
88- isToggling : boolean
8987} ) {
90- return (
91- < div className = "space-y-3" >
92- < div className = "flex items-center justify-between " >
88+ if ( ! hostInfo . enabled ) {
89+ return (
90+ < div className = "space-y-3 " >
9391 < h2 className = "text-sm font-medium text-muted-foreground uppercase tracking-wider" >
9492 Host Machine
9593 </ h2 >
96- { hostInfo . enabled && (
97- < span className = "flex items-center gap-1.5 text-xs text-amber-600 dark:text-amber-400" >
98- < AlertTriangle className = "h-3 w-3" />
99- Direct access enabled
100- </ span >
101- ) }
102- </ div >
103-
104- < div className = { cn (
105- "rounded-lg border overflow-hidden transition-colors" ,
106- hostInfo . enabled
107- ? "border-amber-500/50 bg-amber-500/5"
108- : "border-border/50 bg-card/50"
109- ) } >
110- { hostInfo . enabled ? (
111- < button
112- onClick = { onNavigate }
113- className = "w-full flex items-center gap-4 px-4 py-4 hover:bg-accent/50 transition-colors text-left group"
114- >
115- < div className = "h-10 w-10 rounded-lg bg-amber-500/10 flex items-center justify-center" >
116- < Monitor className = "h-5 w-5 text-amber-600 dark:text-amber-400" />
117- </ div >
118- < div className = "flex-1 min-w-0" >
119- < div className = "flex items-center gap-2" >
120- < span className = "font-medium text-foreground" > { hostInfo . hostname } </ span >
121- < span className = "text-[10px] uppercase tracking-wider text-amber-600 dark:text-amber-400 font-medium" >
122- Active
123- </ span >
124- </ div >
125- < p className = "text-sm text-muted-foreground mt-0.5" >
126- { hostInfo . username } @{ hostInfo . hostname } · { hostInfo . homeDir }
127- </ p >
128- </ div >
129- < ChevronRight className = "h-4 w-4 text-muted-foreground/50 group-hover:text-muted-foreground transition-colors" />
130- </ button >
131- ) : (
94+ < div className = "rounded-lg border border-border/50 bg-card/50 overflow-hidden" >
13295 < div className = "px-4 py-4" >
13396 < div className = "flex items-start gap-4" >
13497 < div className = "h-10 w-10 rounded-lg bg-muted/50 flex items-center justify-center flex-shrink-0" >
@@ -137,28 +100,54 @@ function HostSection({ hostInfo, onNavigate, onToggle, isToggling }: {
137100 < div className = "flex-1 min-w-0" >
138101 < div className = "font-medium text-foreground" > Host Access Disabled</ div >
139102 < p className = "text-sm text-muted-foreground mt-0.5" >
140- Enable to run agents and terminals directly on { hostInfo . hostname }
103+ Run with < code className = "px-1.5 py-0.5 rounded bg-muted text-foreground text-xs" > --host-access </ code > to enable direct access to { hostInfo . hostname }
141104 </ p >
142105 </ div >
143106 </ div >
144107 </ div >
145- ) }
146- < div className = { cn (
147- "px-4 py-3 border-t flex items-center justify-between" ,
148- hostInfo . enabled ? "border-amber-500/30 bg-amber-500/5" : "border-border/50 bg-muted/20"
149- ) } >
108+ </ div >
109+ </ div >
110+ )
111+ }
112+
113+ return (
114+ < div className = "space-y-3" >
115+ < div className = "flex items-center justify-between" >
116+ < h2 className = "text-sm font-medium text-muted-foreground uppercase tracking-wider" >
117+ Host Machine
118+ </ h2 >
119+ < span className = "flex items-center gap-1.5 text-xs text-amber-600 dark:text-amber-400" >
120+ < AlertTriangle className = "h-3 w-3" />
121+ Direct access enabled
122+ </ span >
123+ </ div >
124+
125+ < div className = "rounded-lg border border-amber-500/50 bg-amber-500/5 overflow-hidden" >
126+ < button
127+ onClick = { onNavigate }
128+ className = "w-full flex items-center gap-4 px-4 py-4 hover:bg-accent/50 transition-colors text-left group"
129+ >
130+ < div className = "h-10 w-10 rounded-lg bg-amber-500/10 flex items-center justify-center" >
131+ < Monitor className = "h-5 w-5 text-amber-600 dark:text-amber-400" />
132+ </ div >
133+ < div className = "flex-1 min-w-0" >
134+ < div className = "flex items-center gap-2" >
135+ < span className = "font-medium text-foreground" > { hostInfo . hostname } </ span >
136+ < span className = "text-[10px] uppercase tracking-wider text-amber-600 dark:text-amber-400 font-medium" >
137+ Active
138+ </ span >
139+ </ div >
140+ < p className = "text-sm text-muted-foreground mt-0.5" >
141+ { hostInfo . username } @{ hostInfo . hostname } · { hostInfo . homeDir }
142+ </ p >
143+ </ div >
144+ < ChevronRight className = "h-4 w-4 text-muted-foreground/50 group-hover:text-muted-foreground transition-colors" />
145+ </ button >
146+ < div className = "px-4 py-3 border-t border-amber-500/30 bg-amber-500/5" >
150147 < div className = "flex items-center gap-2 text-xs text-muted-foreground" >
151148 < AlertTriangle className = "h-3.5 w-3.5" />
152149 < span > Commands run directly on your machine without isolation</ span >
153150 </ div >
154- < Button
155- variant = { hostInfo . enabled ? "outline" : "default" }
156- size = "sm"
157- onClick = { onToggle }
158- disabled = { isToggling }
159- >
160- { isToggling ? 'Updating...' : hostInfo . enabled ? 'Disable' : 'Enable' }
161- </ Button >
162151 </ div >
163152 </ div >
164153 </ div >
@@ -182,13 +171,6 @@ export function WorkspaceList() {
182171 queryFn : api . getHostInfo ,
183172 } )
184173
185- const hostToggleMutation = useMutation ( {
186- mutationFn : ( enabled : boolean ) => api . updateHostAccess ( enabled ) ,
187- onSuccess : ( ) => {
188- queryClient . invalidateQueries ( { queryKey : [ 'hostInfo' ] } )
189- } ,
190- } )
191-
192174 const createMutation = useMutation ( {
193175 mutationFn : ( data : CreateWorkspaceRequest ) => api . createWorkspace ( data ) ,
194176 onSuccess : ( ) => {
@@ -263,8 +245,6 @@ export function WorkspaceList() {
263245 < HostSection
264246 hostInfo = { hostInfo }
265247 onNavigate = { ( ) => navigate ( `/workspaces/${ encodeURIComponent ( HOST_WORKSPACE_NAME ) } ` ) }
266- onToggle = { ( ) => hostToggleMutation . mutate ( ! hostInfo . enabled ) }
267- isToggling = { hostToggleMutation . isPending }
268248 />
269249 ) }
270250
0 commit comments