From c6433c035245a3a50eb8873d56c3243c20df74eb Mon Sep 17 00:00:00 2001 From: Lum1104 Date: Thu, 2 Apr 2026 12:27:32 +0800 Subject: [PATCH] feat(dashboard): add FlowNode and StepNode components for domain view Co-Authored-By: Claude Opus 4.6 (1M context) --- .../dashboard/src/components/FlowNode.tsx | 52 ++++++++++++++++++ .../dashboard/src/components/StepNode.tsx | 53 +++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 understand-anything-plugin/packages/dashboard/src/components/FlowNode.tsx create mode 100644 understand-anything-plugin/packages/dashboard/src/components/StepNode.tsx 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);