Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion public/user-config/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@
{
"type": "token"
}
]
],
"ui": {
"hideSidebar": true
}
}
3 changes: 2 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@
const config = useConfig();
const astarte = useAstarte();
const { triggerDeliveryPoliciesSupported } = useAstarte();
const isSidebarHidden = config.ui.hideSidebar;

if (!astarte.isAuthenticated) {
if (!astarte.isAuthenticated || isSidebarHidden) {
return null;
}

Expand Down Expand Up @@ -139,7 +140,7 @@
config: DashboardConfig | null;
}

export default ({ config }: Props): React.ReactElement => (

Check warning on line 143 in src/App.tsx

View workflow job for this annotation

GitHub Actions / Node 22 on ubuntu-latest

Assign arrow function to a variable before exporting as module default

Check warning on line 143 in src/App.tsx

View workflow job for this annotation

GitHub Actions / Run code quality and funcionality tests

Assign arrow function to a variable before exporting as module default

Check warning on line 143 in src/App.tsx

View workflow job for this annotation

GitHub Actions / Run code quality and funcionality tests

Assign arrow function to a variable before exporting as module default
<AlertsProvider>
<RouterProvider>
{config ? (
Expand Down
6 changes: 6 additions & 0 deletions src/ConfigManager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ type ConfigContextValue = {
features: {
flow: boolean;
};
ui: {
hideSidebar: boolean;
};
};

const ConfigContext = createContext<ConfigContextValue | null>(null);
Expand Down Expand Up @@ -77,6 +80,9 @@ const ConfigProvider = ({
features: {
flow: !!config.enableFlowPreview,
},
ui: {
hideSidebar: !!config.ui?.hideSidebar,
},
};

config.auth.forEach((authOption) => {
Expand Down
1 change: 1 addition & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
3 changes: 3 additions & 0 deletions src/types/dashboardConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ type DashboardConfig = {
pairingApiUrl?: string;
flowApiUrl?: string;
enableFlowPreview: boolean;
ui: {
hideSidebar: boolean;
};
} & DashboardAuthConfig;

export type { DashboardConfig };
Loading