import { lazy, useEffect, useState } from 'react'; import { Trans } from '@lingui/react/macro'; import { ConstructionIcon, FileTextIcon } from 'lucide-react'; import { useCurrentEnvelopeEditor } from '@documenso/lib/client-only/providers/envelope-editor-provider'; import { useCurrentEnvelopeRender } from '@documenso/lib/client-only/providers/envelope-render-provider'; import { AnimateGenericFadeInOut } from '@documenso/ui/components/animate/animate-generic-fade-in-out'; import PDFViewerKonvaLazy from '@documenso/ui/components/pdf-viewer/pdf-viewer-konva-lazy'; import { Alert, AlertDescription, AlertTitle } from '@documenso/ui/primitives/alert'; import { RecipientSelector } from '@documenso/ui/primitives/recipient-selector'; import { Separator } from '@documenso/ui/primitives/separator'; import { EnvelopeRendererFileSelector } from './envelope-file-selector'; const EnvelopeGenericPageRenderer = lazy(async () => import('./envelope-generic-page-renderer')); export const EnvelopeEditorPreviewPage = () => { const { envelope, editorFields } = useCurrentEnvelopeEditor(); const { currentEnvelopeItem } = useCurrentEnvelopeRender(); const [selectedPreviewMode, setSelectedPreviewMode] = useState<'recipient' | 'signed'>( 'recipient', ); /** * Set the selected recipient to the first recipient in the envelope. */ useEffect(() => { editorFields.setSelectedRecipient(envelope.recipients[0]?.id ?? null); }, []); return (
{/* Horizontal envelope item selector */} {/* Document View */}
Preview Mode Preview what the signed document will look like with placeholder data {/* Coming soon section */}

Coming soon

This feature is coming soon

{/* Todo: Envelopes - Remove div after preview mode is implemented */}
{currentEnvelopeItem !== null ? ( ) : (

No documents found

Please upload a document to continue

)}
{/* Right Section - Form Fields Panel */} {currentEnvelopeItem && false && (
{/* Add fields section. */}
{/*

Preivew Mode

*/} Preview Mode Preview what the signed document will look like with placeholder data {/* setSelectedPreviewMode(value as 'recipient' | 'signed')} >
Preview what a recipient will see
Preview the signed document
*/}
{false && ( {selectedPreviewMode === 'recipient' && ( <> {/* Recipient selector section. */}

Selected Recipient

editorFields.setSelectedRecipient(recipient.id) } recipients={envelope.recipients} className="w-full" align="end" />
)}
)}
)}
); };