feat: app de alumnos sin contraseña (invitación de un solo uso, avisos de falta y pagos informados)
- Acceso del alumno o tutor con link de un solo uso (hash SHA-256, consumo atómico, el GET no consume), sesión propia de 90 días deslizante, passkeys opcionales (SimpleWebAuthn) y mail de recuperación con rate limit. - Lado alumno (/i/:token, /acceso, /alumno/*): inicio, clases, avisar falta, pagos, informar pago con comprobante (S3 privado, magic bytes) y perfil. - Lado profe: acceso a la app en la ficha del alumno (invitar/reinvitar), "Pagos para verificar" en Cobros con badge, faltas avisadas en la ficha de grupo y datos para transferir en Ajustes. - "Requiere atención" y el recordatorio de WhatsApp excluyen cuotas informadas. - Zona horaria por defecto: Buenos Aires. - Migración add_student_access, tests contra Postgres real (test:db) y docs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
51
apps/web/src/features/student-app/StudentLayout.tsx
Normal file
51
apps/web/src/features/student-app/StudentLayout.tsx
Normal file
@@ -0,0 +1,51 @@
|
||||
import { Outlet, useLocation } from '@tanstack/react-router'
|
||||
import { Loader2, UserX } from 'lucide-react'
|
||||
import { Logo } from '../../components/brand'
|
||||
import { cn } from '../../lib/utils'
|
||||
import { StudentBottomNav } from './StudentBottomNav'
|
||||
import { StudentPicker } from './StudentPicker'
|
||||
import { STUDENT_FLOW_PATHS } from './student-nav-items'
|
||||
import { useStudentApp } from './StudentAppProvider'
|
||||
|
||||
/* Shell of the student app: same mobile-first column (`max-w-md`) as the
|
||||
teacher's, with its own nav. It never mounts the teacher's header, sidebar or
|
||||
guards. */
|
||||
export function StudentLayout() {
|
||||
const { me, mePending, student } = useStudentApp()
|
||||
const location = useLocation()
|
||||
const isFlow = STUDENT_FLOW_PATHS.some((path) => location.pathname.startsWith(path))
|
||||
|
||||
return (
|
||||
<div className="min-h-dvh bg-background text-primary">
|
||||
<header className="sticky top-0 z-40 border-b border-border bg-background/90 backdrop-blur">
|
||||
<div className="mx-auto flex h-16 max-w-md items-center justify-between px-4">
|
||||
<Logo className="h-7 w-auto" />
|
||||
<StudentPicker />
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<main
|
||||
className={cn(
|
||||
'mx-auto w-full max-w-md px-4 pt-5',
|
||||
isFlow ? 'pb-[calc(7rem+env(safe-area-inset-bottom))]' : 'pb-[calc(6rem+env(safe-area-inset-bottom))]',
|
||||
)}
|
||||
>
|
||||
{mePending || !me ? (
|
||||
<div className="flex justify-center py-20" role="status" aria-label="Cargando">
|
||||
<Loader2 className="size-8 animate-spin text-accent" aria-hidden="true" />
|
||||
</div>
|
||||
) : !student && !location.pathname.startsWith('/alumno/perfil') ? (
|
||||
<div className="mt-10 space-y-3 rounded-2xl border border-border bg-surface p-6 text-center">
|
||||
<UserX className="mx-auto size-8 text-foreground" aria-hidden="true" />
|
||||
<h1 className="text-lg font-bold text-primary">No tenés grupos activos</h1>
|
||||
<p className="text-sm text-secondary">Si creés que es un error, hablá con tu profe.</p>
|
||||
</div>
|
||||
) : (
|
||||
<Outlet />
|
||||
)}
|
||||
</main>
|
||||
|
||||
{isFlow ? null : <StudentBottomNav />}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user