From da7c96d08395584d1bdc1e3d27fabc24a5cc2c3d Mon Sep 17 00:00:00 2001 From: Carlos Tello Date: Tue, 27 Oct 2026 09:38:55 -0300 Subject: [PATCH] fix(mobile): optimize mobile UI/UX for UdeCi chatbot and dashboard (v3.8.30) --- CHANGELOG.md | 16 +++ MEMORY.md | 13 +- backend/app/__init__.py | 2 +- backend/setup.py | 2 +- frontend/package.json | 2 +- frontend/public/css/style.css | 124 +++++++++++++++++++- frontend/public/js/ai-chat-widget.js | 41 +++++-- frontend/src/app.js | 6 +- frontend/views/partials/ai_chat_widget.html | 59 +++++++++- 9 files changed, 231 insertions(+), 34 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a7720e4..fa6b41d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,22 @@ El formato está basado en [Keep a Changelog](https://keepachangelog.com/es-ES/1 - **Sincronización Continua Moodle (Fase 6):** Automatización de workers persistentes en background para el procesamiento continuo de la cola de Web Services Moodle 4.1. - **Pruebas de Carga y Hardening (Fase 6):** Pruebas de estrés de concurrencia y validación final de producción. +## [3.8.30] - 2026-10-27 +### Fixed & Enhanced (Optimización de UI/UX Mobile para Chatbot UdeCi y Dashboard) +- **Experiencia de Usuario de UdeCi en Dispositivos Móviles**: + - El panel conversacional se transforma en un modal/hoja de pantalla completa (`100dvh`, `position: fixed; inset: 0`) en pantallas `<= 768px`, eliminando desbordes y superposiciones. + - Ocultamiento automático del botón lanzador (`#aiChatLauncher.chat-open`) mientras el chat está abierto para liberar espacio útil. + - Bloqueo de scroll del fondo (`body.ai-chat-mobile-open`) mientras el chat está activo, restaurándose automáticamente al cerrar o presionar `Escape`. + - Configurado `font-size: 16px` en el área de texto de entrada para anular el molesto auto-zoom de iOS Safari. + - Espaciado seguro para la barra de navegación de móviles con `env(safe-area-inset-bottom)`. + - Auto-minimizado del chat al disparar un paso de asistencia guiada (*Walkthrough*), permitiendo ver el elemento iluminado en pantalla de inmediato. +- **Armonización y Corrección del Dashboard en Móviles**: + - Eliminada la regla global perjudicial que forzaba a `.btn-group` a apilarse verticalmente en columnas con márgenes desmedidos. + - Convertidos los selectores de período y vistas (`#bedeliaPctPeriodSwitcher`, `#adminPctPeriodSwitcher`, `#bedeliaScheduleSwitcher`, `#commFilterPeriodSwitcher`, `#classFilterPeriodSwitcher`) en controles segmentados con desplazamiento horizontal táctil suave (`-webkit-overflow-scrolling: touch;`). + - Rediseñadas las pestañas de estado de comisiones y aulas (`#commStatusPills`, `#classStatusPills`) como tarjetas táctiles de ancho completo con recuentos alineados. + - Proporciones compactas y tipografía responsiva para las tarjetas de KPIs en el Dashboard, reduciendo la altura vertical y facilitando la visualización inmediata. + - Adaptación de leyendas de gráficos circulares para evitar truncamientos y desbordes en pantallas estrechas. + ## [3.8.29] - 2026-10-27 ### Fixed & Enhanced (Personalización por Usuario, Nombres Reales de UI, Roles Exclusivos y Spotlight Dinámico) - **Personalización y Saludo con Nombre Real del Usuario**: diff --git a/MEMORY.md b/MEMORY.md index 76d684c..a18b3f7 100644 --- a/MEMORY.md +++ b/MEMORY.md @@ -9,13 +9,12 @@ Memoria del proyecto entre sesiones para la rama `dev`. - Libro de Calificaciones (*Gradebook*) con actas de regularidad inmutables. - Autenticación híbrida (Google OAuth 2.0, Moodle SSO, Local) y Modo Impersonación. - Reinicialización segura del sistema con contraseña de Administrador. -- **Sprint Activo: Personalización por Usuario, Nombres Fidedignos de UI, Roles Exclusivos y Spotlight Dinámico — SDD-011 (v3.8.29)**: - - **Identidad y Saludo Personalizado**: Inyección de `data-user-name` desde la sesión de Nunjucks al widget frontend; UdeCi saluda y se dirige al usuario por su nombre real (`user_name`). - - **Diferenciación Estricta de Perfiles (`admin`, `bedelia`, `docente`, `alumno`)**: El rol `admin` ya no colapsa en `bedelia`; cuenta con su propio árbol de navegación ("Gobierno & Sistema", "Usuarios", "Roles RBAC", "Config. Global", "Integración IA"). - - **Sincronización Terminológica con la UI**: Nombres de botones y menús alineados a las vistas reales (`Menú lateral ➔ Espacios & Sedes ➔ Sedes / Edificios`, botón `Nuevo Edificio`, botón `Agregar Aula Física`). - - **Motor de Spotlight & Walkthrough Mejorado (`walkthrough-engine.js`)**: Auto-despliegue de menús colapsados (`revealElementIfHidden`) para enfocar elementos aún cuando se encuentren dentro de submenús plegados de Bootstrap o en modo móvil. - - **Calidad y Seguridad Verificadas**: Suite de backend 100% aprobada (104/104 tests), suite de seguridad `security_audit.bat` superada con estatus PASS. - - **Versión Consolidada**: `v3.8.29`. +- **Sprint Activo: Optimización Integral de UI/UX Mobile para UdeCi y Dashboard — SDD-011 (v3.8.30)**: + - **UdeCi Mobile Modal Full-Screen**: En pantallas `<= 768px`, el chat se despliega como pantalla completa app-like (`100dvh`), ocultando el lanzador flotante para maximizar espacio útil y bloqueando el scroll de fondo (`body.ai-chat-mobile-open`). + - **iOS Safari Touch Ready**: Input fijado a `font-size: 16px` para impedir auto-zoom involuntario; safe area inset padding para el home bar de iPhone; touch targets de 32px+ en opciones interactivas. + - **Soporte Walkthrough Mobile**: Auto-minimizado de UdeCi en móvil al activar un paso guiado para que el usuario visualice el botón o elemento iluminado de forma inmediata. + - **Corrección Estructural del Dashboard Mobile**: Eliminada la regla que forzaba a `.btn-group` a apilarse verticalmente en columnas. Segmented controls con scroll horizontal suave (`-webkit-overflow-scrolling: touch;`), pestañas de comisiones y aulas en tarjetas táctiles verticales de ancho completo y KPIs visualmente balanceados. + - **Versión Consolidada**: `v3.8.30`. ## Decisiones (y por qué) - **Flujo Secuencial de Bedelía (9 Pasos)**: Estandarizar la carga operativa en: 1) Sede -> 2) Aula -> 3) Ciclo Lectivo -> 4) Carrera -> 5) Materia (vinculada a Carrera) -> 6) Comisión (asociada a Materia, Carrera y Ciclo) -> 7) Profesores -> 8) Alumnos -> 9) Reserva de Espacio. Esto asegura consistencia e integridad relacional. diff --git a/backend/app/__init__.py b/backend/app/__init__.py index 953d656..7df196d 100644 --- a/backend/app/__init__.py +++ b/backend/app/__init__.py @@ -7,7 +7,7 @@ from typing import Any from database import db, get_db, engine, SessionLocal, session from config.config import Config -__version__ = "3.8.29" +__version__ = "3.8.30" class DummyContext: def __enter__(self): diff --git a/backend/setup.py b/backend/setup.py index 30e57d4..ce6d6a7 100644 --- a/backend/setup.py +++ b/backend/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages setup( name="edu-space-admin", - version="3.8.29", + version="3.8.30", description="Administrative interface for Edu-Space Classroom Management System (FastAPI ASGI Core)", author="Edu-Space Development Team", author_email="admin@edu-space.com", diff --git a/frontend/package.json b/frontend/package.json index b6e1610..ddec93d 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "frontend", - "version": "3.8.29", + "version": "3.8.30", "description": "", "main": "index.js", "scripts": { diff --git a/frontend/public/css/style.css b/frontend/public/css/style.css index 743e094..62a856f 100644 --- a/frontend/public/css/style.css +++ b/frontend/public/css/style.css @@ -143,18 +143,132 @@ border-color: rgba(30, 77, 140, 0.3) !important; } -/* Mobile Responsiveness */ +/* Mobile Responsiveness & Dashboard Optimization */ @media (max-width: 768px) { .card { - margin-bottom: 1rem; + margin-bottom: 0.85rem; } + /* NO forzar flex-direction: column en .btn-group general para preservar segmented controls */ .btn-group { - flex-direction: column; + flex-direction: row; } - .btn-group .btn { - margin-bottom: 0.5rem; + margin-bottom: 0; + } + + /* Switchers y grupos de botones en cabeceras de tarjeta en móviles: + Permite deslizamiento táctil horizontal fluido sin desbordar ni amontonar */ + .card-header .btn-group, + .btn-group-mobile-scroll { + display: inline-flex !important; + flex-direction: row !important; + flex-wrap: nowrap !important; + overflow-x: auto !important; + -webkit-overflow-scrolling: touch !important; + max-width: 100% !important; + scrollbar-width: none; + -ms-overflow-style: none; + border-radius: 8px !important; + } + .card-header .btn-group::-webkit-scrollbar, + .btn-group-mobile-scroll::-webkit-scrollbar { + display: none; + } + .card-header .btn-group .btn, + .btn-group-mobile-scroll .btn { + white-space: nowrap !important; + flex-shrink: 0 !important; + padding: 0.35rem 0.65rem !important; + font-size: 0.76rem !important; + } + + /* Dashboard Role Hero Banner en móvil */ + .dashboard-role-banner { + padding: 0.85rem 1rem !important; + border-radius: 0.85rem !important; + margin-bottom: 0.85rem !important; + } + .dashboard-role-banner h1 { + font-size: 1.25rem !important; + } + .dashboard-role-banner p { + font-size: 0.8rem !important; + } + + /* KPI Cards en Dashboard: compactas, legibles y proporcionadas */ + .dashboard-stat-card .card-body { + padding: 0.85rem 1rem !important; + } + .dashboard-stat-card h2 { + font-size: 1.6rem !important; + } + .dashboard-stat-card h3 { + font-size: 1.3rem !important; + } + .dashboard-stat-card .fs-3, + .dashboard-stat-card .fs-4 { + font-size: 1.35rem !important; + } + + /* Pestañas de estado (Comisiones y Aulas) en móviles */ + #commStatusPills, + #classStatusPills { + width: 100% !important; + display: flex !important; + flex-direction: column !important; + gap: 6px !important; + } + #commStatusPills .nav-link, + #classStatusPills .nav-link { + width: 100% !important; + text-align: left !important; + display: flex !important; + align-items: center !important; + justify-content: space-between !important; + font-size: 0.8rem !important; + padding: 0.45rem 0.75rem !important; + } + + /* Filtros de selección (ej. Carrera) en móvil */ + #commCareerFilter, + #classFloorFilter { + min-width: 0 !important; + width: 100% !important; + max-width: 100% !important; + } + + /* Leyendas de Gráficos Pie en móvil */ + .chart-legend-mobile, + .card-body .d-flex.justify-content-around.text-center.small.pt-2.border-top { + flex-direction: column !important; + align-items: center !important; + gap: 4px !important; + padding-top: 0.5rem !important; + } + + /* Tablas de la cartelera y comisiones */ + .table-responsive { + border-radius: 0 0 0.5rem 0.5rem; + -webkit-overflow-scrolling: touch; + } + .table td, .table th { + padding: 0.55rem 0.75rem !important; + font-size: 0.8rem !important; + } + .table thead th { + white-space: nowrap !important; + } + + /* Separadores verticales que se colapsan a horizontales */ + .col-md-5.border-start { + border-left: none !important; + border-top: 1px solid rgba(0, 0, 0, 0.08) !important; + padding-top: 1rem !important; + margin-top: 0.5rem !important; + } + [data-bs-theme="dark"] .col-md-5.border-start { + border-top-color: rgba(255, 255, 255, 0.08) !important; } } diff --git a/frontend/public/js/ai-chat-widget.js b/frontend/public/js/ai-chat-widget.js index 0f78be2..b7bbdfb 100644 --- a/frontend/public/js/ai-chat-widget.js +++ b/frontend/public/js/ai-chat-widget.js @@ -204,6 +204,8 @@ if (panel && launcher) { panel.classList.add('d-none'); launcher.style.transform = ''; + launcher.classList.remove('chat-open'); + document.body.classList.remove('ai-chat-mobile-open'); } setTimeout(() => { window.WalkthroughEngine.startStep(data.guide_step); @@ -236,28 +238,45 @@ const role = getUserRole(); const name = getUserName(); + function openChat() { + panel.classList.remove('d-none'); + launcher.style.transform = 'scale(0.9)'; + launcher.classList.add('chat-open'); + if (window.innerWidth <= 768) { + document.body.classList.add('ai-chat-mobile-open'); + } + setTimeout(() => { + if (textarea) textarea.focus(); + }, 100); + } + + function closeChat() { + panel.classList.add('d-none'); + launcher.style.transform = ''; + launcher.classList.remove('chat-open'); + document.body.classList.remove('ai-chat-mobile-open'); + } + // Toggle panel launcher.addEventListener('click', () => { const isHidden = panel.classList.contains('d-none'); if (isHidden) { - panel.classList.remove('d-none'); - launcher.style.transform = 'scale(0.9)'; - setTimeout(() => { - if (textarea) textarea.focus(); - }, 100); + openChat(); } else { - panel.classList.add('d-none'); - launcher.style.transform = ''; + closeChat(); } }); if (closeBtn) { - closeBtn.addEventListener('click', () => { - panel.classList.add('d-none'); - launcher.style.transform = ''; - }); + closeBtn.addEventListener('click', closeChat); } + document.addEventListener('keydown', (e) => { + if (e.key === 'Escape' && panel && !panel.classList.contains('d-none')) { + closeChat(); + } + }); + // Reiniciar conversación del usuario actual if (clearBtn) { clearBtn.addEventListener('click', () => { diff --git a/frontend/src/app.js b/frontend/src/app.js index d72a5de..6f56170 100644 --- a/frontend/src/app.js +++ b/frontend/src/app.js @@ -86,9 +86,9 @@ const env = nunjucks.configure(path.join(__dirname, '../views'), { }); // Versiones institucionales del sistema -const APP_VERSION = '3.8.29'; -const FRONTEND_VERSION = '3.8.29'; -const BACKEND_VERSION = '3.8.29'; +const APP_VERSION = '3.8.30'; +const FRONTEND_VERSION = '3.8.30'; +const BACKEND_VERSION = '3.8.30'; env.addGlobal('app_version', APP_VERSION); env.addGlobal('frontend_version', FRONTEND_VERSION); diff --git a/frontend/views/partials/ai_chat_widget.html b/frontend/views/partials/ai_chat_widget.html index 89f3726..505a52a 100644 --- a/frontend/views/partials/ai_chat_widget.html +++ b/frontend/views/partials/ai_chat_widget.html @@ -42,8 +42,8 @@ - @@ -333,15 +333,64 @@ justify-content: center; } -@media (max-width: 576px) { +@media (max-width: 768px) { .ai-chat-container { bottom: 16px; right: 16px; + z-index: 1070; + } + .ai-chat-launcher { + width: 52px; + height: 52px; + } + .ai-chat-launcher.chat-open { + display: none !important; } .ai-chat-panel { - width: calc(100vw - 32px); - height: calc(100vh - 110px); + position: fixed !important; + top: 0 !important; + left: 0 !important; + right: 0 !important; + bottom: 0 !important; + width: 100vw !important; + max-width: 100vw !important; + height: 100dvh !important; + max-height: 100dvh !important; + border-radius: 0 !important; + z-index: 1080 !important; + box-shadow: none !important; + border: none !important; } + .ai-chat-header { + border-radius: 0 !important; + padding: 0.75rem 1rem !important; + } + .ai-chat-messages { + padding: 0.85rem !important; + -webkit-overflow-scrolling: touch; + } + .ai-msg { + max-width: 90% !important; + font-size: 0.88rem !important; + } + .ai-option-btn { + font-size: 0.78rem !important; + padding: 6px 12px !important; + min-height: 32px; + } + .ai-chat-footer { + padding: 0.65rem 0.85rem !important; + padding-bottom: max(0.65rem, env(safe-area-inset-bottom, 0px)) !important; + } + .ai-chat-textarea { + font-size: 16px !important; /* Previene el auto-zoom involuntario en Safari iOS */ + padding: 8px 12px !important; + } +} + +body.ai-chat-mobile-open { + overflow: hidden !important; + touch-action: none; }