@@ -7,6 +7,7 @@ import { download } from "@tauri-apps/plugin-upload";
7
7
import { fetch } from "@tauri-apps/plugin-http" ;
8
8
import { Child , Command } from "@tauri-apps/plugin-shell" ;
9
9
import { mkdir , exists , readDir , BaseDirectory } from "@tauri-apps/plugin-fs" ;
10
+ import { useStore } from "./store" ;
10
11
import "./App.css" ;
11
12
12
13
const urlNetwork = "https://test.net.zknet.io" ;
@@ -43,11 +44,18 @@ function App() {
43
44
const [ networkId , setNetworkId ] = useState ( "" ) ;
44
45
const [ dlProgress , setDlProgress ] = useState ( 0 ) ;
45
46
const [ clientPid , setClientPid ] = useState ( 0 ) ;
46
- const [ appVersion , setAppVersion ] = useState ( "" ) ;
47
- const [ platformArch , setPlatformArch ] = useState ( "" ) ;
48
- const [ platformSupported , setPlatformSupported ] = useState ( false ) ;
49
- const [ networks , setNetworks ] = useState < string [ ] > ( [ ] ) ;
50
- const [ isConnected , setIsConnected ] = useState ( false ) ;
47
+
48
+ const appVersion = useStore ( ( s ) => s . appVersion ) ;
49
+ const isConnected = useStore ( ( s ) => s . isConnected ) ;
50
+ const isPlatformSupported = useStore ( ( s ) => s . isPlatformSupported ) ;
51
+ const networks = useStore ( ( s ) => s . networks ) ;
52
+ const platformArch = useStore ( ( s ) => s . platformArch ) ;
53
+
54
+ const setAppVersion = useStore ( ( s ) => s . setAppVersion ) ;
55
+ const setIsConnected = useStore ( ( s ) => s . setIsConnected ) ;
56
+ const setIsPlatformSupported = useStore ( ( s ) => s . setIsPlatformSupported ) ;
57
+ const setNetworks = useStore ( ( s ) => s . setNetworks ) ;
58
+ const setPlatformArch = useStore ( ( s ) => s . setPlatformArch ) ;
51
59
52
60
// run once on startup (twice in dev mode)
53
61
useEffect ( ( ) => {
@@ -59,7 +67,7 @@ function App() {
59
67
60
68
setAppVersion ( v ) ;
61
69
setPlatformArch ( getPlatformArch ( ) ) ;
62
- setPlatformSupported ( true ) ;
70
+ setIsPlatformSupported ( true ) ;
63
71
setNetworks ( await getNetworks ( ) ) ;
64
72
} ) ( ) ;
65
73
} catch ( error : any ) {
@@ -235,7 +243,7 @@ function App() {
235
243
className = { `logo ${ isConnected ? "pulsing" : "" } ` }
236
244
/>
237
245
238
- { platformSupported &&
246
+ { isPlatformSupported &&
239
247
( clientPid === 0 ? (
240
248
< >
241
249
< p > Enter a network identifier for access.</ p >
0 commit comments