Skip to content

Commit 39e1182

Browse files
committed
fix: show current app version in sidebar
1 parent 22d72cc commit 39e1182

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

src/components/Sidebar.jsx

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,27 @@
11
import React from 'react';
22
import { useStore } from '../store';
3+
import { getVersion } from '@tauri-apps/api/app';
34
import { Layout, Globe, Database, Code, FileText, Settings, Radio, FileCode, Server, Boxes } from 'lucide-react';
45

56
const Sidebar = () => {
67
const { activePage, setActivePage, systemStats, t } = useStore();
8+
const [appVersion, setAppVersion] = React.useState('...');
9+
10+
React.useEffect(() => {
11+
let mounted = true;
12+
13+
getVersion()
14+
.then((version) => {
15+
if (mounted) setAppVersion(version);
16+
})
17+
.catch(() => {
18+
if (mounted) setAppVersion('unknown');
19+
});
20+
21+
return () => {
22+
mounted = false;
23+
};
24+
}, []);
725

826
const navItems = [
927
{ id: 'services', label: t('services'), icon: Layout },
@@ -27,7 +45,7 @@ const Sidebar = () => {
2745
<div className="text-xl font-extrabold tracking-tighter text-text">
2846
dev<span className="text-accent">stack</span>
2947
</div>
30-
<div className="text-[10px] text-muted font-mono mt-0.5">v1.0.0</div>
48+
<div className="text-[10px] text-muted font-mono mt-0.5">v{appVersion}</div>
3149
</div>
3250

3351
<nav className="flex flex-col gap-0.5 flex-1 min-h-0 overflow-y-auto overflow-x-hidden pr-1">

0 commit comments

Comments
 (0)