import type { StudentPaymentReport } from '@gruperly/shared' import { CheckCircle2, XCircle } from 'lucide-react' import { formatPrice } from '../../lib/format' import { useTranslation } from 'react-i18next' 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 { t } = useTranslation(['student', 'common']) 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 (

) } return (

) }