Compare commits
6 Commits
feat/chat-
...
feat/table
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5ef3523d89 | ||
|
|
a27c6c3eb2 | ||
|
|
a5b3969f56 | ||
|
|
f61bf00702 | ||
|
|
86b0d5ee9c | ||
|
|
1dd1bb617d |
@@ -15,6 +15,7 @@ import {
|
||||
} from '@documenso/ui/primitives/table';
|
||||
|
||||
import { CardMetric } from '~/components/(dashboard)/metric-card/metric-card';
|
||||
import { ActionButtons } from '~/components/(dashboard)/table/actions-component';
|
||||
import { DocumentStatus } from '~/components/formatter/document-status';
|
||||
import { LocaleDate } from '~/components/formatter/locale-date';
|
||||
|
||||
@@ -61,7 +62,8 @@ export default async function DashboardPage() {
|
||||
<TableHead className="w-[100px]">ID</TableHead>
|
||||
<TableHead>Title</TableHead>
|
||||
<TableHead>Status</TableHead>
|
||||
<TableHead className="text-right">Created</TableHead>
|
||||
<TableHead>Created</TableHead>
|
||||
<TableHead>Actions</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
@@ -79,14 +81,17 @@ export default async function DashboardPage() {
|
||||
<TableCell>
|
||||
<DocumentStatus status={document.status} />
|
||||
</TableCell>
|
||||
<TableCell className="text-right">
|
||||
<TableCell>
|
||||
<LocaleDate date={document.created} />
|
||||
</TableCell>
|
||||
<TableCell className="flex cursor-pointer gap-6">
|
||||
<ActionButtons documentId={document.id} />
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
))}
|
||||
{results.data.length === 0 && (
|
||||
<TableRow>
|
||||
<TableCell colSpan={4} className="h-24 text-center">
|
||||
<TableCell colSpan={5} className="h-24 text-center">
|
||||
No results.
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
|
||||
@@ -12,6 +12,7 @@ import { Document } from '@documenso/prisma/client';
|
||||
import { DataTable } from '@documenso/ui/primitives/data-table';
|
||||
import { DataTablePagination } from '@documenso/ui/primitives/data-table-pagination';
|
||||
|
||||
import { ActionButtons } from '~/components/(dashboard)/table/actions-component';
|
||||
import { DocumentStatus } from '~/components/formatter/document-status';
|
||||
import { LocaleDate } from '~/components/formatter/locale-date';
|
||||
|
||||
@@ -59,6 +60,11 @@ export const DocumentsDataTable = ({ results }: DocumentsDataTableProps) => {
|
||||
accessorKey: 'created',
|
||||
cell: ({ row }) => <LocaleDate date={row.getValue('created')} />,
|
||||
},
|
||||
{
|
||||
header: 'Actions',
|
||||
accessorKey: 'actions',
|
||||
cell: ({ row }) => <ActionButtons documentId={row.original.id} />,
|
||||
},
|
||||
]}
|
||||
data={results.data}
|
||||
perPage={results.perPage}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
'use client';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import { Download, Edit, Trash } from 'lucide-react';
|
||||
|
||||
export function ActionButtons({ documentId }: { documentId: number }) {
|
||||
return (
|
||||
<div className="flex cursor-pointer gap-6">
|
||||
<Edit
|
||||
className="text-primary h-5 w-5"
|
||||
onClick={() => {
|
||||
console.log('Edit Document with id: ', documentId);
|
||||
}}
|
||||
/>
|
||||
<Download
|
||||
className="text-primary h-5 w-5"
|
||||
onClick={() => {
|
||||
console.log('Download Document with id: ', documentId);
|
||||
}}
|
||||
/>
|
||||
<Trash
|
||||
className="text-primary h-5 w-5"
|
||||
onClick={() => {
|
||||
console.log('Delete Document with id: ', documentId);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user