import type { Role } from "@pipeline/shared"; export type NavigationItem = { id: string; label: string; href: string; roles: readonly Role[]; }; export const ROLE_NAVIGATION_ITEMS = [ { id: "dashboard", label: "Dashboard", href: "/", roles: ["ADMIN", "EDITOR"], }, { id: "new-article", label: "New article", href: "/articles/new", roles: ["ADMIN", "EDITOR"], }, { id: "review", label: "Review", href: "/review", roles: ["ADMIN", "EDITOR"], }, { id: "site-config", label: "Site configuration", href: "/admin/sites", roles: ["ADMIN"], }, { id: "script-versions", label: "Script versions", href: "/admin/scripts", roles: ["ADMIN"], }, { id: "agent-jobs", label: "Agent jobs", href: "/admin/jobs", roles: ["ADMIN"], }, ] as const satisfies readonly NavigationItem[]; export function getRoleNavigationItems(role: Role): NavigationItem[] { return ROLE_NAVIGATION_ITEMS.filter((item) => item.roles.some((allowedRole) => allowedRole === role), ); }