fix(web-app): update dashboard navigation to use the router directly and refresh admin tabs on login changes
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user