Skip to content

Commit ae366ce

Browse files
committed
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 <emina.muminovic@secomind.com>
1 parent 84aa3e5 commit ae366ce

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
FROM node:20.3.1 as builder
22

3+
ARG vite_show_dashboard_sidebar=true
4+
ENV VITE_SHOW_DASHBOARD_SIDEBAR=${vite_show_dashboard_sidebar}
5+
36
WORKDIR /app
47
ADD . .
58
RUN apt-get -qq update

src/App.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
This file is part of Astarte.
33
4-
Copyright 2020-2021 Ispirata Srl
4+
Copyright 2020-2026 SECO Mind Srl
55
66
Licensed under the Apache License, Version 2.0 (the "License");
77
you may not use this file except in compliance with the License.
@@ -109,7 +109,9 @@ const Dashboard = () => {
109109
<ReduxProvider store={reduxStore}>
110110
<Container fluid className="px-0">
111111
<Row className="g-0">
112-
<DashboardSidebar />
112+
{(import.meta.env.VITE_SHOW_DASHBOARD_SIDEBAR?.toLowerCase() || 'true') === 'true' && (
113+
<DashboardSidebar />
114+
)}
113115
<Col className="main-content bg-light vh-100 overflow-auto d-flex flex-column">
114116
<PageRouter />
115117
</Col>

src/vite.env.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,9 @@
11
/// <reference types="vite/client" />
2+
3+
interface ImportMetaEnv {
4+
readonly VITE_SHOW_DASHBOARD_SIDEBAR: string;
5+
}
6+
7+
interface ImportMeta {
8+
readonly env: ImportMetaEnv;
9+
}

0 commit comments

Comments
 (0)