import Link from 'next/link'; import { notFound } from 'next/navigation'; import { CheckCircle2, Clock8, Share } from 'lucide-react'; import { match } from 'ts-pattern'; import { getDocumentAndSenderByToken } from '@documenso/lib/server-only/document/get-document-by-token'; import { getFieldsForToken } from '@documenso/lib/server-only/field/get-fields-for-token'; import { getRecipientByToken } from '@documenso/lib/server-only/recipient/get-recipient-by-token'; import { DocumentStatus, FieldType } from '@documenso/prisma/client'; import { Button } from '@documenso/ui/primitives/button'; import { DownloadButton } from './download-button'; import { SigningCard } from './signing-card'; export type CompletedSigningPageProps = { params: { token?: string; }; }; export default async function CompletedSigningPage({ params: { token }, }: CompletedSigningPageProps) { if (!token) { return notFound(); } const document = await getDocumentAndSenderByToken({ token, }).catch(() => null); if (!document || !document.documentData) { return notFound(); } const { documentData } = document; const [fields, recipient] = await Promise.all([ getFieldsForToken({ token }), getRecipientByToken({ token }).catch(() => null), ]); if (!recipient) { return notFound(); } const recipientName = recipient.name || fields.find((field) => field.type === FieldType.NAME)?.customText || recipient.email; return (
{/* Card with recipient */}
{match(document.status) .with(DocumentStatus.COMPLETED, () => (
Everyone has signed
)) .otherwise(() => (
Waiting for others to sign
))}

You have signed "{document.title}"

{match(document.status) .with(DocumentStatus.COMPLETED, () => (

Everyone has signed! You will receive an Email copy of the signed document.

)) .otherwise(() => (

You will receive an Email copy of the signed document once everyone has signed.

))}
{/* TODO: Hook this up */}

Want so send slick signing links like this one?{' '} Check out Documenso.

); }