Skip to content

Commit 3d1208d

Browse files
authored
Merge pull request #79 from PathOnAI/frontend-fix-0416
small fix for the frontend:
2 parents f9b30ce + b513a2c commit 3d1208d

File tree

3 files changed

+54
-18
lines changed

3 files changed

+54
-18
lines changed

visual-tree-search-app/components/MessageLogPanel.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,9 @@ const MessageLogPanel: React.FC<MessageLogPanelProps> = ({ messages, messagesEnd
416416
<div className="flex items-center gap-2 animate-fadeIn">
417417
{getIcon(message)}
418418
<div className="animate-slideIn">
419-
<div className="text-purple-600 dark:text-purple-400">{message.description}</div>
419+
<div className="text-purple-600 dark:text-purple-400">
420+
{message.description ? `Select ${message.description}` : 'Select the root node'}
421+
</div>
420422
</div>
421423
</div>
422424
);

visual-tree-search-app/components/MessageLogPanelLATS.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -497,9 +497,8 @@ const MessageLogPanelLATS: React.FC<MessageLogPanelProps> = ({ messages, message
497497
<div className="flex items-center gap-2 animate-fadeIn">
498498
{getIcon(message)}
499499
<div className="animate-slideIn">
500-
<div className="text-purple-600 dark:text-purple-400">{message.description}</div>
501-
<div className="text-xs text-slate-500 dark:text-slate-400">
502-
Reason: {message.reason}
500+
<div className="text-purple-600 dark:text-purple-400">
501+
{message.description ? `Select ${message.description}` : 'Select the root node'}
503502
</div>
504503
</div>
505504
</div>

visual-tree-search-app/components/SimpleSearchVisual.tsx

Lines changed: 49 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -256,17 +256,56 @@ const SimpleSearchVisual: React.FC<SimpleSearchVisualProps> = ({ messages }) =>
256256

257257
// Add tooltip interactions
258258
nodes
259-
.on("mouseover", function(event, d) {
260-
if (tooltipRef.current && d.data.description) {
261-
const tooltip = d3.select(tooltipRef.current);
262-
tooltip.transition()
263-
.duration(200)
264-
.style("opacity", .9);
265-
tooltip.html(d.data.description)
266-
.style("left", (event.pageX + 15) + "px")
267-
.style("top", (event.pageY - 60) + "px");
259+
.on("mouseover", function(event, d) {
260+
if (tooltipRef.current) {
261+
let tooltipContent = '';
262+
263+
// Add description if available
264+
if (d.data.description) {
265+
tooltipContent += `<p>${d.data.description}</p>`;
268266
}
269-
})
267+
268+
// Add node status information
269+
const nodeInfo = [];
270+
271+
272+
if (d.data.id === selectedNodeId) {
273+
nodeInfo.push(`<span class="font-semibold text-blue-600 dark:text-blue-400">Selected Node</span>`);
274+
}
275+
276+
if (nodeInfo.length > 0) {
277+
tooltipContent += `<div class="mt-2">${nodeInfo.join(' | ')}</div>`;
278+
}
279+
280+
// Add reward info if available
281+
if (typeof d.data.reward === 'number') {
282+
tooltipContent += `<div class="mt-1">Reward: <span class="font-bold">${d.data.reward.toFixed(2)}</span></div>`;
283+
}
284+
285+
// Add value info if available
286+
if (typeof d.data.value === 'number') {
287+
tooltipContent += `<div>Value: <span class="font-bold">${d.data.value.toFixed(2)}</span></div>`;
288+
}
289+
290+
// Add visits info if available
291+
if (typeof d.data.visits === 'number') {
292+
tooltipContent += `<div>Visits: <span class="font-bold">${d.data.visits}</span></div>`;
293+
}
294+
295+
// Add depth info if available
296+
if (typeof d.data.depth === 'number') {
297+
tooltipContent += `<div>Depth: <span class="font-bold">${d.data.depth}</span></div>`;
298+
}
299+
300+
const tooltip = d3.select(tooltipRef.current);
301+
tooltip.transition()
302+
.duration(200)
303+
.style("opacity", .9);
304+
tooltip.html(tooltipContent)
305+
.style("left", (event.pageX + 15) + "px")
306+
.style("top", (event.pageY - 60) + "px");
307+
}
308+
})
270309
.on("mousemove", function(event) {
271310
if (tooltipRef.current) {
272311
d3.select(tooltipRef.current)
@@ -310,10 +349,6 @@ const SimpleSearchVisual: React.FC<SimpleSearchVisualProps> = ({ messages }) =>
310349
<span className="w-3 h-3 rounded-full inline-block mr-1 bg-blue-500 dark:bg-blue-600"></span>
311350
<span className="text-gray-700 dark:text-gray-300">Selected</span>
312351
</div>
313-
<div className="flex items-center">
314-
<span className="w-3 h-3 rounded-full inline-block mr-1 bg-gray-500 dark:bg-gray-600"></span>
315-
<span className="text-gray-700 dark:text-gray-300">Root</span>
316-
</div>
317352
</div>
318353
</div>
319354
<div

0 commit comments

Comments
 (0)