Files
sign/apps/remix/app/components/tables/documents-table-empty-state.tsx

54 lines
1.8 KiB
TypeScript
Raw Normal View History

2025-01-02 15:33:37 +11:00
import { msg } from '@lingui/core/macro';
2024-08-27 20:34:39 +09:00
import { useLingui } from '@lingui/react';
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';
2025-01-02 15:33:37 +11:00
export type DocumentsTableEmptyStateProps = { status: ExtendedDocumentStatus };
2023-09-06 11:52:15 +00:00
2025-01-02 15:33:37 +11:00
export const DocumentsTableEmptyState = ({ status }: DocumentsTableEmptyStateProps) => {
2024-08-27 20:34:39 +09:00
const { _ } = useLingui();
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, () => ({
2024-08-27 20:34:39 +09:00
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.`,
2023-09-09 03:45:15 +00:00
icon: CheckCircle2,
2023-09-09 03:31:17 +00:00
}))
.with(ExtendedDocumentStatus.DRAFT, () => ({
2024-08-27 20:34:39 +09:00
title: msg`No active drafts`,
message: msg`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, () => ({
2024-08-27 20:34:39 +09:00
title: msg`We're all empty`,
message: msg`You have not yet created or received any documents. To create a document please upload one.`,
2023-09-09 03:45:15 +00:00
icon: Bird,
2023-09-09 03:31:17 +00:00
}))
.otherwise(() => ({
2024-08-27 20:34:39 +09:00
title: msg`Nothing to do`,
message: msg`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">
2024-08-27 20:34:39 +09:00
<h3 className="text-lg font-semibold">{_(title)}</h3>
2023-09-09 03:45:15 +00:00
2024-08-27 20:34:39 +09:00
<p className="mt-2 max-w-[60ch]">{_(message)}</p>
</div>
</div>
);
2023-09-22 23:29:14 +10:00
};