'use client'; import { ExclamationTriangleIcon, CheckCircleIcon, } from '@heroicons/react/24/outline'; import type { UserTicket } from '@/lib/api'; import { useLanguage } from '@/context/LanguageContext'; import PayActions from './PayActions'; import { HoldCountdown } from './Countdown'; import { holdExpiry, ticketAmount, pyg, isAwaitingApproval, isOnHold, HOLD_THRESHOLD_HOURS, } from './helpers'; /** * The very-top Overview banner. Shown only when a booking needs attention: * • unpaid -> red banner naming event + amount, a hold-expiry countdown, * and the "Pay now" / "I've paid" actions. * • awaiting -> calm amber "payment received, we will confirm it * shortly" state with no further action. */ export default function AttentionBanner({ ticket, locale, onChange, }: { ticket: UserTicket; locale: string; onChange: () => void; }) { const { t } = useLanguage(); const eventTitle = (locale === 'es' && ticket.event?.titleEs ? ticket.event.titleEs : ticket.event?.title) || (locale === 'es' ? 'tu evento' : 'your event'); const { amount, currency } = ticketAmount(ticket); if (isOnHold(ticket)) { return (
{locale === 'es' ? `Tu lugar para ${eventTitle} fue liberado` : `Your spot for ${eventTitle} was released`}
{locale === 'es' ? `El pago no se confirmó dentro de ${HOLD_THRESHOLD_HOURS} horas.` : `Payment was not confirmed within ${HOLD_THRESHOLD_HOURS} hours.`}
{t('dashboard.payment.received')}
{t('dashboard.payment.confirmForEvent', { amount: pyg(amount, currency), event: eventTitle, })}
{locale === 'es' ? `Debes ${pyg(amount, currency)} para ${eventTitle}` : `You owe ${pyg(amount, currency)} for ${eventTitle}`}
{expiry && (