fix(web-app): update dashboard navigation to use the router directly and refresh admin tabs on login changes

This commit is contained in:
2026-03-20 16:44:44 +00:00
parent aacf30e582
commit b9a3d79b5f
5 changed files with 19 additions and 16 deletions

View File

@@ -72,19 +72,23 @@ export class SgAppShell extends DeesElement {
},
];
private allResolvedViewTabs: Array<{ name: string; iconName?: string; element: any }> = [];
private resolvedViewTabs: Array<{ name: string; iconName?: string; element: any }> = [];
constructor() {
super();
document.title = 'Stack.Gallery Registry';
// Make appRouter globally accessible for view elements
(globalThis as any).__sgAppRouter = appRouter;
const loginSubscription = appstate.loginStatePart
.select((s) => s)
.subscribe((loginState) => {
this.loginState = loginState;
// Re-filter tabs when login state changes
if (loginState.isLoggedIn && this.allResolvedViewTabs.length > 0) {
this.resolvedViewTabs = loginState.identity?.isSystemAdmin
? this.allResolvedViewTabs
: this.allResolvedViewTabs.filter((t) => t.name !== 'Admin');
}
});
this.rxSubscriptions.push(loginSubscription);