- Add ConfirmDeleteDialog for permanent deletion confirmation - Update BulkActionBar to show contextual actions (Restore/Delete permanently in trash view, Archive/Trash elsewhere) - Add Empty Trash button in note list header when viewing trash - Add Empty Trash command to Cmd+K palette - Add bulk restore, bulk delete permanently, and empty trash handlers - All permanent deletions require confirmation dialog - Update mock handlers for batch_delete_notes and empty_trash Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
50 lines
1.3 KiB
TypeScript
50 lines
1.3 KiB
TypeScript
import { memo } from 'react'
|
|
import { Trash } from '@phosphor-icons/react'
|
|
import {
|
|
Dialog,
|
|
DialogContent,
|
|
DialogHeader,
|
|
DialogTitle,
|
|
DialogDescription,
|
|
DialogFooter,
|
|
} from '@/components/ui/dialog'
|
|
import { Button } from '@/components/ui/button'
|
|
|
|
interface ConfirmDeleteDialogProps {
|
|
open: boolean
|
|
title: string
|
|
message: string
|
|
confirmLabel?: string
|
|
onConfirm: () => void
|
|
onCancel: () => void
|
|
}
|
|
|
|
export const ConfirmDeleteDialog = memo(function ConfirmDeleteDialog({
|
|
open,
|
|
title,
|
|
message,
|
|
confirmLabel = 'Delete permanently',
|
|
onConfirm,
|
|
onCancel,
|
|
}: ConfirmDeleteDialogProps) {
|
|
return (
|
|
<Dialog open={open} onOpenChange={(isOpen) => { if (!isOpen) onCancel() }}>
|
|
<DialogContent showCloseButton={false} data-testid="confirm-delete-dialog">
|
|
<DialogHeader>
|
|
<DialogTitle className="flex items-center gap-2">
|
|
<Trash size={18} className="text-destructive" />
|
|
{title}
|
|
</DialogTitle>
|
|
<DialogDescription>{message}</DialogDescription>
|
|
</DialogHeader>
|
|
<DialogFooter>
|
|
<Button variant="outline" onClick={onCancel}>Cancel</Button>
|
|
<Button variant="destructive" onClick={onConfirm} data-testid="confirm-delete-btn">
|
|
{confirmLabel}
|
|
</Button>
|
|
</DialogFooter>
|
|
</DialogContent>
|
|
</Dialog>
|
|
)
|
|
})
|