////////// PROJECT FILE SEPARATION LINE ////////// CODE AFTER THIS LINE ARE FROM: /Data/WebUI/src/Node_Configuration_Sidebar.jsx import { Box, Typography, Tabs, Tab, TextField, MenuItem } from "@mui/material"; import React, { useState } from "react"; import { useReactFlow } from "reactflow"; import ReactMarkdown from "react-markdown"; // Used for Node Usage Documentation export default function NodeConfigurationSidebar({ drawerOpen, setDrawerOpen, title, nodeData }) { const [activeTab, setActiveTab] = useState(0); const { setNodes } = useReactFlow(); const handleTabChange = (_, newValue) => setActiveTab(newValue); const renderConfigFields = () => { const config = nodeData?.config || []; const nodeId = nodeData?.nodeId; return config.map((field, index) => { const value = nodeData?.[field.key] || ""; return ( {field.label || field.key} {field.type === "select" ? ( { const newValue = e.target.value; if (!nodeId) return; setNodes((nds) => nds.map((n) => n.id === nodeId ? { ...n, data: { ...n.data, [field.key]: newValue } } : n ) ); window.BorealisValueBus[nodeId] = newValue; }} SelectProps={{ MenuProps: { PaperProps: { sx: { bgcolor: "#1e1e1e", color: "#ccc", border: "1px solid #58a6ff", "& .MuiMenuItem-root": { color: "#ccc", fontSize: "0.85rem", "&:hover": { backgroundColor: "#2a2a2a" }, "&.Mui-selected": { backgroundColor: "#2c2c2c !important", color: "#58a6ff" }, "&.Mui-selected:hover": { backgroundColor: "#2a2a2a !important" } } } } } }} sx={{ "& .MuiOutlinedInput-root": { backgroundColor: "#1e1e1e", color: "#ccc", fontSize: "0.85rem", "& fieldset": { borderColor: "#444" }, "&:hover fieldset": { borderColor: "#58a6ff" }, "&.Mui-focused fieldset": { borderColor: "#58a6ff" } }, "& .MuiSelect-select": { backgroundColor: "#1e1e1e" } }} > {(field.options || []).map((opt, idx) => ( {opt} ))} ) : ( { const newValue = e.target.value; if (!nodeId) return; setNodes((nds) => nds.map((n) => n.id === nodeId ? { ...n, data: { ...n.data, [field.key]: newValue } } : n ) ); window.BorealisValueBus[nodeId] = newValue; }} InputProps={{ sx: { backgroundColor: "#1e1e1e", color: "#ccc", "& fieldset": { borderColor: "#444" }, "&:hover fieldset": { borderColor: "#666" }, "&.Mui-focused fieldset": { borderColor: "#58a6ff" } } }} /> )} ); }); }; return ( <> setDrawerOpen(false)} sx={{ position: "absolute", top: 0, left: 0, right: 0, bottom: 0, backgroundColor: "rgba(0, 0, 0, 0.3)", opacity: drawerOpen ? 1 : 0, pointerEvents: drawerOpen ? "auto" : "none", transition: "opacity 0.6s ease", zIndex: 10 }} /> e.stopPropagation()} > {"Edit " + (title || "Node")} {activeTab === 0 && renderConfigFields()} {activeTab === 1 && ( ( ), p: ({ node, ...props }) => ( ), ul: ({ node, ...props }) => (
    ), li: ({ node, ...props }) => (
  • ) }} /> )} ); }