1
1
import { useEffect , useState } from "react" ;
2
+ import * as app from "@tauri-apps/api/app" ;
2
3
import * as log from "@tauri-apps/plugin-log" ;
3
4
import * as path from "@tauri-apps/api/path" ;
4
5
import { arch , platform } from "@tauri-apps/plugin-os" ;
@@ -42,6 +43,7 @@ function App() {
42
43
const [ networkId , setNetworkId ] = useState ( "" ) ;
43
44
const [ dlProgress , setDlProgress ] = useState ( 0 ) ;
44
45
const [ clientPid , setClientPid ] = useState ( 0 ) ;
46
+ const [ appVersion , setAppVersion ] = useState ( "" ) ;
45
47
const [ platformArch , setPlatformArch ] = useState ( "" ) ;
46
48
const [ platformSupported , setPlatformSupported ] = useState ( false ) ;
47
49
const [ networks , setNetworks ] = useState < string [ ] > ( [ ] ) ;
@@ -50,11 +52,14 @@ function App() {
50
52
// run once on startup (twice in dev mode)
51
53
useEffect ( ( ) => {
52
54
try {
53
- log . info ( `Platform: ${ platform ( ) } -${ arch ( ) } ` ) ;
54
- setPlatformArch ( getPlatformArch ( ) ) ;
55
- setPlatformSupported ( true ) ;
56
-
57
55
( async ( ) => {
56
+ const name = await app . getName ( ) ;
57
+ const v = "v" + ( await app . getVersion ( ) ) ;
58
+ log . info ( `Starting ${ name } ${ v } on ${ platform ( ) } -${ arch ( ) } ` ) ;
59
+
60
+ setAppVersion ( v ) ;
61
+ setPlatformArch ( getPlatformArch ( ) ) ;
62
+ setPlatformSupported ( true ) ;
58
63
setNetworks ( await getNetworks ( ) ) ;
59
64
} ) ( ) ;
60
65
} catch ( error : any ) {
@@ -206,8 +211,8 @@ function App() {
206
211
return child . pid ;
207
212
}
208
213
209
- return (
210
- < main className = "flex flex-col items-center justify-center min-h-screen gap-5" >
214
+ const Main = ( ) => (
215
+ < main className = "flex flex-col flex-grow items-center justify-center gap-5" >
211
216
< h1 className = "text-3xl font-extrabold" > Zero Knowledge Network</ h1 >
212
217
213
218
< img
@@ -268,6 +273,25 @@ function App() {
268
273
) }
269
274
</ main >
270
275
) ;
276
+
277
+ const Footer = ( ) => (
278
+ < footer className = "footer footer-center bg-base-200 text-base-content/30 p-4" >
279
+ < div className = "flex flex-row" >
280
+ < span > ZKNetwork Client</ span >
281
+ < span className = "mx-2" > |</ span >
282
+ < span > Version: { appVersion } </ span >
283
+ < span className = "mx-2" > |</ span >
284
+ < span > Platform: { platformArch } </ span >
285
+ </ div >
286
+ </ footer >
287
+ ) ;
288
+
289
+ return (
290
+ < div className = "flex flex-col min-h-screen" >
291
+ < Main />
292
+ < Footer />
293
+ </ div >
294
+ ) ;
271
295
}
272
296
273
297
export default App ;
0 commit comments