Documentation Index
Fetch the complete documentation index at: https://mintlify.com/danielpose1996-stack/ruedadeproyectos/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The Router API provides client-side navigation and theme toggle functionality for RuedaPro UNIPAZ. It handles route-to-view mapping, mobile menu interactions, and dark/light theme persistence.Functions
initThemeToggle()
Initializes the theme toggle button and applies saved or system-preferred theme. Signature:No return value
- Gets the
#theme-togglebutton element - Checks for saved preference in
localStoragekey:ruedapro-theme - Falls back to system preference using
prefers-color-schememedia query - Applies dark theme if saved or system prefers dark:
- Sets
data-theme="dark"on<body> - Changes icon from moon to sun
- Sets
- Attaches click event listener to toggle between themes:
- Toggles
data-themeattribute on<body> - Swaps icon between
fa-moonandfa-sun - Saves preference to
localStorage
- Toggles
ruedapro-theme: Stores'light'or'dark'
initRouter()
Initializes the client-side router by attaching click handlers to navigation links. Signature:No return value
data-route attributes and handles mobile menu toggle functionality.
Behavior:
- Selects all elements with
[data-route]attribute - Gets mobile menu button and desktop nav elements
- Attaches click handler to mobile menu button to toggle
.showclass - For each navigation link:
- Prevents default anchor behavior
- Extracts route from
data-routeattribute - Calls
navigateTo(route) - Closes mobile menu if open
- Updates active state styling
[data-route]- Navigation links.desktop-nav- Main navigation container#mobile-menu-btn- Mobile hamburger menu button.nav-links- Navigation links container
- navigateTo() - Called for each navigation
navigateTo(route, data)
Navigates to a specific route by rendering the corresponding view. Signature:The route identifier to navigate to
Optional data to pass to the view (e.g., project ID for evaluation)
No return value
| Route | View Function | Access |
|---|---|---|
home | renderHomeView() | Public |
galeria | renderGaleriaView() | Public |
results | renderResultsView() | Public |
login-docente | renderLoginView('docente') | Public |
login-estudiante | renderLoginView('estudiante') | Public |
login-admin | renderLoginView('admin') | Public |
dashboard-docente | renderDocenteDashboard() | Docente only |
dashboard-estudiante | renderEstudianteDashboard() | Estudiante only |
dashboard-admin | renderAdminDashboard() + loadAdminUsers() | Admin only |
evaluacion | renderEvaluacionView() + initEvaluacionLogic() | Docente only |
| default | renderHomeView() | Public |
- Gets the
#app-contentcontainer element - Matches route against switch cases
- Checks user permissions for protected routes
- Renders HTML by calling appropriate view function
- Injects HTML into
#app-content - Calls post-render initialization functions if needed
- Scrolls to top of page
- Redirects to home if access denied
- Dashboard routes check
currentProfile.rolmatches required role - Unauthorized users redirected to ‘home’
- No authentication required for public routes
- View Render Functions - Generate HTML for each view
- initRouter() - Sets up route navigation
updateGlobalHeader()
Updates the global header UI based on authentication state. Documented in Authentication API.Route-to-View Mapping
The routing system uses a simple state machine pattern:Public Routes
Public routes are accessible to all users without authentication:- Home, Gallery, Results
- All login portals
Protected Routes
Protected routes require authentication and specific roles:Mobile Menu Behavior
The router handles responsive mobile menu interactions:- Toggle Menu: Click hamburger button to show/hide navigation
- Close on Navigate: Automatically closes menu when route selected
- CSS Classes: Adds/removes
.showclass on.desktop-nav
Navigation State
The router updates active link styling:Integration Example
Performance Considerations
- Views are rendered on-demand, not preloaded
- DOM elements replaced entirely on each navigation
- Scroll position resets to top on every navigation
- No history management (no back button support)
- State preserved in global variables between navigations