@@ -103,7 +103,7 @@ const SimpleSearchVisual: React.FC<SimpleSearchVisualProps> = ({ messages }) =>
103
103
setTreeNodes ( updatedTreeNodes ) ;
104
104
setSelectedNodeId ( newSelectedNodeId ) ;
105
105
}
106
- } , [ messages , treeNodes , selectedNodeId ] ) ;
106
+ } , [ messages ] ) ;
107
107
108
108
// Render the tree visualization
109
109
useEffect ( ( ) => {
@@ -221,7 +221,7 @@ const SimpleSearchVisual: React.FC<SimpleSearchVisualProps> = ({ messages }) =>
221
221
: theme === 'dark' ? "#374151" : "#D1D5DB" )
222
222
. attr ( "stroke-width" , d => d . data . id === selectedNodeId ? 3 : 2 ) ;
223
223
224
- // Add node labels directly on the node circles
224
+ // Add node labels with tooltips
225
225
nodes . append ( "text" )
226
226
. attr ( "dy" , ".35em" )
227
227
. attr ( "x" , d => d . children ? - 18 : 18 )
@@ -230,19 +230,18 @@ const SimpleSearchVisual: React.FC<SimpleSearchVisualProps> = ({ messages }) =>
230
230
// For root node
231
231
if ( d . data . parent_id === null ) return "ROOT" ;
232
232
233
- // Extract action name from action string
233
+ // Show full action string
234
234
if ( d . data . action ) {
235
- const actionMatch = d . data . action . match ( / ^ ( [ a - z A - Z _ ] + ) \( / ) ;
236
- return actionMatch ? actionMatch [ 1 ] : "action" ;
235
+ return d . data . action ;
237
236
}
238
237
239
238
return d . data . id . toString ( ) . slice ( - 4 ) ;
240
239
} )
241
- . attr ( "font-size" , "14px " )
240
+ . attr ( "font-size" , "15px " )
242
241
. attr ( "font-weight" , "500" )
243
242
. attr ( "fill" , d => {
244
243
if ( d . data . id === selectedNodeId ) {
245
- return theme === 'dark' ? "#93C5FD" : "#2563EB" ;
244
+ return "#ff5722" ; // Orange for selected node
246
245
}
247
246
return theme === 'dark' ? "#FFFFFF" : "#111827" ;
248
247
} ) ;
@@ -264,29 +263,21 @@ const SimpleSearchVisual: React.FC<SimpleSearchVisualProps> = ({ messages }) =>
264
263
// Add tooltip interactions
265
264
nodes
266
265
. on ( "mouseover" , function ( event , d ) {
267
- if ( tooltipRef . current ) {
268
- let content = `<div><strong>Node ID:</strong> ${ d . data . id } </div>` ;
269
- if ( d . data . action ) content += `<div><strong>Action:</strong> ${ d . data . action } </div>` ;
270
- if ( d . data . description ) content += `<div><strong>Description:</strong> ${ d . data . description } </div>` ;
271
- if ( typeof d . data . value === 'number' ) content += `<div><strong>Value:</strong> ${ d . data . value . toFixed ( 2 ) } </div>` ;
272
- if ( typeof d . data . reward === 'number' ) content += `<div><strong>Reward:</strong> ${ d . data . reward . toFixed ( 2 ) } </div>` ;
273
- if ( typeof d . data . visits === 'number' ) content += `<div><strong>Visits:</strong> ${ d . data . visits } </div>` ;
274
- if ( d . data . feedback ) content += `<div><strong>Feedback:</strong> ${ d . data . feedback } </div>` ;
275
-
266
+ if ( tooltipRef . current && d . data . description ) {
276
267
const tooltip = d3 . select ( tooltipRef . current ) ;
277
268
tooltip . transition ( )
278
269
. duration ( 200 )
279
270
. style ( "opacity" , .9 ) ;
280
- tooltip . html ( content )
271
+ tooltip . html ( d . data . description )
281
272
. style ( "left" , ( event . pageX + 15 ) + "px" )
282
- . style ( "top" , ( event . pageY - 30 ) + "px" ) ;
273
+ . style ( "top" , ( event . pageY - 60 ) + "px" ) ;
283
274
}
284
275
} )
285
276
. on ( "mousemove" , function ( event ) {
286
277
if ( tooltipRef . current ) {
287
278
d3 . select ( tooltipRef . current )
288
279
. style ( "left" , ( event . pageX + 15 ) + "px" )
289
- . style ( "top" , ( event . pageY - 30 ) + "px" ) ;
280
+ . style ( "top" , ( event . pageY - 28 ) + "px" ) ;
290
281
}
291
282
} )
292
283
. on ( "mouseout" , function ( ) {
0 commit comments