From 76892ecba847c498202fa2b0cee8ffa213bd4406 Mon Sep 17 00:00:00 2001 From: Eva Decker Date: Sat, 7 Sep 2024 01:39:51 -0400 Subject: [PATCH] Display app version in settings page --- src/routes/settings/index.tsx | 8 ++++++++ src/vite-env.d.ts | 2 ++ vite.config.ts | 3 +++ 3 files changed, 13 insertions(+) diff --git a/src/routes/settings/index.tsx b/src/routes/settings/index.tsx index f58a3df..1f2fb38 100644 --- a/src/routes/settings/index.tsx +++ b/src/routes/settings/index.tsx @@ -8,6 +8,7 @@ import { api } from "../../../convex/_generated/api"; import { Button, Container, + Link, Modal, PageHeader, Switch, @@ -28,6 +29,7 @@ export const Route = createFileRoute("/settings/")({ function SettingsRoute() { const { signOut } = useAuthActions(); const user = useQuery(api.users.getCurrentUser); + const version = "APP_VERSION"; // Name change field // TODO: Extract all this debounce logic + field as a component for reuse @@ -132,6 +134,12 @@ function SettingsRoute() { )} + {`Namesake v${APP_VERSION}`} ); } diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts index 11f02fe..fe15b4f 100644 --- a/src/vite-env.d.ts +++ b/src/vite-env.d.ts @@ -1 +1,3 @@ /// + +declare const APP_VERSION: string; diff --git a/vite.config.ts b/vite.config.ts index 83477ef..1cb7361 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -8,6 +8,9 @@ import { defineConfig } from "vite"; // https://vitejs.dev/config/ export default defineConfig({ plugins: [TanStackRouterVite(), react()], + define: { + APP_VERSION: JSON.stringify(process.env.npm_package_version), + }, css: { postcss: { plugins: [autoprefixer(), tailwindcss(), cssnano()],