Skip to content

Commit 1eb9ad5

Browse files
committed
Add delete button to document tree items
1 parent d43bfac commit 1eb9ad5

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

components/PromptTreeItem.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { useState, useRef, useEffect, useLayoutEffect, useCallback } from
22
// Fix: Correctly import the DocumentOrFolder type.
33
import type { DocumentOrFolder, DraggedNodeTransfer } from '../types';
44
import IconButton from './IconButton';
5-
import { FileIcon, FolderIcon, FolderOpenIcon, ChevronRightIcon, ChevronDownIcon, CopyIcon, ArrowUpIcon, ArrowDownIcon, CodeIcon, LockClosedIcon, LockOpenIcon } from './Icons';
5+
import { FileIcon, FolderIcon, FolderOpenIcon, ChevronRightIcon, ChevronDownIcon, CopyIcon, ArrowUpIcon, ArrowDownIcon, CodeIcon, LockClosedIcon, LockOpenIcon, TrashIcon } from './Icons';
66
import Tooltip from './Tooltip';
77
import EmojiPickerOverlay from './EmojiPickerOverlay';
88

@@ -601,6 +601,17 @@ const DocumentTreeItem: React.FC<DocumentTreeItemProps> = (props) => {
601601
<LockOpenIcon className="w-3.5 h-3.5" />
602602
)}
603603
</IconButton>
604+
<IconButton
605+
aria-label="Delete Document"
606+
onClick={(e) => {
607+
e.stopPropagation();
608+
onDeleteNode(node.id, e.shiftKey);
609+
}}
610+
size="xs"
611+
variant="destructive"
612+
>
613+
<TrashIcon className="w-3.5 h-3.5" />
614+
</IconButton>
604615
</>
605616
)}
606617
</div>

0 commit comments

Comments
 (0)