Files
sign/apps/web/src/app/(dashboard)/documents/empty-state.tsx

54 lines
1.7 KiB
TypeScript
Raw Normal View History

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: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:
'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:
'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:
'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
}));
return (
<div
className="text-muted-foreground/60 flex h-60 flex-col items-center justify-center gap-y-4"
data-testid="empty-document-state"
>
2023-09-09 03:45:15 +00:00
<Icon className="h-12 w-12" strokeWidth={1.5} />
<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>
</div>
</div>
);
2023-09-22 23:29:14 +10:00
};