Compare commits

...

6 Commits

Author SHA1 Message Date
Ephraim Atta-Duncan
5ef3523d89 fix: increase table col span to center text 2023-07-10 02:43:28 +00:00
Ephraim Atta-Duncan
a27c6c3eb2 refactor: use tailwind in styling icons 2023-07-05 20:53:08 +00:00
Ephraim Atta-Duncan
a5b3969f56 revert: include time in document created 2023-07-05 20:49:20 +00:00
Ephraim Atta-Duncan
f61bf00702 feat: pass document id as prop to the actions component 2023-07-04 00:59:25 +00:00
Ephraim Atta-Duncan
86b0d5ee9c feat: add actions to all documents table 2023-07-04 00:32:11 +00:00
Ephraim Atta-Duncan
1dd1bb617d feat: add action buttons to documents table 2023-07-04 00:29:26 +00:00
3 changed files with 44 additions and 3 deletions

View File

@@ -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>

View File

@@ -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}

View File

@@ -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>
);
}