import { Modal, Upload } from "antd"; import { CloudUpload, FileText, ShieldCheck } from "lucide-react"; import { useRef, useState } from "react"; import type { RegisteredPlugin } from "@/lib/plugins/plugin-types"; import pluginDevelopmentGuideMarkdown from "./plugin-development-guide.md?raw"; import { getPluginDocumentation } from "./plugin-documentation"; import { PluginMarkdown } from "./plugin-markdown"; import "./plugins.css"; type UploadPluginModalProps = { open: boolean; onClose: () => void; onUpload: (file: File) => void; }; export function UploadPluginModal({ open, onClose, onUpload }: UploadPluginModalProps) { const [isDraggingPlugin, setIsDraggingPlugin] = useState(false); const dragDepth = useRef(0); const handlePluginDragEnter = (event: React.DragEvent) => { event.preventDefault(); dragDepth.current += 1; setIsDraggingPlugin(true); }; const handlePluginDragLeave = (event: React.DragEvent) => { event.preventDefault(); dragDepth.current -= 1; if (dragDepth.current <= 0) { dragDepth.current = 0; setIsDraggingPlugin(false); } }; const handlePluginDrop = (event: React.DragEvent) => { event.preventDefault(); dragDepth.current = 0; setIsDraggingPlugin(false); }; return (
); } type PluginDetailsModalProps = { plugin?: RegisteredPlugin; restoreFocus: boolean; onClose: () => void; }; export function PluginDetailsModal({ plugin, restoreFocus, onClose }: PluginDetailsModalProps) { return ( {plugin.manifest.name} v{plugin.manifest.version} ) : null} open={Boolean(plugin)} centered footer={null} destroyOnHidden focusTriggerAfterClose={restoreFocus} onCancel={onClose} styles={{ body: { maxHeight: "min(78vh, 820px)", overflowY: "auto", overscrollBehavior: "contain" } }} > {plugin ? : null} ); }