- 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>
34 lines
1.4 KiB
TypeScript
34 lines
1.4 KiB
TypeScript
import type { StudentPaymentReport } from '@gruperly/shared'
|
|
import { CheckCircle2, XCircle } from 'lucide-react'
|
|
import { formatPrice } from '../../lib/format'
|
|
|
|
const RECENT_MS = 7 * 24 * 60 * 60 * 1000
|
|
|
|
/* In-app notice of the teacher's review: the latest report reviewed in the
|
|
last week (the student is also emailed if they confirmed a recovery email). */
|
|
export function PaymentReviewBanner({ reports }: { reports: StudentPaymentReport[] }) {
|
|
const latest = reports.find(
|
|
(report) => report.status !== 'reported' && report.reviewedAt && Date.now() - Date.parse(report.reviewedAt) < RECENT_MS,
|
|
)
|
|
if (!latest) return null
|
|
const amount = formatPrice(latest.totalAmount, latest.currency)
|
|
|
|
if (latest.status === 'confirmed') {
|
|
return (
|
|
<p role="status" className="flex gap-3 rounded-2xl bg-success-soft px-4 py-3 text-sm text-primary">
|
|
<CheckCircle2 className="size-5 shrink-0 text-success" aria-hidden="true" />
|
|
<span>Tu profe confirmó tu pago de {amount}.</span>
|
|
</p>
|
|
)
|
|
}
|
|
return (
|
|
<p role="status" className="flex gap-3 rounded-2xl bg-danger-soft px-4 py-3 text-sm text-primary">
|
|
<XCircle className="size-5 shrink-0 text-danger-fg" aria-hidden="true" />
|
|
<span>
|
|
Tu profe no pudo confirmar tu pago de {amount}.
|
|
{latest.rejectionReason ? ` Motivo: ${latest.rejectionReason}.` : ''} Podés volver a informarlo.
|
|
</span>
|
|
</p>
|
|
)
|
|
}
|