mirror of
https://github.com/documenso/documenso.git
synced 2025-11-10 04:22:32 +10:00
59 lines
2.0 KiB
TypeScript
59 lines
2.0 KiB
TypeScript
import { msg } from '@lingui/core/macro';
|
|
import { useLingui } from '@lingui/react';
|
|
import { Bird, CheckCircle2, Trash } from 'lucide-react';
|
|
import { match } from 'ts-pattern';
|
|
|
|
import { ExtendedDocumentStatus } from '@documenso/prisma/types/extended-document-status';
|
|
|
|
export type DocumentsTableEmptyStateProps = { status: ExtendedDocumentStatus };
|
|
|
|
export const DocumentsTableEmptyState = ({ status }: DocumentsTableEmptyStateProps) => {
|
|
const { _ } = useLingui();
|
|
|
|
const {
|
|
title,
|
|
message,
|
|
icon: Icon,
|
|
} = match(status)
|
|
.with(ExtendedDocumentStatus.COMPLETED, () => ({
|
|
title: msg`Nothing to do`,
|
|
message: msg`There are no completed documents yet. Documents that you have created or received will appear here once completed.`,
|
|
icon: CheckCircle2,
|
|
}))
|
|
.with(ExtendedDocumentStatus.DRAFT, () => ({
|
|
title: msg`No active drafts`,
|
|
message: msg`There are no active drafts at the current moment. You can upload a document to start drafting.`,
|
|
icon: CheckCircle2,
|
|
}))
|
|
.with(ExtendedDocumentStatus.ALL, () => ({
|
|
title: msg`We're all empty`,
|
|
message: msg`You have not yet created or received any documents. To create a document please upload one.`,
|
|
icon: Bird,
|
|
}))
|
|
.with(ExtendedDocumentStatus.DELETED, () => ({
|
|
title: msg`Nothing in the trash`,
|
|
message: msg`There are no documents in the trash.`,
|
|
icon: Trash,
|
|
}))
|
|
.otherwise(() => ({
|
|
title: msg`Nothing to do`,
|
|
message: msg`All documents have been processed. Any new documents that are sent or received will show here.`,
|
|
icon: CheckCircle2,
|
|
}));
|
|
|
|
return (
|
|
<div
|
|
className="text-muted-foreground/60 flex h-60 flex-col items-center justify-center gap-y-4"
|
|
data-testid="empty-document-state"
|
|
>
|
|
<Icon className="h-12 w-12" strokeWidth={1.5} />
|
|
|
|
<div className="text-center">
|
|
<h3 className="text-lg font-semibold">{_(title)}</h3>
|
|
|
|
<p className="mt-2 max-w-[60ch]">{_(message)}</p>
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|