/** * @file Preview of all inspector panel components for design verification */ import * as React from "react"; import type { NodeDefinition } from "../../../../types/NodeDefinition"; import { H2 } from "../../../../components/elements/Heading"; import { PropertySection } from "../../../../components/inspector/parts/PropertySection"; import { InspectorFieldRow } from "../../../../components/inspector/parts/InspectorFieldRow"; import { InspectorInput } from "../../../../components/inspector/parts/InspectorInput"; import { InspectorSelect } from "../../../../components/inspector/parts/InspectorSelect"; import { InspectorButtonGroup } from "../../../../components/inspector/parts/InspectorButtonGroup"; import { InspectorIconButton } from "../../../../components/inspector/parts/InspectorIconButton"; import { InspectorButton } from "../../../../components/inspector/parts/InspectorButton"; import { NodeCard } from "../../../../components/node/cards/NodeCard"; import { HistoryControls } from "../../../../components/controls/history/HistoryControls"; import { CategoryIcon } from "../../../../category/components/CategoryIcon"; import styles from "./InspectorPanelsExample.module.css"; // Icons const ResetIcon = () => ( ); // Sample data const sampleNodeDefinitions: NodeDefinition[] = [ { type: "data-source", displayName: "Data Source", description: "Load data from external sources", category: "Data", icon: "πŸ“₯", }, { type: "data-filter", displayName: "Filter", description: "Filter data based on conditions", category: "Data", icon: "πŸ”", }, { type: "logic-if", displayName: "If/Else", description: "Conditional branching", category: "Logic", icon: "❓", }, { type: "math-add", displayName: "Add", description: "Add two numbers", category: "Math", icon: "βž•", }, ]; // HistoryEntry requires `action` and `data` properties - we use a simplified mock for display type MockHistoryEntry = { id: string; timestamp: number; action: string; }; const sampleHistoryEntries: MockHistoryEntry[] = [ { id: "1", action: "Add node: Data Source", timestamp: Date.now() - 300000 }, { id: "2", action: "Add node: Filter", timestamp: Date.now() - 240000 }, { id: "3", action: "Connect nodes", timestamp: Date.now() - 180000 }, { id: "4", action: "Move node: Data Source", timestamp: Date.now() - 120000 }, { id: "5", action: "Update node properties", timestamp: Date.now() - 60000 }, ]; const sampleCategories = [ { name: "Data", icon: "πŸ“Š", nodes: sampleNodeDefinitions.filter((n) => n.category === "Data") }, { name: "Logic", icon: "πŸ”€", nodes: sampleNodeDefinitions.filter((n) => n.category === "Logic") }, { name: "Math", icon: "πŸ”’", nodes: sampleNodeDefinitions.filter((n) => n.category === "Math") }, ]; /** * Showcase of all inspector panels */ export function InspectorPanelsExample(): React.ReactElement { const [showGrid, setShowGrid] = React.useState(true); const [snapToGrid, setSnapToGrid] = React.useState(true); const [gridSize, setGridSize] = React.useState("20"); const [autoSave, setAutoSave] = React.useState(true); const [layoutStrategy, setLayoutStrategy] = React.useState("auto"); return (

Inspector Panels

Preview of all inspector panel components. These panels appear in the inspector sidebar.

{/* Node Palette Panel */}
NodePalettePanel
{}} placeholder="Search nodes…" />
{sampleCategories.map((category) => (
{category.name}
{category.nodes.length}
{category.nodes.map((node) => ( ))}
))}
{/* History Panel */}
HistoryPanel
{}} onRedo={() => {}} /> } >
    {sampleHistoryEntries.map((entry, idx) => (
  • {entry.action} {new Date(entry.timestamp).toLocaleTimeString()}
  • ))}
{/* Grid Settings Panel */}
GridSettingsPanel
setShowGrid(v === "on")} aria-label="Show grid" /> setSnapToGrid(v === "on")} aria-label="Snap to grid" />
setGridSize(e.target.value)} /> {}} />
{/* General Settings Panel */}
GeneralSettingsPanel
setAutoSave(v === "on")} aria-label="Enable auto save" /> {}} disabled={!autoSave} />
setLayoutStrategy(e.target.value)} > Run Auto Layout

0 invalid connections found

Prune Invalid
{/* Node Tree List Panel */}
NodeTreeListPanel
4 nodes} >
πŸ“ Group 1
πŸ“₯ Data Source
πŸ” Filter
❓ If/Else
{/* Interaction Help Panel */}
InteractionHelpPanel
} aria-label="Reset section" variant="ghost" size="small" /> } >
Select node Click
Multi-select ⇧ Click
Pan canvas Middle Drag
} aria-label="Reset section" variant="ghost" size="small" /> } >
Copy ⌘ C
Paste ⌘ V
Delete ⌫
); }