2023-09-06 11:47:58 +00:00
|
|
|
import { ArrowRight, CheckCircle2 } from 'lucide-react';
|
2023-09-09 03:31:17 +00:00
|
|
|
import { match } from 'ts-pattern';
|
2023-09-06 11:47:58 +00:00
|
|
|
|
2023-09-06 11:52:15 +00:00
|
|
|
import { ExtendedDocumentStatus } from '@documenso/prisma/types/extended-document-status';
|
|
|
|
|
|
|
|
|
|
export type EmptyDocumentProps = { status: ExtendedDocumentStatus };
|
|
|
|
|
|
|
|
|
|
export default function EmptyDocumentState({ status }: EmptyDocumentProps) {
|
2023-09-09 03:31:17 +00:00
|
|
|
const { headerText, bodyText, extraText, showArrow } = match(status)
|
|
|
|
|
.with(ExtendedDocumentStatus.COMPLETED, () => ({
|
|
|
|
|
headerText: 'Nothing here',
|
|
|
|
|
bodyText: 'There are no signed documents yet.',
|
|
|
|
|
extraText: 'Start by adding a document',
|
|
|
|
|
showArrow: true,
|
|
|
|
|
}))
|
|
|
|
|
.with(ExtendedDocumentStatus.DRAFT, () => ({
|
|
|
|
|
headerText: 'Nothing here',
|
|
|
|
|
bodyText: 'There are no drafts yet.',
|
|
|
|
|
extraText: 'Start by adding a document',
|
|
|
|
|
showArrow: true,
|
|
|
|
|
}))
|
|
|
|
|
.with(ExtendedDocumentStatus.ALL, () => ({
|
|
|
|
|
headerText: 'Nothing here',
|
|
|
|
|
bodyText: 'There are no documents yet.',
|
|
|
|
|
extraText: 'Start by adding a document',
|
|
|
|
|
showArrow: true,
|
|
|
|
|
}))
|
|
|
|
|
.otherwise(() => ({
|
|
|
|
|
headerText: 'All done',
|
|
|
|
|
bodyText: 'All documents signed for now.',
|
|
|
|
|
extraText: '',
|
|
|
|
|
showArrow: false,
|
|
|
|
|
}));
|
2023-09-06 11:47:58 +00:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className="text-muted-foreground/50 flex h-96 flex-col items-center justify-center space-y-3">
|
2023-09-09 03:31:17 +00:00
|
|
|
<CheckCircle2 className="text-muted-foreground/50 h-12 w-12" strokeWidth={1.5} />
|
2023-09-06 11:47:58 +00:00
|
|
|
<div className="text-center">
|
|
|
|
|
<h3 className="text-lg font-semibold">{headerText}</h3>
|
|
|
|
|
<p>{bodyText}</p>
|
|
|
|
|
{extraText && (
|
|
|
|
|
<p>
|
|
|
|
|
{extraText} {showArrow && <ArrowRight className="inline h-4 w-4" />}
|
|
|
|
|
</p>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|