Skip to content

Commit d753ea5

Browse files
committed
refactor: extract Footer component
1 parent be7f576 commit d753ea5

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

src/App.tsx

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { download } from "@tauri-apps/plugin-upload";
77
import { fetch } from "@tauri-apps/plugin-http";
88
import { Child, Command } from "@tauri-apps/plugin-shell";
99
import { mkdir, exists, readDir, BaseDirectory } from "@tauri-apps/plugin-fs";
10+
import { Footer } from "./components";
1011
import { useStore } from "./store";
1112
import "./App.css";
1213

@@ -45,7 +46,6 @@ function App() {
4546
const [dlProgress, setDlProgress] = useState(0);
4647
const [clientPid, setClientPid] = useState(0);
4748

48-
const appVersion = useStore((s) => s.appVersion);
4949
const isConnected = useStore((s) => s.isConnected);
5050
const isPlatformSupported = useStore((s) => s.isPlatformSupported);
5151
const networks = useStore((s) => s.networks);
@@ -219,18 +219,6 @@ function App() {
219219
return child.pid;
220220
}
221221

222-
const Footer = () => (
223-
<footer className="footer footer-center bg-base-200 text-base-content/30 p-4">
224-
<div className="flex flex-row">
225-
<span>ZKNetwork Client</span>
226-
<span className="mx-2">|</span>
227-
<span>Version: {appVersion}</span>
228-
<span className="mx-2">|</span>
229-
<span>Platform: {platformArch}</span>
230-
</div>
231-
</footer>
232-
);
233-
234222
return (
235223
<div className="flex flex-col min-h-screen">
236224
<main className="flex flex-col flex-grow items-center justify-center gap-5">

src/components/Footer.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { useStore } from "../store";
2+
3+
export function Footer() {
4+
const appVersion = useStore((s) => s.appVersion);
5+
const platformArch = useStore((s) => s.platformArch);
6+
return (
7+
<footer className="footer footer-center bg-base-200 text-base-content/30 p-4">
8+
<div className="flex flex-row">
9+
<span>ZKNetwork Client</span>
10+
<span className="mx-2">|</span>
11+
<span>Version: {appVersion}</span>
12+
<span className="mx-2">|</span>
13+
<span>Platform: {platformArch}</span>
14+
</div>
15+
</footer>
16+
);
17+
}

src/components/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { Footer } from "./Footer";

0 commit comments

Comments
 (0)