mirror of
https://github.com/Egonex-AI/Understand-Anything.git
synced 2026-06-22 10:58:03 +08:00
fix(dashboard): enable click and expand for all node types (function, class, etc.)
Previously only FILE nodes responded to clicks with the code viewer overlay. Now all node types open the detail viewer on click. Also added a direct click handler on CustomNode to fix click events not firing for child nodes inside group layers on Windows. Bump version to 1.0.4.
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
{
|
||||
"name": "understand-anything",
|
||||
"description": "Multi-agent codebase analysis with interactive dashboard, guided tours, and skill commands",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.4",
|
||||
"source": "./understand-anything-plugin"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@understand-anything/skill",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.4",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
|
||||
@@ -32,11 +32,13 @@ export interface CustomNodeData extends Record<string, unknown> {
|
||||
searchScore?: number;
|
||||
isSelected: boolean;
|
||||
isTourHighlighted: boolean;
|
||||
onNodeClick?: (nodeId: string) => void;
|
||||
}
|
||||
|
||||
export type CustomFlowNode = Node<CustomNodeData, "custom">;
|
||||
|
||||
export default function CustomNode({
|
||||
id,
|
||||
data,
|
||||
}: NodeProps<CustomFlowNode>) {
|
||||
const barColor = typeColors[data.nodeType] ?? typeColors.file;
|
||||
@@ -65,8 +67,9 @@ export default function CustomNode({
|
||||
|
||||
return (
|
||||
<div
|
||||
className={`relative rounded-lg bg-elevated border border-border-subtle ${extraClass} min-w-[180px] max-w-[220px] overflow-hidden transition-all duration-200`}
|
||||
className={`relative rounded-lg bg-elevated border border-border-subtle ${extraClass} min-w-[180px] max-w-[220px] overflow-hidden transition-all duration-200 cursor-pointer`}
|
||||
style={{ boxShadow: '0 2px 8px rgba(0,0,0,0.3)' }}
|
||||
onClick={() => data.onNodeClick?.(id)}
|
||||
>
|
||||
{/* Left color bar */}
|
||||
<div
|
||||
|
||||
@@ -31,6 +31,14 @@ export default function GraphView() {
|
||||
const tourHighlightedNodeIds = useDashboardStore((s) => s.tourHighlightedNodeIds);
|
||||
const persona = useDashboardStore((s) => s.persona);
|
||||
|
||||
const handleNodeSelect = useCallback(
|
||||
(nodeId: string) => {
|
||||
selectNode(nodeId);
|
||||
openCodeViewer(nodeId);
|
||||
},
|
||||
[selectNode, openCodeViewer],
|
||||
);
|
||||
|
||||
const { initialNodes, initialEdges } = useMemo(() => {
|
||||
if (!graph)
|
||||
return {
|
||||
@@ -70,6 +78,7 @@ export default function GraphView() {
|
||||
searchScore: matchResult?.score,
|
||||
isSelected: selectedNodeId === node.id,
|
||||
isTourHighlighted: tourHighlightedNodeIds.includes(node.id),
|
||||
onNodeClick: handleNodeSelect,
|
||||
},
|
||||
};
|
||||
});
|
||||
@@ -181,7 +190,7 @@ export default function GraphView() {
|
||||
];
|
||||
|
||||
return { initialNodes: allNodes, initialEdges: laid.edges };
|
||||
}, [graph, searchResults, selectedNodeId, showLayers, tourHighlightedNodeIds, persona]);
|
||||
}, [graph, searchResults, selectedNodeId, showLayers, tourHighlightedNodeIds, persona, handleNodeSelect]);
|
||||
|
||||
const [nodes, setNodes, onNodesChange] = useNodesState(initialNodes);
|
||||
const [edges, setEdges, onEdgesChange] = useEdgesState(initialEdges);
|
||||
@@ -200,10 +209,7 @@ export default function GraphView() {
|
||||
const isGroupNode = graph?.layers?.some((l) => l.id === node.id);
|
||||
if (isGroupNode) return;
|
||||
selectNode(node.id);
|
||||
const graphNode = graph?.nodes.find((n) => n.id === node.id);
|
||||
if (graphNode?.type === 'file') {
|
||||
openCodeViewer(node.id);
|
||||
}
|
||||
openCodeViewer(node.id);
|
||||
},
|
||||
[selectNode, openCodeViewer, graph],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user