@@ -7,11 +7,10 @@ import {
77 StyleSheet ,
88 RefreshControl ,
99 ActivityIndicator ,
10- Switch ,
1110} from 'react-native'
1211import { useSafeAreaInsets } from 'react-native-safe-area-context'
1312import { useNavigation } from '@react-navigation/native'
14- import { useQuery , useMutation , useQueryClient } from '@tanstack/react-query'
13+ import { useQuery } from '@tanstack/react-query'
1514import { api , WorkspaceInfo , HOST_WORKSPACE_NAME } from '../lib/api'
1615import { useNetwork , parseNetworkError } from '../lib/network'
1716
@@ -48,8 +47,6 @@ function WorkspaceRow({
4847}
4948
5049function HostSection ( { onHostPress } : { onHostPress : ( ) => void } ) {
51- const queryClient = useQueryClient ( )
52-
5350 const { data : hostInfo , isLoading } = useQuery ( {
5451 queryKey : [ 'hostInfo' ] ,
5552 queryFn : api . getHostInfo ,
@@ -60,13 +57,6 @@ function HostSection({ onHostPress }: { onHostPress: () => void }) {
6057 queryFn : api . getInfo ,
6158 } )
6259
63- const toggleMutation = useMutation ( {
64- mutationFn : ( enabled : boolean ) => api . updateHostAccess ( enabled ) ,
65- onSuccess : ( ) => {
66- queryClient . invalidateQueries ( { queryKey : [ 'hostInfo' ] } )
67- } ,
68- } )
69-
7060 if ( isLoading ) {
7161 return (
7262 < View style = { styles . hostSection } >
@@ -78,19 +68,11 @@ function HostSection({ onHostPress }: { onHostPress: () => void }) {
7868 return (
7969 < View style = { styles . hostSection } >
8070 < View style = { styles . hostHeader } >
81- < View >
82- < Text style = { styles . hostLabel } > Host Machine</ Text >
83- < Text style = { styles . hostName } > { info ?. hostname || hostInfo ?. hostname || 'Unknown' } </ Text >
84- </ View >
85- < Switch
86- value = { hostInfo ?. enabled || false }
87- onValueChange = { ( value ) => toggleMutation . mutate ( value ) }
88- trackColor = { { false : '#3a3a3c' , true : '#f59e0b' } }
89- thumbColor = "#fff"
90- />
71+ < Text style = { styles . hostLabel } > Host Machine</ Text >
72+ < Text style = { styles . hostName } > { info ?. hostname || hostInfo ?. hostname || 'Unknown' } </ Text >
9173 </ View >
9274
93- { hostInfo ?. enabled && (
75+ { hostInfo ?. enabled ? (
9476 < >
9577 < TouchableOpacity style = { styles . hostRow } onPress = { onHostPress } >
9678 < StatusDot status = "host" />
@@ -103,17 +85,17 @@ function HostSection({ onHostPress }: { onHostPress: () => void }) {
10385 < Text style = { styles . rowChevron } > ›</ Text >
10486 </ TouchableOpacity >
10587 < Text style = { styles . hostWarning } >
106- ⚠️ Commands run directly on your machine without isolation
88+ Commands run directly on your machine without isolation
10789 </ Text >
10890 </ >
109- ) }
110-
111- { ! hostInfo ?. enabled && info && (
112- < View style = { styles . hostStats } >
113- < Text style = { styles . hostStat } > { info . workspacesCount } workspaces </ Text >
114- < Text style = { styles . hostStatDivider } > • </ Text >
115- < Text style = { styles . hostStat } > Docker { info . dockerVersion } </ Text >
116- </ View >
91+ ) : (
92+ info && (
93+ < View style = { styles . hostStats } >
94+ < Text style = { styles . hostStat } > { info . workspacesCount } workspaces </ Text >
95+ < Text style = { styles . hostStatDivider } > • </ Text >
96+ < Text style = { styles . hostStat } > Docker { info . dockerVersion } </ Text >
97+ </ View >
98+ )
11799 ) }
118100 </ View >
119101 )
@@ -240,11 +222,7 @@ const styles = StyleSheet.create({
240222 borderBottomWidth : 1 ,
241223 borderBottomColor : '#1c1c1e' ,
242224 } ,
243- hostHeader : {
244- flexDirection : 'row' ,
245- justifyContent : 'space-between' ,
246- alignItems : 'center' ,
247- } ,
225+ hostHeader : { } ,
248226 hostLabel : {
249227 fontSize : 12 ,
250228 color : '#636366' ,
0 commit comments