{file.isDirectory && (
)}
{getFileIcon()}
{editing ? (
setEditName(e.target.value)}
onBlur={handleRenameSubmit}
onKeyDown={(e) => {
if (e.key === 'Enter') handleRenameSubmit()
if (e.key === 'Escape') handleRenameCancel()
}}
onClick={(e) => e.stopPropagation()}
className="h-10"
autoFocus
/>
) : (
{file.name}
)}
{!file.isDirectory && (
Download
)}
Rename
Delete
{file.isDirectory && expanded && file.children && (
{file.children.map((child) => (
))}
)}
)
}
export const FileTree = memo(function FileTree({ files, onFileSelect, onDirectoryClick, selectedFile, onDelete, onRename, currentPath = '', basePath = '', onNavigateUp }: FileTreeProps) {
const handleGoUp = () => {
onNavigateUp?.()
}
const showGoUp = currentPath && currentPath !== basePath
return (
{showGoUp && (
âŠī¸
..
)}
{files.length === 0 ? (
No files in this directory
) : (
files.map((file) => (
))
)}
)
})