feat(core): add layered side rail preferences

This commit is contained in:
2026-08-20 01:47:04 +02:00
parent 51bf14f376
commit cf16a7b27a
13 changed files with 763 additions and 19 deletions
+28 -1
View File
@@ -110,7 +110,14 @@ function navFromMetadata(item: PlatformModuleInfo["nav"][number]): PlatformNavIt
allOf: item.required_all,
anyOf: item.required_any,
order: item.order,
surfaceId: item.surface_id ?? undefined
surfaceId: item.surface_id ?? undefined,
navigationId: item.navigation_id ?? item.surface_id ?? undefined,
navigationVisible: item.navigation_visible,
navigationLocked: item.navigation_locked,
navigationOrderSource: item.navigation_order_source,
navigationVisibilitySource: item.navigation_visibility_source,
navigationLockSource: item.navigation_lock_source,
navigationLayers: item.navigation_layers
};
}
@@ -541,10 +548,30 @@ export function navItemsForModules(
);
return [...shellNavItemsForModules(modules), ...moduleItems].
map(resolveNavItemIcon).
filter((item) => item.navigationVisible !== false).
filter((item) => isViewSurfaceVisible(projection, item.surfaceId, catalogue)).
sort((left, right) => (left.order ?? 100) - (right.order ?? 100));
}
export function configurableNavigationItemsForModules(
modules: PlatformWebModule[]
): PlatformNavItem[] {
return modules
.flatMap((module) =>
(module.navItems ?? []).map((item) => ({
...item,
surfaceId: item.surfaceId ?? navigationViewSurfaceId(module.id, item.to),
navigationId: item.navigationId ?? item.surfaceId ?? navigationViewSurfaceId(module.id, item.to)
}))
)
.map(resolveNavItemIcon)
.sort((left, right) =>
(left.navigationLayers?.module?.order ?? left.order ?? 100)
- (right.navigationLayers?.module?.order ?? right.order ?? 100)
|| left.label.localeCompare(right.label)
);
}
export function visibleNavItems(auth: AuthInfo | null | undefined, modules: PlatformWebModule[] = installedLocalWebModules(), projection?: EffectiveViewProjection | null): PlatformNavItem[] {
return navItemsForModules(modules, projection).filter((item) => {
if (item.allOf?.length && !item.allOf.every((scope) => hasScope(auth, scope))) return false;