import { useMemo } from 'react' import QRCode from 'react-qr-code' import { Card, Button, Badge, ErrorState } from '../ui' import { t } from '@/lib/i18n' export function PaymentHeader({ amount, timeRemaining, }: { amount: number timeRemaining: number | null }): React.ReactElement { const timeLabel = useMemo((): string | null => { if (timeRemaining === null) { return null } if (timeRemaining <= 0) { return t('payment.expired') } const minutes = Math.floor(timeRemaining / 60) const secs = timeRemaining % 60 return `${minutes}:${secs.toString().padStart(2, '0')}` }, [timeRemaining]) const isUrgent = timeRemaining !== null && timeRemaining <= 60 return (

{t('payment.modal.zapAmount', { amount })}

{timeLabel && (
{timeLabel} {t('payment.modal.timeRemaining', { time: timeLabel })}
)}
) } export function InvoiceDisplay({ invoiceText, paymentUrl }: { invoiceText: string; paymentUrl: string }): React.ReactElement { return (

{t('payment.modal.lightningInvoice')}

{invoiceText}

{t('payment.modal.scanQr')}

) } export function PaymentInstructions({ hasAlby }: { hasAlby: boolean }): React.ReactElement { if (hasAlby) { return (

{t('payment.modal.instructions.title')}

  1. {t('payment.modal.instructions.step1')}
  2. {t('payment.modal.instructions.step2')}
  3. {t('payment.modal.instructions.step3')}
) } return (

{t('payment.modal.instructions.titleNoAlby')}

  1. {t('payment.modal.instructions.step1NoAlby')}
  2. {t('payment.modal.instructions.step2NoAlby')}
  3. {t('payment.modal.instructions.step3NoAlby')}
) } export function PaymentActionsWithAlby({ copied, onCopy, onOpenWallet, }: { copied: boolean onCopy: () => Promise onOpenWallet: () => void }): React.ReactElement { return (
) } export function PaymentActionsWithoutAlby({ copied, onCopy, }: { copied: boolean onCopy: () => Promise }): React.ReactElement { return (
) } export function PaymentActions({ copied, onCopy, onOpenWallet, hasAlby, }: { copied: boolean onCopy: () => Promise onOpenWallet: () => void hasAlby: boolean }): React.ReactElement { if (hasAlby) { return } return } export function ExpiredNotice({ show }: { show: boolean }): React.ReactElement | null { if (!show) { return null } return (

{t('payment.modal.invoiceExpired')}

{t('payment.modal.invoiceExpiredHelp')}

) } export function PaymentError({ errorMessage, onRetry, }: { errorMessage: string | null onRetry?: () => void }): React.ReactElement | null { if (!errorMessage) { return null } const errorObj = new Error(errorMessage) return (
) }