Files
gruperly/apps/web/src/lib/immersive-routes.ts
Jose Selesan b99bc4d519 feat: rediseño de Grupos y pantalla "Requiere atención"
- Grupos: subtítulo con resumen (grupos · alumnos · lugares libres),
  sección "Requiere atención" con los 4 alumnos más urgentes y tarjetas
  con avatares (punteados por lugar libre en grupos chicos, superpuestos
  con "+N" en grandes; con alerta primero y anillo de gravedad).
- Pantalla nueva /groups/attention: filtros Todos/Asistencia/Pagos,
  secciones Urgente y A vigilar, Contactar / Enviar recordatorio por
  wa.me y "Resuelto" persistente con update optimista.
- FAB "Nuevo grupo" que se pliega al scrollear (respeta reduced motion);
  los toasts en mobile suben para no quedar debajo.
- Alertas centralizadas en computeStudentAlerts (shared). La regla de
  asistencia pasa a: urgente = 3 seguidas o 4 de las últimas 6; a vigilar
  = 2 de las últimas 4 (sin inactividad por días ni tendencia). Cuotas:
  1 vencida vigilar, 2+ urgente.
- Backend: GET /attention y POST /attention/:attendeeId/resolve; tabla
  attendee_alert_resolutions (la alerta vuelve si cambia la firma).
- Tokens de gravedad para claro y oscuro; se quita el indicador de pills.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 16:35:07 -03:00

37 lines
1.4 KiB
TypeScript

/* "Immersive" routes: the ones that build their own navigation bar with
`LargeTitle` (a large title that collapses) and therefore don't show the
global header with logo + theme toggle + avatar.
The pattern is resolved by hand and not with `matchRoute` because the two
routes carry params (`matchRoute` requires them) and because child routes are
NOT immersive even when they share a prefix: `/groups/:id/attendees/new`
still uses the global header. */
const IMMERSIVE_SEGMENTS: ReadonlyArray<readonly string[]> = [
['groups', 'attention'],
['groups', ':id'],
['groups', ':id', 'analytics'],
['groups', ':id', 'attendees', ':attendeeId'],
['class', ':id', 'attendance'],
]
/* Static routes that sit where a param would go. Without this list
`/groups/new` (create group) would be taken for a group detail page and would
lose the global header, and `/groups/attention/...` for a group's children.
(`/groups/attention` itself is immersive through its own pattern.) */
const STATIC_SEGMENTS: ReadonlySet<string> = new Set(['new', 'attention'])
export function isImmersiveRoute(pathname: string) {
const segments = pathname.split('/').filter(Boolean)
return IMMERSIVE_SEGMENTS.some(
(pattern) =>
pattern.length === segments.length &&
pattern.every((part, index) => {
const segment = segments[index]
if (part.startsWith(':')) return !STATIC_SEGMENTS.has(segment)
return part === segment
}),
)
}