From 632471a9e0bee24aa03a93774a1f3f26de7bf693 Mon Sep 17 00:00:00 2001 From: Mario Sarcevic Date: Wed, 24 Jan 2024 11:48:31 +0100 Subject: [PATCH] feat: Show Explorer client version from package.json in Footer (next to Explorer section label) --- client/src/app/components/footer/Footer.tsx | 3 ++- client/src/app/components/footer/ShimmerFooter.tsx | 3 ++- client/vite-env.d.ts | 1 + client/vite.config.ts | 3 +++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/client/src/app/components/footer/Footer.tsx b/client/src/app/components/footer/Footer.tsx index 8d3117e70..a84695c1c 100644 --- a/client/src/app/components/footer/Footer.tsx +++ b/client/src/app/components/footer/Footer.tsx @@ -179,8 +179,9 @@ class Footer extends AsyncComponent { url: string; }[]; } { + const explorerVersion = EXPLORER_VERSION ?? ""; return { - label: "Explorer", + label: `Explorer${explorerVersion ? ` v${explorerVersion}` : ""}`, items: this.props.dynamic.map((n) => ({ label: n.label, url: `local://${n.url}`, diff --git a/client/src/app/components/footer/ShimmerFooter.tsx b/client/src/app/components/footer/ShimmerFooter.tsx index b5f9b202b..c218ea0f7 100644 --- a/client/src/app/components/footer/ShimmerFooter.tsx +++ b/client/src/app/components/footer/ShimmerFooter.tsx @@ -144,8 +144,9 @@ class ShimmerFooter extends AsyncComponent { url: string; }[]; } { + const explorerVersion = EXPLORER_VERSION ?? ""; return { - label: "Explorer", + label: `Explorer${explorerVersion ? ` v${explorerVersion}` : ""}`, items: this.props.dynamic.map((n) => ({ label: n.label, url: `local://${n.url}`, diff --git a/client/vite-env.d.ts b/client/vite-env.d.ts index 8827bbe8f..88c01eeb3 100644 --- a/client/vite-env.d.ts +++ b/client/vite-env.d.ts @@ -1,3 +1,4 @@ /// /// +declare const EXPLORER_VERSION: string; diff --git a/client/vite.config.ts b/client/vite.config.ts index ab31aace8..6b1c0737b 100644 --- a/client/vite.config.ts +++ b/client/vite.config.ts @@ -23,6 +23,9 @@ export default defineConfig(() => { }), nodePolyfills() ], + define: { + EXPLORER_VERSION: JSON.stringify(process.env.npm_package_version) + }, test: { globals: true, teardownTimeout: 100