Skip to content

Commit

Permalink
Display app version in settings page
Browse files Browse the repository at this point in the history
  • Loading branch information
evadecker committed Sep 7, 2024
1 parent ab65749 commit 76892ec
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/routes/settings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { api } from "../../../convex/_generated/api";
import {
Button,
Container,
Link,
Modal,
PageHeader,
Switch,
Expand All @@ -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
Expand Down Expand Up @@ -132,6 +134,12 @@ function SettingsRoute() {
</Modal>
</div>
)}
<a
href={`https://github.com/namesakefyi/namesake/releases/tag/v${APP_VERSION}`}
target="_blank"
rel="noreferrer"
className="inline-block mt-4"
>{`Namesake v${APP_VERSION}`}</a>
</Container>
);
}
2 changes: 2 additions & 0 deletions src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
/// <reference types="vite/client" />

declare const APP_VERSION: string;
3 changes: 3 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()],
Expand Down

0 comments on commit 76892ec

Please sign in to comment.