Added Collapsible Sidebar

This commit is contained in:
2025-04-30 23:40:15 -06:00
parent 1047e8ee51
commit cf14ee0111
4 changed files with 159 additions and 142 deletions

View File

@ -82,7 +82,7 @@
input, input,
select, select,
button { button {
background-color: #2a2a2a; background-color: #1d1d1d;
color: #ccc; color: #ccc;
border: 1px solid #444; border: 1px solid #444;
font-size: 12px; font-size: 12px;
@ -91,7 +91,7 @@ button {
/* Label / Dark Text styling */ /* Label / Dark Text styling */
label { label {
color: #aaa; color: #aaa;
font-size: 10px; font-size: 9px;
} }
/* ======================================= */ /* ======================================= */

View File

@ -7,7 +7,8 @@ import {
AccordionDetails, AccordionDetails,
Button, Button,
Tooltip, Tooltip,
Typography Typography,
IconButton
} from "@mui/material"; } from "@mui/material";
import { import {
ExpandMore as ExpandMoreIcon, ExpandMore as ExpandMoreIcon,
@ -15,7 +16,9 @@ import {
FileOpen as FileOpenIcon, FileOpen as FileOpenIcon,
DeleteForever as DeleteForeverIcon, DeleteForever as DeleteForeverIcon,
DragIndicator as DragIndicatorIcon, DragIndicator as DragIndicatorIcon,
Polyline as PolylineIcon Polyline as PolylineIcon,
ChevronLeft as ChevronLeftIcon,
ChevronRight as ChevronRightIcon
} from "@mui/icons-material"; } from "@mui/icons-material";
export default function NodeSidebar({ export default function NodeSidebar({
@ -27,6 +30,7 @@ export default function NodeSidebar({
onFileInputChange onFileInputChange
}) { }) {
const [expandedCategory, setExpandedCategory] = useState(null); const [expandedCategory, setExpandedCategory] = useState(null);
const [collapsed, setCollapsed] = useState(false);
const handleAccordionChange = (category) => (_, isExpanded) => { const handleAccordionChange = (category) => (_, isExpanded) => {
setExpandedCategory(isExpanded ? category : null); setExpandedCategory(isExpanded ? category : null);
@ -35,12 +39,18 @@ export default function NodeSidebar({
return ( return (
<div <div
style={{ style={{
width: 300, //Width of the Node Sidebar width: collapsed ? 40 : 300,
backgroundColor: "#121212", backgroundColor: "#121212",
borderRight: "1px solid #333", borderRight: "1px solid #333",
overflowY: "auto" overflow: "hidden",
display: "flex",
flexDirection: "column",
height: "100%"
}} }}
> >
<div style={{ flex: 1, overflowY: "auto" }}>
{!collapsed && (
<>
{/* Workflows Section */} {/* Workflows Section */}
<Accordion <Accordion
defaultExpanded defaultExpanded
@ -153,7 +163,7 @@ export default function NodeSidebar({
</AccordionDetails> </AccordionDetails>
</Accordion> </Accordion>
{/* Hidden file input fallback for older browsers */} {/* Hidden file input */}
<input <input
type="file" type="file"
accept=".json,application/json" accept=".json,application/json"
@ -161,6 +171,22 @@ export default function NodeSidebar({
ref={fileInputRef} ref={fileInputRef}
onChange={onFileInputChange} onChange={onFileInputChange}
/> />
</>
)}
</div>
{/* Bottom toggle button */}
<div style={{ padding: "6px", borderTop: "1px solid #333", display: "flex", justifyContent: "center" }}>
<Tooltip title={collapsed ? "Expand Sidebar" : "Collapse Sidebar"} placement="right">
<IconButton
onClick={() => setCollapsed(!collapsed)}
size="small"
sx={{ color: "#888" }}
>
{collapsed ? <ChevronRightIcon /> : <ChevronLeftIcon />}
</IconButton>
</Tooltip>
</div>
</div> </div>
); );
} }

View File

@ -104,7 +104,7 @@ const BorealisAgentNode = ({ id, data }) => {
> >
<option value="">-- Select --</option> <option value="">-- Select --</option>
{Object.entries(agents).map(([id, info]) => { {Object.entries(agents).map(([id, info]) => {
const label = info.status === "provisioned" ? "(Provisioned)" : "(Idle)"; const label = info.status === "provisioned" ? "(Provisioned)" : "(Not Provisioned)";
return ( return (
<option key={id} value={id}> <option key={id} value={id}>
{id} {label} {id} {label}
@ -123,16 +123,8 @@ const BorealisAgentNode = ({ id, data }) => {
<hr style={{ margin: "6px 0", borderColor: "#444" }} /> <hr style={{ margin: "6px 0", borderColor: "#444" }} />
<div style={{ fontSize: "8px", color: "#aaa" }}> <div style={{ fontSize: "8px", color: "#aaa" }}>
Connect <strong>Instruction Nodes</strong> below to define roles. Connect <strong>Agent Role Nodes</strong> below to define roles for this agent.
Each instruction node will send back its results (like screenshots) and act as a separate data output. Each connected <strong>Agent Role Node</strong> will send back its collected data (like screenshots) through the role node itself and act as a separate data output.
</div>
<div style={{ fontSize: "8px", color: "#aaa", marginTop: "4px" }}>
<strong>Supported Roles:</strong>
<ul style={{ paddingLeft: "14px", marginTop: "2px", marginBottom: "0" }}>
<li><code>screenshot</code>: Capture a region with interval and overlay</li>
{/* Future roles will be listed here */}
</ul>
</div> </div>
</div> </div>
</div> </div>

View File

@ -21,5 +21,4 @@
}, },
"include": ["src"], "include": ["src"],
"exclude": ["node_modules", "build", "dist"] "exclude": ["node_modules", "build", "dist"]
} }