feat: show document title for delete dialog - [DOC-387] (#772)

This commit is contained in:
Lucas Smith
2023-12-22 15:09:03 +11:00
committed by GitHub
2 changed files with 6 additions and 3 deletions

View File

@ -165,6 +165,7 @@ export const DataTableActionDropdown = ({ row }: DataTableActionDropdownProps) =
<DeleteDocumentDialog <DeleteDocumentDialog
id={row.id} id={row.id}
status={row.status} status={row.status}
documentTitle={row.title}
open={isDeleteDialogOpen} open={isDeleteDialogOpen}
onOpenChange={setDeleteDialogOpen} onOpenChange={setDeleteDialogOpen}
/> />

View File

@ -21,6 +21,7 @@ type DeleteDraftDocumentDialogProps = {
open: boolean; open: boolean;
onOpenChange: (_open: boolean) => void; onOpenChange: (_open: boolean) => void;
status: DocumentStatus; status: DocumentStatus;
documentTitle: string;
}; };
export const DeleteDocumentDialog = ({ export const DeleteDocumentDialog = ({
@ -28,6 +29,7 @@ export const DeleteDocumentDialog = ({
open, open,
onOpenChange, onOpenChange,
status, status,
documentTitle,
}: DeleteDraftDocumentDialogProps) => { }: DeleteDraftDocumentDialogProps) => {
const router = useRouter(); const router = useRouter();
@ -42,7 +44,7 @@ export const DeleteDocumentDialog = ({
toast({ toast({
title: 'Document deleted', title: 'Document deleted',
description: 'Your document has been successfully deleted.', description: `"${documentTitle}" has been successfully deleted`,
duration: 5000, duration: 5000,
}); });
@ -79,7 +81,7 @@ export const DeleteDocumentDialog = ({
<Dialog open={open} onOpenChange={(value) => !isLoading && onOpenChange(value)}> <Dialog open={open} onOpenChange={(value) => !isLoading && onOpenChange(value)}>
<DialogContent> <DialogContent>
<DialogHeader> <DialogHeader>
<DialogTitle>Do you want to delete this document?</DialogTitle> <DialogTitle>Are you sure you want to delete "{documentTitle}"?</DialogTitle>
<DialogDescription> <DialogDescription>
Please note that this action is irreversible. Once confirmed, your document will be Please note that this action is irreversible. Once confirmed, your document will be
@ -88,7 +90,7 @@ export const DeleteDocumentDialog = ({
</DialogHeader> </DialogHeader>
{status !== DocumentStatus.DRAFT && ( {status !== DocumentStatus.DRAFT && (
<div className="mt-8"> <div className="mt-4">
<Input <Input
type="text" type="text"
value={inputValue} value={inputValue}