export type LearnerNavItem = { label: string path: string minAnyRoles?: string[] } export const LEARNER_NAV_ITEMS: LearnerNavItem[] = [ { label: 'Dashboard', path: '/learn' }, { label: 'My Courses', path: '/learn/courses' }, { label: 'SCORM', path: '/learn/scorm' }, { label: 'Live Sessions', path: '/learn/live' }, { label: 'Certificates', path: '/learn/certificates' }, { label: 'Community', path: '/learn/community' }, { label: 'Billing', path: '/learn/billing', minAnyRoles: ['learner', 'admin'] }, { label: 'Profile', path: '/learn/profile' }, { label: 'Notifications', path: '/learn/notifications' }, ] export function hasAnyRole(roles: string[], required: string[]): boolean { return required.some(role => roles.includes(role)) } export function hasLearnerPortalAccess(roles: string[]): boolean { return hasAnyRole(roles, ['learner', 'admin', 'instructor']) } export function isLearnerNavItemActive(itemPath: string, currentPath: string): boolean { const item = itemPath.trim() const current = currentPath.trim() if (!item || !current) return false if (item === '/learn') return current === '/learn' return current === item || current.startsWith(`${item}/`) }