Skip to content

Commit 87778ae

Browse files
committed
feat: add version display to app sidebar and expose app version globally
- Introduced a new component to show the application version in the sidebar footer. - Updated to define a global constant from the package.json version. - Modified to declare the constant for TypeScript support.
1 parent e7cbaa8 commit 87778ae

File tree

4 files changed

+29
-0
lines changed

4 files changed

+29
-0
lines changed

apps/web/src/components/app-sidebar.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ import { NavProjects } from "@/components/nav-projects";
55
import {
66
Sidebar,
77
SidebarContent,
8+
SidebarFooter,
89
SidebarHeader,
910
useSidebar,
1011
} from "@/components/ui/sidebar";
12+
import { VersionDisplay } from "@/components/version-display";
1113
import { WorkspaceSwitcher } from "@/components/workspace-switcher";
1214
import { shortcuts } from "@/constants/shortcuts";
1315
import { useRegisterShortcuts } from "@/hooks/use-keyboard-shortcuts";
@@ -34,6 +36,9 @@ export function AppSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) {
3436
<NavMain />
3537
<NavProjects />
3638
</SidebarContent>
39+
<SidebarFooter>
40+
<VersionDisplay />
41+
</SidebarFooter>
3742
</Sidebar>
3843
);
3944
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
export function VersionDisplay() {
2+
const version = __APP_VERSION__;
3+
const changelogUrl =
4+
"https://github.com/usekaneo/kaneo/blob/main/CHANGELOG.md";
5+
6+
return (
7+
<div className="flex items-center justify-center px-2 py-1.5">
8+
<a
9+
href={changelogUrl}
10+
target="_blank"
11+
rel="noopener noreferrer"
12+
className="text-xs text-muted-foreground hover:text-foreground transition-colors duration-200"
13+
>
14+
v{version}
15+
</a>
16+
</div>
17+
);
18+
}

apps/web/src/vite-env.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/// <reference types="vite/client" />
22
/// <reference types="vite/types/importMeta.d.ts" />
33

4+
declare const __APP_VERSION__: string;
5+
46
interface ImportMetaEnv {
57
readonly KANEO_API_URL: string;
68
}

apps/web/vite.config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@ import tailwindcss from "@tailwindcss/vite";
33
import { tanstackRouter } from "@tanstack/router-plugin/vite";
44
import react from "@vitejs/plugin-react";
55
import { defineConfig } from "vite";
6+
import packageJson from "../../package.json";
67

78
export default defineConfig({
9+
define: {
10+
__APP_VERSION__: JSON.stringify(packageJson.version),
11+
},
812
base: "/",
913
plugins: [
1014
tanstackRouter({ autoCodeSplitting: true }),

0 commit comments

Comments
 (0)