diff --git a/understand-anything-plugin/packages/dashboard/src/components/FlowNode.tsx b/understand-anything-plugin/packages/dashboard/src/components/FlowNode.tsx new file mode 100644 index 0000000..f9ed10a --- /dev/null +++ b/understand-anything-plugin/packages/dashboard/src/components/FlowNode.tsx @@ -0,0 +1,52 @@ +import { memo } from "react"; +import { Handle, Position } from "@xyflow/react"; +import type { Node, NodeProps } from "@xyflow/react"; +import { useDashboardStore } from "../store"; + +export interface FlowNodeData extends Record { + label: string; + summary: string; + entryPoint?: string; + entryType?: string; + stepCount: number; + flowId: string; +} + +export type FlowFlowNode = Node; + +function FlowNode({ data }: NodeProps) { + const selectNode = useDashboardStore((s) => s.selectNode); + const selectedNodeId = useDashboardStore((s) => s.selectedNodeId); + const isSelected = selectedNodeId === data.flowId; + + return ( +
selectNode(data.flowId)} + > + + + + {data.entryPoint && ( +
+ {data.entryPoint} +
+ )} +
+ {data.label} +
+
+ {data.summary} +
+
+ {data.stepCount} step{data.stepCount !== 1 ? "s" : ""} +
+
+ ); +} + +export default memo(FlowNode); diff --git a/understand-anything-plugin/packages/dashboard/src/components/StepNode.tsx b/understand-anything-plugin/packages/dashboard/src/components/StepNode.tsx new file mode 100644 index 0000000..0fef093 --- /dev/null +++ b/understand-anything-plugin/packages/dashboard/src/components/StepNode.tsx @@ -0,0 +1,53 @@ +import { memo } from "react"; +import { Handle, Position } from "@xyflow/react"; +import type { Node, NodeProps } from "@xyflow/react"; +import { useDashboardStore } from "../store"; + +export interface StepNodeData extends Record { + label: string; + summary: string; + filePath?: string; + stepId: string; + order: number; +} + +export type StepFlowNode = Node; + +function StepNode({ data }: NodeProps) { + const selectNode = useDashboardStore((s) => s.selectNode); + const selectedNodeId = useDashboardStore((s) => s.selectedNodeId); + const isSelected = selectedNodeId === data.stepId; + + return ( +
selectNode(data.stepId)} + > + + + +
+ + {data.order} + + + {data.label} + +
+
+ {data.summary} +
+ {data.filePath && ( +
+ {data.filePath} +
+ )} +
+ ); +} + +export default memo(StepNode);