"use client"; import { FilePlus, FolderPlus, Loader2, Search, Sparkles } from "lucide-react"; import SidebarFile from "./file"; import SidebarFolder from "./folder"; import { TFile, TFolder, TTab } from "@/lib/types"; import { useState } from "react"; import New from "./new"; import { Socket } from "socket.io-client"; import Button from "@/components/ui/customButton"; import { Switch } from "@/components/ui/switch"; export default function Sidebar({ files, selectFile, handleRename, handleDeleteFile, handleDeleteFolder, socket, addNew, ai, setAi, }: { files: (TFile | TFolder)[]; selectFile: (tab: TTab) => void; handleRename: ( id: string, newName: string, oldName: string, type: "file" | "folder" ) => boolean; handleDeleteFile: (file: TFile) => void; handleDeleteFolder: (folder: TFolder) => void; socket: Socket; addNew: (name: string, type: "file" | "folder") => void; ai: boolean; setAi: React.Dispatch>; }) { 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); }} addNew={addNew} /> ) : null} )}
Copilot{" "} ⌘G
); }