From bd6ccfe0f8d69a4164673b4d0e8ca006a6558eda Mon Sep 17 00:00:00 2001 From: Alioune Gaye Date: Thu, 26 Feb 2026 15:14:25 +0100 Subject: [PATCH] feat: Hide Dashboard sidebar using user config Signed-off-by: Alioune Gaye --- public/user-config/config.json | 5 ++++- src/App.tsx | 3 ++- src/ConfigManager.tsx | 6 ++++++ src/index.tsx | 1 + src/types/dashboardConfig.ts | 3 +++ 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/public/user-config/config.json b/public/user-config/config.json index d7986ff2..f20f0fc5 100644 --- a/public/user-config/config.json +++ b/public/user-config/config.json @@ -6,5 +6,8 @@ { "type": "token" } - ] + ], + "ui": { + "hideSidebar": true + } } diff --git a/src/App.tsx b/src/App.tsx index 76792127..b3f34b38 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -35,8 +35,9 @@ const DashboardSidebar = () => { const config = useConfig(); const astarte = useAstarte(); const { triggerDeliveryPoliciesSupported } = useAstarte(); + const isSidebarHidden = config.ui.hideSidebar; - if (!astarte.isAuthenticated) { + if (!astarte.isAuthenticated || isSidebarHidden) { return null; } diff --git a/src/ConfigManager.tsx b/src/ConfigManager.tsx index a198c55c..fd4c1a57 100644 --- a/src/ConfigManager.tsx +++ b/src/ConfigManager.tsx @@ -45,6 +45,9 @@ type ConfigContextValue = { features: { flow: boolean; }; + ui: { + hideSidebar: boolean; + }; }; const ConfigContext = createContext(null); @@ -77,6 +80,9 @@ const ConfigProvider = ({ features: { flow: !!config.enableFlowPreview, }, + ui: { + hideSidebar: !!config.ui?.hideSidebar, + }, }; config.auth.forEach((authOption) => { diff --git a/src/index.tsx b/src/index.tsx index 831c10a6..75914774 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -35,6 +35,7 @@ fetch('/user-config/config.json') auth: json.auth, defaultAuth: json.default_auth, defaultRealm: json.default_realm, + ui: json.ui, })) .catch(() => null) .then((config: DashboardConfig | null) => { diff --git a/src/types/dashboardConfig.ts b/src/types/dashboardConfig.ts index 2718128d..e71d3c72 100644 --- a/src/types/dashboardConfig.ts +++ b/src/types/dashboardConfig.ts @@ -41,6 +41,9 @@ type DashboardConfig = { pairingApiUrl?: string; flowApiUrl?: string; enableFlowPreview: boolean; + ui: { + hideSidebar: boolean; + }; } & DashboardAuthConfig; export type { DashboardConfig };