"use client"
import { FilePlus, FolderPlus, Loader2, Search } from "lucide-react"
import SidebarFile from "./file"
import SidebarFolder from "./folder"
import { TFile, TFolder, TTab } from "./types"
import { useState } from "react"
import New from "./new"
export default function Sidebar({
files,
selectFile,
handleRename,
}: {
files: (TFile | TFolder)[]
selectFile: (tab: TTab) => void
handleRename: (
id: string,
newName: string,
oldName: string,
type: "file" | "folder"
) => boolean
}) {
const [creatingNew, setCreatingNew] = useState<"file" | "folder" | null>(null)
return (
Explorer
{/* Todo: Implement file searching */}
{/* */}
{files.length === 0 ? (
) : (
<>
{files.map((child) =>
child.type === "file" ? (
) : (
)
)}
{creatingNew !== null ? (
setCreatingNew(null)}
/>
) : null}
>
)}
)
}