- {match(document.status)
- .with(DocumentStatus.COMPLETED, () => (
+ {match({ status: document.status, deletedAt: document.deletedAt })
+ .with({ status: DocumentStatus.COMPLETED }, () => (
Everyone has signed
))
- .otherwise(() => (
+ .with({ deletedAt: null }, () => (
Waiting for others to sign
+ ))
+ .otherwise(() => (
+
+
+ Document no longer available to sign
+
))}
@@ -86,16 +92,22 @@ export default async function CompletedSigningPage({
"{document.title}"
- {match(document.status)
- .with(DocumentStatus.COMPLETED, () => (
+ {match({ status: document.status, deletedAt: document.deletedAt })
+ .with({ status: DocumentStatus.COMPLETED }, () => (
Everyone has signed! You will receive an Email copy of the signed document.
))
- .otherwise(() => (
+ .with({ deletedAt: null }, () => (
You will receive an Email copy of the signed document once everyone has signed.
+ ))
+ .otherwise(() => (
+
+ This document has been cancelled by the owner and is no longer available for others to
+ sign.
+
))}
diff --git a/apps/web/src/app/(signing)/sign/[token]/no-longer-available.tsx b/apps/web/src/app/(signing)/sign/[token]/no-longer-available.tsx
new file mode 100644
index 000000000..8c7051caa
--- /dev/null
+++ b/apps/web/src/app/(signing)/sign/[token]/no-longer-available.tsx
@@ -0,0 +1,66 @@
+import React from 'react';
+
+import Link from 'next/link';
+
+import { Clock8 } from 'lucide-react';
+import { useSession } from 'next-auth/react';
+
+import signingCelebration from '@documenso/assets/images/signing-celebration.png';
+import type { Document, Signature } from '@documenso/prisma/client';
+import { SigningCard3D } from '@documenso/ui/components/signing-card';
+
+type NoLongerAvailableProps = {
+ document: Document;
+ recipientName: string;
+ recipientSignature: Signature;
+};
+
+export const NoLongerAvailable = ({
+ document,
+ recipientName,
+ recipientSignature,
+}: NoLongerAvailableProps) => {
+ const { data: session } = useSession();
+
+ return (
+
+
+
+
+
+
+ Document Cancelled
+
+
+
+ "{document.title}"
+ is no longer available to sign
+
+
+
+ This document has been cancelled by the owner.
+
+
+ {session?.user ? (
+
+ Go Back Home
+
+ ) : (
+
+ Want to send slick signing links like this one?{' '}
+
+ Check out Documenso.
+
+
+ )}
+
+
+ );
+};
diff --git a/apps/web/src/app/(signing)/sign/[token]/page.tsx b/apps/web/src/app/(signing)/sign/[token]/page.tsx
index 67e679412..17789453e 100644
--- a/apps/web/src/app/(signing)/sign/[token]/page.tsx
+++ b/apps/web/src/app/(signing)/sign/[token]/page.tsx
@@ -8,6 +8,7 @@ import { getDocumentAndSenderByToken } from '@documenso/lib/server-only/document
import { viewedDocument } from '@documenso/lib/server-only/document/viewed-document';
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 { getRecipientSignatures } from '@documenso/lib/server-only/recipient/get-recipient-signatures';
import { DocumentStatus, FieldType, SigningStatus } from '@documenso/prisma/client';
import { Card, CardContent } from '@documenso/ui/primitives/card';
import { ElementVisible } from '@documenso/ui/primitives/element-visible';
@@ -17,6 +18,7 @@ import { DateField } from './date-field';
import { EmailField } from './email-field';
import { SigningForm } from './form';
import { NameField } from './name-field';
+import { NoLongerAvailable } from './no-longer-available';
import { SigningProvider } from './provider';
import { SignatureField } from './signature-field';
@@ -55,6 +57,18 @@ export default async function SigningPage({ params: { token } }: SigningPageProp
redirect(`/sign/${token}/complete`);
}
+ const recipientSignature = (await getRecipientSignatures({ recipientId: recipient.id }))[0];
+
+ if (document.deletedAt) {
+ return (
+
+ );
+ }
+
return (
{
return (
-