Skip to content

Commit 00624a9

Browse files
authored
Merge pull request #5 from ZeroKnowledgeNetwork/4-feat-display-app-info-in-footer
feat: display app info in footer
2 parents e1a29e3 + d4e0640 commit 00624a9

File tree

2 files changed

+30
-7
lines changed

2 files changed

+30
-7
lines changed

src-tauri/tauri.conf.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"$schema": "https://schema.tauri.app/config/2",
33
"productName": "ZKNetwork",
4-
"version": "0.1.0",
54
"identifier": "com.zkn-client.app",
65
"build": {
76
"beforeDevCommand": "npm run dev",

src/App.tsx

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { useEffect, useState } from "react";
2+
import * as app from "@tauri-apps/api/app";
23
import * as log from "@tauri-apps/plugin-log";
34
import * as path from "@tauri-apps/api/path";
45
import { arch, platform } from "@tauri-apps/plugin-os";
@@ -42,6 +43,7 @@ function App() {
4243
const [networkId, setNetworkId] = useState("");
4344
const [dlProgress, setDlProgress] = useState(0);
4445
const [clientPid, setClientPid] = useState(0);
46+
const [appVersion, setAppVersion] = useState("");
4547
const [platformArch, setPlatformArch] = useState("");
4648
const [platformSupported, setPlatformSupported] = useState(false);
4749
const [networks, setNetworks] = useState<string[]>([]);
@@ -50,11 +52,14 @@ function App() {
5052
// run once on startup (twice in dev mode)
5153
useEffect(() => {
5254
try {
53-
log.info(`Platform: ${platform()}-${arch()}`);
54-
setPlatformArch(getPlatformArch());
55-
setPlatformSupported(true);
56-
5755
(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);
5863
setNetworks(await getNetworks());
5964
})();
6065
} catch (error: any) {
@@ -206,8 +211,8 @@ function App() {
206211
return child.pid;
207212
}
208213

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">
211216
<h1 className="text-3xl font-extrabold">Zero Knowledge Network</h1>
212217

213218
<img
@@ -268,6 +273,25 @@ function App() {
268273
)}
269274
</main>
270275
);
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+
);
271295
}
272296

273297
export default App;

0 commit comments

Comments
 (0)