Align admin, community, search, library, learning and course management with the mockup. Add saved courses, download history, public community feed, instructor directory, backend search, course views, admin content tools and community moderation. Harden API and Nginx for production.
20 lines
1.1 KiB
TypeScript
20 lines
1.1 KiB
TypeScript
/** Which top-level destination a pathname belongs to (highlights the sidebar and tab bar). */
|
|
export type NavKey =
|
|
| 'search' | 'explore' | 'trails' | 'learning' | 'community' | 'professors'
|
|
| 'library' | 'downloads' | 'manage' | 'admin' | 'you' | 'none';
|
|
|
|
export const navKeyFor = (pathname: string): NavKey => {
|
|
if (pathname === '/' || pathname.startsWith('/cursos')) return 'explore';
|
|
if (pathname.startsWith('/buscar')) return 'search';
|
|
if (pathname.startsWith('/trilhas')) return 'trails';
|
|
if (pathname.startsWith('/meu-aprendizado')) return 'learning';
|
|
if (pathname.startsWith('/comunidade')) return 'community';
|
|
if (pathname.startsWith('/professores') || pathname.startsWith('/instrutores') || pathname.startsWith('/perfis')) return 'professors';
|
|
if (pathname.startsWith('/materiais')) return 'library';
|
|
if (pathname.startsWith('/downloads')) return 'downloads';
|
|
if (pathname.startsWith('/gerenciar')) return 'manage';
|
|
if (pathname.startsWith('/admin')) return 'admin';
|
|
if (pathname.startsWith('/voce') || pathname.startsWith('/perfil')) return 'you';
|
|
return 'none';
|
|
};
|