mirror of
https://github.com/Egonex-AI/Understand-Anything.git
synced 2026-06-22 10:58:03 +08:00
feat(dashboard): add tour highlight to graph nodes
Wire tourHighlightedNodeIds from the store into GraphView and CustomNode so that nodes referenced by the current tour step get a pulsing blue ring, visually distinct from the white selection ring and yellow search rings. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -44,6 +44,7 @@ export interface CustomNodeData extends Record<string, unknown> {
|
||||
isHighlighted: boolean;
|
||||
searchScore?: number;
|
||||
isSelected: boolean;
|
||||
isTourHighlighted: boolean;
|
||||
}
|
||||
|
||||
export type CustomFlowNode = Node<CustomNodeData, "custom">;
|
||||
@@ -58,6 +59,8 @@ export default function CustomNode({
|
||||
let ringClass = "";
|
||||
if (data.isSelected) {
|
||||
ringClass = "ring-2 ring-white";
|
||||
} else if (data.isTourHighlighted) {
|
||||
ringClass = "ring-2 ring-blue-400 animate-pulse";
|
||||
} else if (data.isHighlighted) {
|
||||
const score = data.searchScore ?? 1;
|
||||
if (score <= 0.1) {
|
||||
|
||||
@@ -26,6 +26,7 @@ export default function GraphView() {
|
||||
const searchResults = useDashboardStore((s) => s.searchResults);
|
||||
const selectNode = useDashboardStore((s) => s.selectNode);
|
||||
const showLayers = useDashboardStore((s) => s.showLayers);
|
||||
const tourHighlightedNodeIds = useDashboardStore((s) => s.tourHighlightedNodeIds);
|
||||
|
||||
const { initialNodes, initialEdges } = useMemo(() => {
|
||||
if (!graph)
|
||||
@@ -48,6 +49,7 @@ export default function GraphView() {
|
||||
isHighlighted: !!matchResult,
|
||||
searchScore: matchResult?.score,
|
||||
isSelected: selectedNodeId === node.id,
|
||||
isTourHighlighted: tourHighlightedNodeIds.includes(node.id),
|
||||
},
|
||||
};
|
||||
});
|
||||
@@ -162,7 +164,7 @@ export default function GraphView() {
|
||||
];
|
||||
|
||||
return { initialNodes: allNodes, initialEdges: laid.edges };
|
||||
}, [graph, searchResults, selectedNodeId, showLayers]);
|
||||
}, [graph, searchResults, selectedNodeId, showLayers, tourHighlightedNodeIds]);
|
||||
|
||||
const [nodes, setNodes, onNodesChange] = useNodesState(initialNodes);
|
||||
const [edges, setEdges, onEdgesChange] = useEdgesState(initialEdges);
|
||||
|
||||
Reference in New Issue
Block a user