import React, { useEffect, useState } from 'react'; import { motion } from 'framer-motion'; import { CheckCircle2, XCircle, Loader2, PartyPopper, ArrowLeft } from 'lucide-react'; import confetti from 'canvas-confetti'; interface PaymentResultProps { status: 'success' | 'cancel' | 'loading'; onBack?: () => void; } export const PaymentResult: React.FC = ({ status, onBack }) => { const [showConfetti, setShowConfetti] = useState(false); useEffect(() => { if (status === 'success' && !showConfetti) { setShowConfetti(true); const duration = 3000; const end = Date.now() + duration; const frame = () => { confetti({ particleCount: 3, angle: 60, spread: 55, origin: { x: 0, y: 0.7 }, colors: ['#8B5CF6', '#6366F1', '#EC4899', '#F59E0B'] }); confetti({ particleCount: 3, angle: 120, spread: 55, origin: { x: 1, y: 0.7 }, colors: ['#8B5CF6', '#6366F1', '#EC4899', '#F59E0B'] }); if (Date.now() < end) { requestAnimationFrame(frame); } }; frame(); } }, [status, showConfetti]); if (status === 'loading') { return (

Processing your payment...

); } const isSuccess = status === 'success'; return (
{isSuccess && (
)}
{isSuccess ? ( ) : ( )}

{isSuccess ? 'Welcome to Pro!' : 'Payment Cancelled'}

{isSuccess ? 'Your AI powers are now unlocked. Time to create amazing quizzes!' : 'No worries! You can upgrade anytime when you\'re ready.'}

{isSuccess && (
250 AI generations ready to use
)} {isSuccess ? 'Start Creating' : 'Go Back'}
); };