Skip to content

Commit 519adb3

Browse files
committed
feat: add info page
1 parent 606c40c commit 519adb3

File tree

4 files changed

+58
-7
lines changed

4 files changed

+58
-7
lines changed

src/components/AppSidebar.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Bitcoin, Home, Inbox, Settings } from "lucide-react"
1+
import { Bitcoin, Home, Inbox, Settings, InfoIcon } from "lucide-react"
22
import { NavLink } from "react-router";
33

44
import {
@@ -34,6 +34,11 @@ const items = [
3434
url: "/settings",
3535
icon: Settings,
3636
},
37+
{
38+
title: "Info",
39+
url: "/info",
40+
icon: InfoIcon,
41+
},
3742
]
3843

3944
export function AppSidebar() {

src/main.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import QuotesPage from './pages/quotes/QuotesPage';
99
import SettingsPage from './pages/settings/SettingsPage';
1010
import meta from './constants/meta';
1111
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
12+
import InfoPage from './pages/info/InfoPage';
1213

1314
const queryClient = new QueryClient();
1415

@@ -30,6 +31,7 @@ void prepare().then(() => {
3031
<Route path="balances" element={<BalancesPage />} />
3132
<Route path="quotes" element={<QuotesPage />} />
3233
<Route path="settings" element={<SettingsPage />} />
34+
<Route path="info" element={<InfoPage />} />
3335
</Route>
3436
</Routes>
3537
</BrowserRouter>

src/pages/home/HomePage.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,23 @@ function Loader() {
99
return (
1010
<div className="flex flex-col gap-1.5 py-2">
1111
<Skeleton className="h-12 rounded-lg" />
12-
<Skeleton className="h-12 rounded-lg" />
1312
</div>
1413
)
1514
}
1615

17-
function HomePageBody() {
16+
function PageBody() {
1817
const { data } = useSuspenseQuery({
1918
queryKey: ["info"],
2019
queryFn: fetchInfo,
2120
});
2221

2322
return (
2423
<>
25-
<pre>
26-
{JSON.stringify(data, null, 2)}
27-
</pre>
24+
<div className="flex flex-col gap-0.5 bg-accent text-accent-foreground rounded-lg p-2 my-2">
25+
<span className="font-bold">{data.name}</span>
26+
<span className="text-sm font-mono text-accent-foreground/50">{data.version}</span>
27+
<span className="text-sm font-mono">{data.pubkey}</span>
28+
</div>
2829
</>
2930
)
3031
}
@@ -34,7 +35,7 @@ export default function HomePage() {
3435
<>
3536
<PageTitle>Home</PageTitle>
3637
<Suspense fallback={<Loader />}>
37-
<HomePageBody />
38+
<PageBody />
3839
</Suspense>
3940
</>
4041
)

src/pages/info/InfoPage.tsx

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import { Breadcrumbs } from "@/components/Breadcrumbs";
2+
import { PageTitle } from "@/components/PageTitle";
3+
import { Skeleton } from "@/components/ui/skeleton";
4+
import { fetchInfo } from "@/lib/api";
5+
import { useSuspenseQuery } from "@tanstack/react-query";
6+
import { Suspense } from "react";
7+
8+
9+
function Loader() {
10+
return (
11+
<div className="flex flex-col gap-1.5 py-2">
12+
<Skeleton className="h-48 rounded-lg" />
13+
</div>
14+
)
15+
}
16+
17+
function PageBody() {
18+
const { data } = useSuspenseQuery({
19+
queryKey: ["info"],
20+
queryFn: fetchInfo,
21+
});
22+
23+
return (
24+
<>
25+
<pre className="text-sm bg-accent text-accent-foreground rounded-lg p-2 my-2">
26+
{JSON.stringify(data, null, 2)}
27+
</pre>
28+
</>
29+
)
30+
}
31+
32+
export default function InfoPage() {
33+
return (
34+
<>
35+
<Breadcrumbs>Info</Breadcrumbs>
36+
<PageTitle>Info</PageTitle>
37+
<Suspense fallback={<Loader />}>
38+
<PageBody />
39+
</Suspense>
40+
</>
41+
)
42+
}
43+

0 commit comments

Comments
 (0)