feat(ui): add delete confirmation dialog for file list and cards

This commit is contained in:
yiling
2026-05-24 09:59:35 +08:00
parent 6655cdb767
commit 5a36bf308f
3 changed files with 53 additions and 40 deletions
@@ -23,6 +23,16 @@ import { FileListItem } from './file-list-item'
import { FolderCard } from './folder-card'
import { Button } from '../ui/button'
import { ContextMenu, ContextMenuTrigger } from '../ui/context-menu'
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
} from '../ui/alert-dialog'
import { useFileActions } from './use-file-actions'
interface FileBrowserProps {
@@ -110,6 +120,9 @@ export function FileBrowser({
handleDownload,
handleAction,
onRenameSubmit,
isDeleteDialogOpen,
setIsDeleteDialogOpen,
confirmDelete,
} = useFileActions({
teamId,
projectId,
@@ -680,6 +693,28 @@ export function FileBrowser({
onChange={handleFileChange}
/>
{renderContent()}
<AlertDialog open={isDeleteDialogOpen} onOpenChange={setIsDeleteDialogOpen}>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Delete Asset?</AlertDialogTitle>
<AlertDialogDescription>
Deleted items can be recovered for 30 days before being permanently deleted.
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Cancel</AlertDialogCancel>
<AlertDialogAction
onClick={() => {
confirmDelete()
}}
className="bg-destructive text-destructive-foreground hover:bg-destructive/90"
>
Delete
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
</>
)
}