fix: collapse admin panel into single tabbed page

This commit is contained in:
Linus Rath
2026-05-05 18:50:57 +02:00
parent 1b0ca8967e
commit e7264f521c
18 changed files with 1710 additions and 3426 deletions
+41
View File
@@ -0,0 +1,41 @@
import { create } from 'zustand';
import { persist } from 'zustand/middleware';
export const ADMIN_TABS = [
'dashboard',
'settings',
'branding',
'auth',
'policy',
'plugins',
'themes',
'marketplace',
'version',
'telemetry',
'logs',
] as const;
export type AdminTabId = typeof ADMIN_TABS[number];
export function isAdminTab(value: string | null | undefined): value is AdminTabId {
return typeof value === 'string' && (ADMIN_TABS as readonly string[]).includes(value);
}
interface AdminTabState {
activeTab: AdminTabId;
setActiveTab: (tab: AdminTabId) => void;
}
// Tab state lives in client memory + localStorage. Sidebar clicks update
// state (no URL navigation) so React can commit the transition immediately,
// avoiding the dev-mode "Rendering…" hang we saw when each tab was its own
// route or distinguished by ?tab= search param.
export const useAdminTabStore = create<AdminTabState>()(
persist(
(set) => ({
activeTab: 'dashboard',
setActiveTab: (tab) => set({ activeTab: tab }),
}),
{ name: 'admin_active_tab' },
),
);