From 3b65447b0ff21623ae848e32cc243ad9208df79b Mon Sep 17 00:00:00 2001 From: Rohit Saluja Date: Tue, 12 Mar 2024 20:38:11 +0530 Subject: [PATCH] feat: updating the dialog and page of document --- .../documents/[id]/delete-document-dialog.tsx | 15 +++++++-------- .../app/(dashboard)/admin/documents/[id]/page.tsx | 5 +++++ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/apps/web/src/app/(dashboard)/admin/documents/[id]/delete-document-dialog.tsx b/apps/web/src/app/(dashboard)/admin/documents/[id]/delete-document-dialog.tsx index aacb49d65..c38ca03e2 100644 --- a/apps/web/src/app/(dashboard)/admin/documents/[id]/delete-document-dialog.tsx +++ b/apps/web/src/app/(dashboard)/admin/documents/[id]/delete-document-dialog.tsx @@ -34,7 +34,7 @@ export const DeleteDocumentDialog = ({ document }: DeleteDocumentDialogProps) => const handleDeleteDocument = async () => { try { - await deleteDocument({ id: 1, userId: 1 }); + await deleteDocument({ id: document.id, userId: document.userId }); toast({ title: 'Document deleted', description: 'The Document has been deleted successfully.', @@ -68,22 +68,21 @@ export const DeleteDocumentDialog = ({ document }: DeleteDocumentDialogProps) => variant="neutral" >
- Delete Account + Delete Document - Delete the users account and all its contents. This action is irreversible and will - cancel their subscription, so proceed with caution. + Delete the document. This action is irreversible so proceed with caution.
- + - Delete Account + Delete Document @@ -93,7 +92,7 @@ export const DeleteDocumentDialog = ({ document }: DeleteDocumentDialogProps) =>
- To confirm, please the reason + To confirm, please enter the reason loading={isDeletingDocument} variant="destructive" > - {isDeletingDocument ? 'Deleting account...' : 'Delete Account'} + {isDeletingDocument ? 'Deleting document...' : 'Delete Document'} diff --git a/apps/web/src/app/(dashboard)/admin/documents/[id]/page.tsx b/apps/web/src/app/(dashboard)/admin/documents/[id]/page.tsx index a22345457..5135a6236 100644 --- a/apps/web/src/app/(dashboard)/admin/documents/[id]/page.tsx +++ b/apps/web/src/app/(dashboard)/admin/documents/[id]/page.tsx @@ -13,6 +13,7 @@ import { DocumentStatus } from '~/components/formatter/document-status'; import { LocaleDate } from '~/components/formatter/locale-date'; import { AdminActions } from './admin-actions'; +import { DeleteDocumentDialog } from './delete-document-dialog'; import { RecipientItem } from './recipient-item'; type AdminDocumentDetailsPageProps = { @@ -81,6 +82,10 @@ export default async function AdminDocumentDetailsPage({ params }: AdminDocument ))}
+ +
+ + {document && }
); }