import Icon from "../common/Icon"; import type { ScriptItem, ScriptType } from "../../services/api"; type ContextMenuState = { x: number; y: number; kind: "root" | "directory" | "file"; path: string; script?: ScriptItem; }; type TreeContextMenuProps = { contextMenu: ContextMenuState | null; onOpenScript: (scriptId: string) => void; onRemoveScript: (script: ScriptItem) => void; onToggleLock: (script: ScriptItem) => void; onOpenCreateDialog: (parentPath: string, scriptType: ScriptType) => void; onOpenFolderDialog: (parentPath: string) => void; onChooseUpload: (parentPath: string) => void; onRemoveDirectory: (path: string) => void; onCopyResourcePath?: (jupyterPath: string) => void; onRemoveResource?: (resourceId: string) => void; onClose: () => void; }; export function TreeContextMenu({ contextMenu, onOpenScript, onRemoveScript, onToggleLock, onOpenCreateDialog, onOpenFolderDialog, onChooseUpload, onRemoveDirectory, onCopyResourcePath, onRemoveResource, onClose, }: TreeContextMenuProps) { if (!contextMenu) return null; const width = 188; const height = contextMenu.kind === "file" ? 124 : 190; const isDataResource = !!contextMenu.script?.script_id.startsWith("data:"); return (