import React, { useEffect } from "react"; import { RiFileList3Line } from "react-icons/ri"; import confetti from 'canvas-confetti' import handleDownloadDocument from "../../helper/handleDownloadDocumentRecSide"; import { useParams } from "react-router-dom"; interface CompletionScreenProps { hit?: string; title?: string; message?: string; textColorSuccess?: boolean; } const CompletionScreen: React.FC = ({ hit = "All Done! ", title = "Thanks for signing", message = "Your document is now complete and securely stored. We’ve emailed you a copy for your reference.", textColorSuccess = true }) => { const { recipientId } = useParams(); useEffect(() => { const duration = 3000; const end = Date.now() + duration; const interval = setInterval(() => { if (Date.now() > end) { clearInterval(interval); return; } confetti({ particleCount: 5, // fewer particles per burst for smoothness angle: 90, // falling straight down spread: 30, // slight spread startVelocity: 8, // gentle falling speed origin: { x: Math.random(), // random horizontal position across the top y: 0, }, scalar: 1, zIndex: 9999, }); }, 50); // fire every 50ms for continuous effect return () => clearInterval(interval); }, []); return (
{/* Header */}
{/* Sign made easy */}
{/* Main content */}

{hit}{title}

{message}

{ handleDownloadDocument(recipientId || "") }} className="text-white bg-[var(--mainPrimaryBtn)] px-3 py-2 rounded-sm mt-4 cursor-pointer"> Download Signed Documents

{/* */} {/* */}

Access your documents anytime — just Login

{/* Illustration placeholder */}
{textColorSuccess ? Document completed : Document completed}
{/* Apps Section */} {/*
*/}

Boost Efficiency with Our Apps

{/* Forms Made Easy */}

Generate Forms with Ease

Forms Made Easy
{/* Docs Made Easy */}

Generate Documents (Invoices, Reports, Quotes)

Docs Made Easy
{/* Footer */}
); } export default CompletionScreen;