Display application version in sidebar and settings (#720)
This commit is contained in:
6 files changed
+50
-11
No files matched your search
@@ -1,3 +1,4 @@
|
||||
export const APP_BASE_NAME = "T3 Code";
|
||||
export const APP_STAGE_LABEL = import.meta.env.DEV ? "Dev" : "Alpha";
|
||||
export const APP_DISPLAY_NAME = `${APP_BASE_NAME} (${APP_STAGE_LABEL})`;
|
||||
export const APP_VERSION = import.meta.env.APP_VERSION || "0.0.0";
|
||||
@@ -39,7 +39,7 @@ import { useMutation, useQueries, useQuery, useQueryClient } from "@tanstack/rea
|
||||
import { useLocation, useNavigate, useParams } from "@tanstack/react-router";
|
||||
import { useAppSettings } from "../appSettings";
|
||||
import { isElectron } from "../env";
|
||||
import { APP_STAGE_LABEL } from "../branding";
|
||||
import { APP_STAGE_LABEL, APP_VERSION } from "../branding";
|
||||
import { isMacPlatform, newCommandId, newProjectId, newThreadId } from "../lib/utils";
|
||||
import { useStore } from "../store";
|
||||
import { isChatNewLocalShortcut, isChatNewShortcut, shortcutLabelForCommand } from "../keybindings";
|
||||
@@ -1238,15 +1238,24 @@ export default function Sidebar() {
|
||||
const wordmark = (
|
||||
<div className="flex items-center gap-2">
|
||||
<SidebarTrigger className="shrink-0 md:hidden" />
|
||||
<div className="flex min-w-0 flex-1 items-center gap-1 mt-1.5 ml-1">
|
||||
<T3Wordmark />
|
||||
<span className="truncate text-sm font-medium tracking-tight text-muted-foreground">
|
||||
Code
|
||||
</span>
|
||||
<span className="rounded-full bg-muted/50 px-1.5 py-0.5 text-[8px] font-medium uppercase tracking-[0.18em] text-muted-foreground/60">
|
||||
{APP_STAGE_LABEL}
|
||||
</span>
|
||||
</div>
|
||||
<Tooltip>
|
||||
<TooltipTrigger
|
||||
render={
|
||||
<div className="flex min-w-0 flex-1 items-center gap-1 mt-1.5 ml-1 cursor-pointer">
|
||||
<T3Wordmark />
|
||||
<span className="truncate text-sm font-medium tracking-tight text-muted-foreground">
|
||||
Code
|
||||
</span>
|
||||
<span className="rounded-full bg-muted/50 px-1.5 py-0.5 text-[8px] font-medium uppercase tracking-[0.18em] text-muted-foreground/60">
|
||||
{APP_STAGE_LABEL}
|
||||
</span>
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
<TooltipPopup side="bottom" sideOffset={2}>
|
||||
Version {APP_VERSION}
|
||||
</TooltipPopup>
|
||||
</Tooltip>
|
||||
</div>
|
||||
);
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import { preferredTerminalEditor } from "../terminal-links";
|
||||
import { Button } from "../components/ui/button";
|
||||
import { Input } from "../components/ui/input";
|
||||
import { Switch } from "../components/ui/switch";
|
||||
import { APP_VERSION } from "../branding";
|
||||
import { SidebarInset } from "~/components/ui/sidebar";
|
||||
|
||||
const THEME_OPTIONS = [
|
||||
@@ -554,6 +555,24 @@ function SettingsRouteView() {
|
||||
</div>
|
||||
) : null}
|
||||
</section>
|
||||
<section className="rounded-2xl border border-border bg-card p-5">
|
||||
<div className="mb-4">
|
||||
<h2 className="text-sm font-medium text-foreground">About</h2>
|
||||
<p className="mt-1 text-xs text-muted-foreground">
|
||||
Application version and environment information.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center justify-between rounded-lg border border-border bg-background px-3 py-2">
|
||||
<div>
|
||||
<p className="text-sm font-medium text-foreground">Version</p>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
Current version of the application.
|
||||
</p>
|
||||
</div>
|
||||
<code className="text-xs font-medium text-muted-foreground">{APP_VERSION}</code>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Vendored
+8
@@ -2,6 +2,14 @@
|
||||
|
||||
import type { NativeApi, DesktopBridge } from "@t3tools/contracts";
|
||||
|
||||
interface ImportMetaEnv {
|
||||
readonly APP_VERSION: string;
|
||||
}
|
||||
|
||||
interface ImportMeta {
|
||||
readonly env: ImportMetaEnv;
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
nativeApi?: NativeApi;
|
||||
|
||||
@@ -2,6 +2,7 @@ import tailwindcss from "@tailwindcss/vite";
|
||||
import react from "@vitejs/plugin-react";
|
||||
import { tanstackRouter } from "@tanstack/router-plugin/vite";
|
||||
import { defineConfig } from "vite";
|
||||
import { version } from "./package.json" with { type: "json" };
|
||||
|
||||
const port = Number(process.env.PORT ?? 5733);
|
||||
const sourcemapEnv = process.env.T3CODE_WEB_SOURCEMAP?.trim().toLowerCase();
|
||||
@@ -29,6 +30,7 @@ export default defineConfig({
|
||||
define: {
|
||||
// In dev mode, tell the web app where the WebSocket server lives
|
||||
"import.meta.env.VITE_WS_URL": JSON.stringify(process.env.VITE_WS_URL ?? ""),
|
||||
"import.meta.env.APP_VERSION": JSON.stringify(version),
|
||||
},
|
||||
resolve: {
|
||||
tsconfigPaths: true,
|
||||
|
||||
Reference in new issue
Block a user