'use client'; import { useEffect, useState } from 'react'; import Link from 'next/link'; import { Share } from 'lucide-react'; import { useFeatureFlags } from '@documenso/lib/client-only/providers/feature-flag'; import { base64 } from '@documenso/lib/universal/base64'; import { getFile } from '@documenso/lib/universal/upload/get-file'; import { DocumentWithRecipient } from '@documenso/prisma/types/document-with-recipient'; import DocumentDialog from '@documenso/ui/components/document/document-dialog'; import { DocumentDownloadButton } from '@documenso/ui/components/document/document-download-button'; import { SigningCard3D } from '@documenso/ui/components/signing-card'; import { cn } from '@documenso/ui/lib/utils'; import { Button } from '@documenso/ui/primitives/button'; import { useToast } from '@documenso/ui/primitives/use-toast'; import signingCelebration from '~/assets/signing-celebration.png'; import ConfettiScreen from '~/components/(marketing)/confetti-screen'; import { DocumentStatus } from '.prisma/client'; interface SinglePlayerModeSuccessProps { className?: string; document: DocumentWithRecipient; } export const SinglePlayerModeSuccess = ({ className, document }: SinglePlayerModeSuccessProps) => { const { getFlag } = useFeatureFlags(); const isConfettiEnabled = getFlag('marketing_spm_confetti'); const [showDocumentDialog, setShowDocumentDialog] = useState(false); const [isFetchingDocumentFile, setIsFetchingDocumentFile] = useState(false); const [documentFile, setDocumentFile] = useState(null); const { toast } = useToast(); const onShowDocumentClick = async () => { if (isFetchingDocumentFile) { return; } setIsFetchingDocumentFile(true); try { const data = await getFile(document.documentData); setDocumentFile(base64.encode(data)); setShowDocumentDialog(true); } catch { toast({ title: 'Something went wrong.', description: 'We were unable to retrieve the document at this time. Please try again.', variant: 'destructive', duration: 7500, }); } setIsFetchingDocumentFile(false); }; useEffect(() => { window.scrollTo({ top: 0 }); }, []); return (
{isConfettiEnabled && ( )}

You have signed {document.title}

{/* TODO: Hook this up */}

Create a{' '} free account {' '} to access your signed documents at any time

); };