From ae366cec724d2793b8ae4c65ea0baa8674607e4b Mon Sep 17 00:00:00 2001 From: Emina Muminovic Date: Thu, 26 Feb 2026 12:59:04 +0100 Subject: [PATCH] Add possibility to change DashboardSidebar display Use an environment variable `VITE_SHOW_DASHBOARD_SIDEBAR` to set DashboardSidebar's display. If the env var is not set, by default, the sidebar is shown. Signed-off-by: Emina Muminovic --- Dockerfile | 3 +++ src/App.tsx | 6 ++++-- src/vite.env.d.ts | 8 ++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index f759cb12..bbb0fe21 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,8 @@ FROM node:20.3.1 as builder +ARG vite_show_dashboard_sidebar=true +ENV VITE_SHOW_DASHBOARD_SIDEBAR=${vite_show_dashboard_sidebar} + WORKDIR /app ADD . . RUN apt-get -qq update diff --git a/src/App.tsx b/src/App.tsx index 76792127..1d7ec0c4 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,7 +1,7 @@ /* This file is part of Astarte. - Copyright 2020-2021 Ispirata Srl + Copyright 2020-2026 SECO Mind Srl Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -109,7 +109,9 @@ const Dashboard = () => { - + {(import.meta.env.VITE_SHOW_DASHBOARD_SIDEBAR?.toLowerCase() || 'true') === 'true' && ( + + )} diff --git a/src/vite.env.d.ts b/src/vite.env.d.ts index 11f02fe2..efa39c91 100644 --- a/src/vite.env.d.ts +++ b/src/vite.env.d.ts @@ -1 +1,9 @@ /// + +interface ImportMetaEnv { + readonly VITE_SHOW_DASHBOARD_SIDEBAR: string; +} + +interface ImportMeta { + readonly env: ImportMetaEnv; +}