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 (
Tu profe confirmó tu pago de {amount}.
) } return (Tu profe no pudo confirmar tu pago de {amount}. {latest.rejectionReason ? ` Motivo: ${latest.rejectionReason}.` : ''} Podés volver a informarlo.
) }