2023-09-22 23:23:55 +10:00
|
|
|
import { Bird, 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 };
|
|
|
|
|
|
2023-09-22 23:15:30 +10:00
|
|
|
export const EmptyDocumentState = ({ status }: EmptyDocumentProps) => {
|
2023-09-09 03:45:15 +00:00
|
|
|
const {
|
|
|
|
|
title,
|
|
|
|
|
message,
|
|
|
|
|
icon: Icon,
|
|
|
|
|
} = match(status)
|
2023-09-09 03:31:17 +00:00
|
|
|
.with(ExtendedDocumentStatus.COMPLETED, () => ({
|
2023-09-09 03:45:15 +00:00
|
|
|
title: 'Nothing to do',
|
|
|
|
|
message:
|
2023-10-27 15:35:10 +05:30
|
|
|
'There are no completed documents yet. Documents that you have created or received will appear here once completed.',
|
2023-09-09 03:45:15 +00:00
|
|
|
icon: CheckCircle2,
|
2023-09-09 03:31:17 +00:00
|
|
|
}))
|
|
|
|
|
.with(ExtendedDocumentStatus.DRAFT, () => ({
|
2023-09-09 03:45:15 +00:00
|
|
|
title: 'No active drafts',
|
|
|
|
|
message:
|
2023-10-27 15:35:10 +05:30
|
|
|
'There are no active drafts at the current moment. You can upload a document to start drafting.',
|
2023-09-09 03:45:15 +00:00
|
|
|
icon: CheckCircle2,
|
2023-09-09 03:31:17 +00:00
|
|
|
}))
|
|
|
|
|
.with(ExtendedDocumentStatus.ALL, () => ({
|
2023-09-09 03:45:15 +00:00
|
|
|
title: "We're all empty",
|
|
|
|
|
message:
|
|
|
|
|
'You have not yet created or received any documents. To create a document please upload one.',
|
|
|
|
|
icon: Bird,
|
2023-09-09 03:31:17 +00:00
|
|
|
}))
|
|
|
|
|
.otherwise(() => ({
|
2023-09-09 03:45:15 +00:00
|
|
|
title: 'Nothing to do',
|
|
|
|
|
message:
|
2023-10-27 15:35:10 +05:30
|
|
|
'All documents have been processed. Any new documents that are sent or received will show here.',
|
2023-09-09 03:45:15 +00:00
|
|
|
icon: CheckCircle2,
|
2023-09-09 03:31:17 +00:00
|
|
|
}));
|
2023-09-06 11:47:58 +00:00
|
|
|
|
|
|
|
|
return (
|
2023-09-09 03:45:15 +00:00
|
|
|
<div className="text-muted-foreground/60 flex h-60 flex-col items-center justify-center gap-y-4">
|
|
|
|
|
<Icon className="h-12 w-12" strokeWidth={1.5} />
|
|
|
|
|
|
2023-09-06 11:47:58 +00:00
|
|
|
<div className="text-center">
|
2023-09-09 03:45:15 +00:00
|
|
|
<h3 className="text-lg font-semibold">{title}</h3>
|
|
|
|
|
|
|
|
|
|
<p className="mt-2 max-w-[60ch]">{message}</p>
|
2023-09-06 11:47:58 +00:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
2023-09-22 23:29:14 +10:00
|
|
|
};
|